VARKON Version 1.18 2006-3-16

> ## cur_spline - Geometric procedure

> Creates a curve

> Description

> Creates a non rational cubic parametric segmented curve that interpolates two or more positions and optional tangents. Tangents not specified are calculated using one of the following spline algorithms.

> Ferguson: This algorithm gives a curve with C2 continuity and very gentle curvature variation. It is best suited to interpolate evenly spaced positions. Use this curve if you want a curvature variation which is as gentle as possible.

> Chordlengt: This curve is also C2 continous but curvature can change rapidly. Positions may be unevenly spaced and you will still get a nice curve but with very unevenly spaced positions the curve might produce a loop. Use this curve if you want a curve which is equal to the loftmans traditional wooden spline.

> Variable Stiffness: This curve is only C1 countinous. The algorithm is based on a model where each segment of the curve has a bending stiffness proportional to the distance between its two end positions. Short distance between positions gives a softer segment that may have higer curvature than a longer segment which becomes stiffer.Use the variable stiffness curve if you have very unevenly spaced positions and want to be sure to get a nice curve with no loops.

> For each position an optional tangent position may be specified. If supplied, tangent positions should be given as true positions relative to the corresponding position the curve interpolates (not relative to (0,0,0)) and with appropriate length. A tangent position of (0,0,0) is treated as "no tangent". A long tangent gives a wawier segment and a short tangent gives a less wawy segment.

> If no tangents are given in the start- and/or end position the result will be a curve with a free end(s), ie. with curvature = 0.

> Syntax

> cur_spline(id, type, p1, t1, p2, t2, pn, tn:attributes);

> REF | id;
> STRING | type*4;
> VECTOR | p1;
> VECTOR | t1;
> VECTOR | p2;
> VECTOR | t2;
> VECTOR | pn;
> VECTOR | tn;

> Principal parameters

> id | - Local identity
> type | - The string "FERGUSON", "CHORD" or "STIFFNESS"
> p1 | - First position (beginning of first segment)
> p2 | - Second position (end of first segment)

> Optional parameters

> t1 | - Tangent in first defining position
> t2 | - Tangent in second defining position
> pn | - Additional defining positions, one per additional segment
> tn | - Tangents in additional defining positions, one per additional segment

> Attributes

> PEN | - Pen or colour number
> LEVEL | - Level number
> BLANK | - Visible(0) or invisible(1)
> CFONT | - Solid(0), dashed(1) or centerline(2)
> CDASHL | - Dashlength
> WIDTH | - Linewidth

> Examples

>     cur_spline(#10,"CHORD",vec(0,0), ,vec(5,5), ,vec(10,0));

> Creates a planar curve with two segments. All tangents are automatically calculated (splined) by the system using the chordlength spline algorithm.

>     cur_spline(#1,"STIFFNESS",vec(0,0,0),vec(0,10,0), vec(5,5,0),vec(10,0,10),
>     vec(10,0,0),vec(0,-10,0), vec(15,0,0),vec(0,10,0));

> Creates a twisted space curve with three segments. Tangent positions are supplied for all defining positions. The tangent for the first position is 10 units long and has the same direction as the positive Y-axis. Since tangents are given for all defining positions the curve is completely defined in advance and no internal splining is needed. In that case "STIFFNESS" will produce the same result as "FERGUSON" or "CHORD".

>     GLOBAL GEOMETRY MODULE curve_spline();

>     BEGINMODULE

>       poi_free(#1,vec(92, 93, 0) :WIDTH=1);
>       poi_free(#2,vec(132,141, 0):WIDTH=1);
>       poi_free(#3,vec(136,141, 0):WIDTH=1);
>       poi_free(#4,vec(198, 81, 0):WIDTH=1);

>       cur_spline(#5,"FERGUSON",on(#1),vec(0,0,0),on(#2),vec(0,0,0),on(#3),vec(0,0,0),on(#4),vec(0,0,0):WIDTH=0.25);
>       cur_spline(#6,"STIFFNESS", on(#1),vec(0,0,0),on(#2),vec(0,0,0),on(#3),vec(0,0,0),on(#4),vec(0,0,0):PEN=2,WIDTH=0.25);
>       cur_spline(#7,"CHORD",on(#1),vec(0,0,0),on(#2),vec(0,0,0),on(#3),vec(0,0,0),on(#4),vec(0,0,0):WIDTH=0.25,PEN=4);

>       text(#8,vec(130,150,0), 0.0, "Ferguson":TSIZE=2,TWIDTH=40,TFONT=2,TPMODE=1);
>       text(#9,vec(158,120,0), 0.0, "Stiffness":TSIZE=2,TWIDTH=40,TFONT=2,TPMODE=1,PEN=2);
>       text(#10,vec(115,140,0),0.0, "Chord":TSIZE=2,TWIDTH=40,TFONT=2,TPMODE=1,PEN=4);

>     ENDMODULE

> The module listed above will create a planar curves with three segments by using the three algorithms Ferguson,Chord length and Stiffness .The same control points are used.
> Next picture illustrate the differences between the three algorithms.

> Comments

> The spline type "FREE" and "PROJ" used in Varkon version 1.17A and earlier are still supported but removed from the documentation and should not be used any more.

> cur_spline is intended for curves with relatively few defining positions, maximum = 50. To interpolate large number of positions use cur_splarr.

VARKON Homepage | Index