Description Adds a NURB curve to the associated FRED document.
Syntax n = AddNURBCurve ( entity, numTerms, order, points, knots )
Parameters n (Long) Node number for the new curve.
entity As T_ENTITY The generic entity data for the new curve.
numTerms As Long The number of control points in the curve.
order As Long The polynomial order of the NURB Basis Functions. Note that NURB order = degree +1. For example, an order 3 NURB is quadratic and an order 4 NURB is cubic.
points() As Double The control points and associated weights. This array should have dimensionality (3,N-1), where N is the number of control points in the curve. For each control point, the first index associates with the following control point quantity: 0: X position of the control point 1: Y position of the control point 2: Z position of the control point 3: weight of the control point
knots() As Double NURB basis function knot vector elements, in ascending order.
Remarks The following example shows how to construct a NURB curve of order 3 with 3 control points. The knot vector construction ensures that the curve passes through the first and last control points.
Sub Main
'Custom element Dim tEnt As T_ENTITY Dim ceNode As Long InitEntity( tEnt ) ceNode = AddCustomElement( tEnt )
'NURB Curve Dim nc As Long Dim points(3,2) As Double Dim knots(5) As Double InitEntity( tEnt ) tEnt.Name = "NURB Curve" tEnt.parent = ceNode
'Knot vector is degenerate at each end to ensure curve 'passes through first and last control points knots(0) = 0 knots(1) = 0 knots(2) = 0 knots(3) = 1 knots(4) = 1 knots(5) = 1
'First control point and weight points( 0, 0 ) = 0 'x points( 1, 0 ) = 0 'y points( 2, 0 ) = 0 'z points( 3, 0 ) = 1 'weight 'Second control point and weight points( 0, 1 ) = 2 'x points( 1, 1 ) = 2 'y points( 2, 1 ) = 0 'z points( 3, 1 ) = 10 'weight 'Third control point and weight points( 0, 2 ) = 4 'x points( 1, 2 ) = 0.5 'y points( 2, 2 ) = 0 'z points( 3, 2 ) = 1.0 'weight
'Add the curve node nc = AddNURBCurve( tEnt, 3, 3, points(), knots() )
'Now draw Dim tCB As T_CURVEBASICINFO GetCurveBasicInfo( nc, tCB ) tCB.curveDraw = True SetCurveBasicInfo( nc, tCB )
Update
End Sub
See Also
|