Convert a control point curve to interpolation points (through points)?

Next
 From:  bemfarmer
5247.1 
Michael,
Is there any way in MoI to convet a control point curve, to an interpolation points, or through points curve?

I suppose this is philosophically backwards...
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
5247.2 In reply to 5247.1 
Hi Brian, really a "control point curve" and a "through points curve" are just different construction methods both of which just create a NURBS curve...

Do you mean you want to build a new curve that is interpolated through the control points of an existing curve? There is nothing prepackaged up for that right now and it will be difficult to script it because the control points are not currently exposed to script. You can turn on control points and snap on to them while drawing a "through points" curve though.

Could you maybe describe a bit more about what you're trying to do?

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
5247.3 In reply to 5247.2 
Preliminarily, I was thinking of something like this, based upon mouse input, with modifed SketchCurve.js :

(I'm sure my code is probably very messed up.) :-)

code:
function DoFairCurve()
{
	var ui = moi.ui;
	var pointstreampicker = ui.createPointStreamPicker();
//Delete: var curvefactory = moi.command.createFactory( 'sketchcurve' );

//Delete: pointstreampicker.bind( curvefactory );
	
	while ( 1 )
	{
		if ( !pointstreampicker.waitForEvent() )
			return;
			
		if ( pointstreampicker.event == 'finished' )
			break;
	}
		
//Delete: curvefactory.commit();

	var numPts = pointstreampicker.numPoints;
	for ( var i=0; i < numPts; i++ )
	{
		var point = pointstreampicker.getPoint[i];
/*
	Save the points in array or something.
	Manipulate the points to make a "fair, high-quality" curve, with
	clothoids, etc. somehow, in javascript.
	Save the modified curve as a Nurbs control point curve.
*/
	}
}

DoFairCurve();


Or the input curve could be a curve on the screen, created some way other than with mouse trace...
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
5247.4 In reply to 5247.3 
Hi Brian, I see - but it's probably going to be quite difficult to get a good fairing routine just done in script.

But you might check out the RebuildCurve script that Petr made all in script before the regular Rebuild command was implemented though - it samples points on an existing curve and then makes a new "curve through point" through those points, it's the one here:
http://kyticka.webzdarma.cz/3d/moi/#ReconstructCurve

That does what I think you're asking about, getting some points along an existing curve than using "Curve through points" to build a new curve through those points.

That's more about reducing a curve's control point structure more than actual "fairing" though.


I am planning on experimenting with some other curve fairing mechanisms that will be more based on altering an existing curve's tangents to try and more evenly distribute changes in curvature. It won't be easy to do that at a script level right now though.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
5247.5 In reply to 5247.4 
Thank you very much Michael.
I guess the heavy work is done in the C++ code, at a much faster rate, with the Javascript for an "interface."

Looking forward to your future features.

Brian
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  Michael Gibson
5247.6 In reply to 5247.5 
Hi Brian,

> I guess the heavy work is done in the C++ code, at a much faster rate,
> with the Javascript for an "interface."

Yeah that's mostly how things are set up. Javascript code is used to control things at a high level like the workflow of a command, hide/show different controls, etc... while the more heavy duty calculation is done at the C++ level.

But in the future I think it will be possible to do some more advanced stuff with script by growing the library of geometry related functions that are exposed to be script callable.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All