Modulation command, Envelope curves

Next
 From:  bemfarmer
5592.1 
Are there any thoughts on how to modulate a curve, or constrain the curve between two envelope curves, in 2D?

It can be done with two parametric equations, by multiplying them. For example sine.

It can be done with a brute force selection of say 1000 points, with two curves, and multiplying them.

The lower curve could be different than the top envelope curve.

Maybe some way to do it, using nurbs equations?

Could be useful for Guilloche.

Did some Flow, with line segments.



Image Attachments:
Size: 373.9 KB, Downloaded: 64 times, Dimensions: 847x452px
  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
5592.2 In reply to 5592.1 
Hi Brian, the main way that comes to mind is using Flow - that does allow you to map one envelope curve offset from an existing curve path.

I'm not really sure what you are asking about exactly though, do you want to form a kind of median curve between 2 existing curves?

One possibility for that is to do a loft between the 2 curves and then extract an isoparm (Construct > Curve > Iso) from that lofted surface.

- 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
5592.3 In reply to 5592.2 
Thank you Michael.
The loft and isoparam is good to know, and quick.
Attached is a pseudoModulation done with flow onto a 180 degree revolve of the modulating signal, and project. There
is a little bit of distortion at the beginning and end, and the tips are not symmetric.

I may try to modify lineweb, to add sine waves, in place of lines.


EDITED: 19 Feb 2014 by BEMFARMER


  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
5592.4 
In order to explore creating curves in envelopes, the modulation of a high frequency sine wave, by a low frequency sign wave, was scripted.
Here is a test modulation script, using sine waves. The similarity is AM radio.
There are lots of equations with various variables, from a search of "amplitude modulation." Matlab has some also.
I added an absolute value, which may be wrong.
The script uses the factories array type format, adapted from LineWeb script. (Trying to add a second curve to the Sinewave script did not
display well, like there was some conflict between the two factories.)

I did not know how to assign colors to the factory arrays, but was able to color the curves, by adapted Michaels script "Assign styles to solids," by replacing
breps with curves, and brep with curve. The style assignment could also be at the end, after the Commits.
The side effect is that any other curves on the MoI screen with also have new colors :-)

Is there a better way to assign colors to factory/factories/arrays, in scripts?









Edit: 12/20/2012, updated to version2.

EDITED: 19 Feb 2014 by BEMFARMER

Attachments:

  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
5592.5 In reply to 5592.4 
Hi Brian,

> Is there a better way to assign colors to factory/factories/arrays, in scripts?

Well colors do come from style assignments so to modify them you do need to assign styles like you're doing.

One change you could though would be to only modify styles just on the objects that you are generating instead of other things too.

Right now in the color assignment step, you've got:

var curves = moi.geometryDatabase.getObjects().getCurves();

So that will go get a list of every curve that's in the entire geometry database, even ones that had nothing to do with your current generated ones.

Instead try something like:

var curves = factory.getCreatedObjects();

That should then get you a list of all objects that were generated by that particular factory after it was updated.


You might want to make a helper function at the top something like this:

code:
var g_style_index = 1;

function AssignColors( factory )
{
	var styles = moi.geometryDatabase.getObjectStyles();
	var curves = factory.getCreatedObjects();
	for ( var i = 0; i < curves.length; ++i, ++g_style_index )
	{
		if ( g_style_index == styles.length )
		{
			g_style_index = 0;
		}
		var curve = curves.item(i);
		curve.styleIndex = g_style_index;
	}
}


Then you could modify your other places to call it like this:

code:
        <.....>

//	Three factory(s) to update.
	for ( var k = 0; k < Sfactory.length; ++k )
	{
		Sfactory[k].update();
		AssignColors( Sfactory[k] );
	}
	for ( var k = 0; k < Cfactory.length; ++k )
	{
		Cfactory[k].update();
		AssignColors( Cfactory[k] );
	}
	for ( var k = 0; k < AModfactory.length; ++k )
	{
		AModfactory[k].update()
		AssignColors( AModfactory[k] );
	}



Hope this helps!

- 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
5592.6 In reply to 5592.5 
Thank you very much Michael.
The color assignment changes work well.

Edit 12/20/2012, updated script to version2, previous by 2 posts.
Added Michaels color assignment, and added 2 "envelope" curves.

EDITED: 21 Dec 2012 by BEMFARMER

  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:  bemfarmer
5592.7 
Who needs sine waves?
Adapted this technique from Ralf and wave springs on Alibre forum.
Used Epicyhcloid and Hypocycloid speed reducer curves, Lineweb for even number of points, and FreeformThroughPointCurve command.
Then moved the control points along Z axis, and did loft.

Also did another Envelope/Modulation script with sine waves:

EDITED: 24 Jun 2016 by BEMFARMER

Image Attachments:
Size: 126.6 KB, Downloaded: 11 times, Dimensions: 416x251px
Size: 47.3 KB, Downloaded: 3 times, Dimensions: 160x96px
Size: 56.3 KB, Downloaded: 2 times, Dimensions: 160x159px
  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