Spline
Functions dealing with splines.
- AverageShapes
- Create a shape that is the average of all the passed shapes.
- BuildSpline
- Works like detach, but doesn't delete the sub-spline in the source object.
- CreateSplineFromArray
- Create a spline from an array of Point3's.
- DetachSpline
- Detach a sub-spline from a passed shape.
- ExplodeShape
- Take a shape, break it apart into the component splines, and return them in an array.
- GetRequiredSteps
- Get the number of steps needed to sample a spline at the given interval.
- GetShapeRoots
- Get the root positions of all the passed shapes.
- KnotLengthParam
- Get the uniform arc-length length parameter for the given knot.
- ShapeToRibbon
- Create a ribbon along a given shape, and optionally follows the contours of a mesh.
- ShapeToString
- Create a "string" mesh from a given shape, with one face per segment.
- SmoothShape
- Normalize a spline, but take into account the average shape of the spline over the area which each point represents.
AverageShapes:
Create a shape that is the average of all the passed shapes.
Returns:
A new shape object.
Arguments:
<shapeArray>
- An array of shapes that you want to average together.
[knotCount:0]
- How many knots shouw be in the returned shape. If knotCount is 0 (default), the shape's knot count will be equal to the input shape with the most knots.
[whichSplines:undefined]
- A bitarray. Only those splines corresponding to the set bits are used. ie.
#{1,3}
will cause the second spline to be excluded from being averaged.
Back to top...
BuildSpline:
Works like detach, but doesn't delete the sub-spline in the source object.
Returns:
A new shape object.
Arguments:
<sourceShape>
- The shape with sub-splines you want to extract from.
<splineIndex>
- The index of the sub-spline that you want to extract.
[origin:#world]
- Defines where the new spline's pivot will be. It can be:
- #world: pivot is at [0,0,0], with no rotation
- #original: pivot matches the sourceShape pivot
- #spline: pivot is aligned to the root of the spline, with Z pointing along the spline tangent
Back to top...
CreateSplineFromArray:
Create a spline from an array of Point3's.
Returns:
A shape object.
Arguments:
<pointArray>
- An array of Point3's used to build the spline (one for each knot).
[shapeObject:undefined]
- If you pass in a shape object here, the spline will be created within this shape.
[knotType:#corner]
- The type of knots to create. Can be #corner, #smooth, #bezier, or #beziercorner.
[closed:FALSE]
- Controls whether the spline is closed after creation or not.
Back to top...
DetachSpline:
Detach a sub-spline from a passed shape. Works like BuildSpline()
, but removed the sub-spline from the source shape as well.
Returns:
A new shape object.
Arguments:
%<sourceShape>
- The shape with sub-splines you want to detach.
<splineIndex>
- The index of the sub-spline that you want to detach.
[origin:#world]
- Defines where the new spline's pivot will be. It can be:
- #world: pivot is at [0,0,0], with no rotation
- #original: pivot matches the sourceShape pivot
- #spline: pivot is aligned to the root of the spline, with Z pointing along the spline tangent
Back to top...
ExplodeShape:
Take a shape, break it apart into the component splines, and return them in an array
Returns:
An array of shapes, one for each sub-spline in the original shape. The original shape is not modified.
Arguments:
<sourceShape>
- The shape who's splines you want to explode.
[origin:#world]
- Defines where the new spline's pivot will be. It can be:
- #world: pivot is at [0,0,0], with no rotation
- #original: pivot matches the sourceShape pivot
- #spline: pivot is aligned to the root of the spline, with Z pointing along the spline tangent
Back to top...
GetRequiredSteps:
Get the number of steps needed to sample a spline at the given interval. This is used for the steps:
argument to various spline interpolation functions, like CurveLength()
.
Returns:
The number of integration steps needed to (roughly) sample the shape.
Arguments:
<shapeObject>
- A shape object.
<splineIndex>
- The index of the sub-spline to use.
<lengthParam>
- The required accuracy you need along the spline.
ie. if you need to get 100 evenly spaced samples along a spline, pass in (1.0 / 100) for this argument, and you'll get back a steps
value you can use to guarantee each sample will be unique.
Back to top...
GetShapeRoots:
Get the "root positions" of all the splines in all the passed shapes. The root position is simply the position of knot 1 on each spline.
Returns:
An array of Point3's.
Arguments:
<shapeArray>
- An array of shapes.
Back to top...
GetShapeRoots:
Get the "root positions" of all the splines in all the passed shapes. The root position is simply the position of knot 1 on each spline.
Returns:
An array of Point3's.
Arguments:
<shapeArray>
- An array of shapes.
Back to top...
KnotLengthParam:
Get the uniform arc-length length parameter for the given knot.
Returns:
A float between 0.0 and 1.0 describing the percent along the path for the given knot.
Arguments:
<sourceShape>
<splineIndex>
<knotIndex>
Back to top...
ShapeToRibbon:
Create a ribbon along a given shape, and optionally follows the contours of a mesh.
There is one segment in the ribbon per knot in the source spline.
Returns:
A new ribbon mesh.
Arguments:
<sourceShape>
- The shape you want to create a ribbon from.
<splineIndex>
- The index of the sub-spline you want to create a ribbon from.
[width:#auto]
- The width of the ribbon. If
#auto
is supplied, the width is calculated based on the distance between the first two spline knots. The other valid option is #flip
, which is the same as #auto
, only the ribbon will be extruded in the opposite direction.
[widthScale:1.0]
- Scales the width of the ribbon when
width
is set to #auto
or #flip
. Ignored if the width
is explicitly set.
[contourMesh:-1]
- If supplied, the ribbon will try to follow the contours of the mesh, otherwise the ribbon will lay flat.
[center:false]
- If true, the ribbon middle will be centered on the spline, otherwise the edge of the ribbon will follow the spline.
[mapping:false]
- If true, UVW channel 1 will have mapping assinged.
Back to top...
ShapeToString:
Create a "string" mesh from a given shape, with one face per segment. The mesh is degenerate in that the nth face is created with verts [n,n,n+1]. Intended to be used with SimCloth.
Returns:
A new string mesh.
Arguments:
<sourceShape>
- The shape you want to create a string from.
<splineIndex>
- The index of the sub-spline you want to create a string from.
[extraRootVertex:false]
- If true, an extra vertex will be created "in front of" the first vertex, which can be used by SimCloth to better anchor the string.
Back to top...
SmoothShape:
Normalize a spline, but take into account the average shape of the spline over the area which each point represents. This gives a better representation of the spline than the Normalize Spline modifier does.
Additionally, the first and last points always match on the old and new splines.
Returns:
A new smoothed shape.
Arguments:
<sourceShape>
- The shape you want to create a smoothed version of.
<splineIndex>
- The index of the sub-spline you want to create a smoothed version of.
<knotCount:undefined | segmentLength:undefined>
- One of these must be specified. Controls how many knots are in the smoothed shape.
[filterWidth:1.0]
- This scales the of the filter used when averaging samples on the spline.
The default of 1.0 with size the filter to cover the area between each sample
Larger values cause the samples to be spread out more along the spline, and effectively "smooth out" the spline more.
Smaller values cause the less of the spline to be sampled, where a value of 0.0 effectively point samples the spline, giving results similar to the Normalize Spline modifier.
[numSamples:10]
- The number of samples used to create each knot (10, the default, is usually enough).
Back to top...