How can I convert a 3D polyline to a nice 3D curve ?

# This is a 3D polyline. It turn like half a circle in the plan +X+Y
# and for each segment, the line lift in the air. It make like a rought
# toronado made with 4 segements. How can I transforme this line in a
# nice and smouth 3D curve ?

polyline p \
cos(0) sin(0) 0 \
cos(pi/4) sin(pi/4) 1 \
cos(pi/2) sin(pi/2) 2 \
cos(3*pi/4) sin(3*pi/4) 3 \
cos(pi) sin(pi) 4

Is somebody can give me a hint ?

OCC-ME's picture

I think spline B-spline can do the work

fpga's picture

And for my case, what parameters do I need to use to feed the bsplincurve fonction ?
degree ?
nbknots ?
umult pole ?
weight ?

What is the formula to passe my polyline parameters to the bsplinecurve parameters ?

Stephane Routelous's picture

check GeomAPI_PointsToBSpline or GeomAPI_Interpolate



fpga's picture

Wow, it seem very interesting, but how I can use it in DRAWEXE ? I am not a programmer !

Bearloga's picture

The following script produces the b-spline curve. It writes the intermediate file with points. The command interpol calls GeomAPI_Interpolate.

set fid [open "pnts.dat" w]
puts $fid "5 3d"
puts $fid "[dval cos(0)] [dval sin(0)] 0"
puts $fid "[dval cos(pi/4)] [dval sin(pi/4)] 1"
puts $fid "[dval cos(pi/2)] [dval sin(pi/2)] 2"
puts $fid "[dval cos(3*pi/4)] [dval sin(3*pi/4)] 3"
puts $fid "[dval cos(pi)] [dval sin(pi)] 4"
close $fid
interpol c "pnts.dat"