
! script name: nurbs.d/beziergroup
! topic: Sample - construct bezier curve through given group of points

!A
!A NAME:
!A
!A 	Bezier Curve
!A
!A DESCRIPTION:
!A
!A 	This script constructs a bezier curve using a group of points
!A 	as control points.
!A
!A 	A bezier curve is a polynomial, the degree of the polynomial is
!A 	equal to the number of points minus one, and is tangent at both
!A 	ends of the curve, and is influenced by the weight of the other
!A 	points.
!A
!A~ image location - images/beziercurve.jpg
!B INSTRUCTIONS:
!B
!B 	PICK GROUP OF POINTS: Pick the group of points. The spline curve
!B 		will use the points in the order they appear in the group.
!B
!B NOTES:
!B
!B 	Enter the last point twice to end the point input mode.
!B
!C NOTE:
!C
!C 	This is an unsupported sample script.
!C

stat=ChangeLabelStr("ScriptNameStatus","Function: bezier group ")

DIM Answer$[256]
DIM Destination$[256]
DEG

ActivateUndo
Group_loop:!

Group= PickGroupEnt("PICK GROUP OF POINTS")
IF (ExitScript(Destination$)) THEN Leave

Group1=PtsInGroup(Group,WsPickPoints)

Sp=BSplinePtGrp(Group1,0,3)
Stat=DeleteEntity(Group1)

ActivateUndo
Stat= AdvanceUndoNumber("bezier curve")
Stat= AddItemToUndo(WsUBCreateMode,Sp)
GOTO Group_loop

Leave:!
Stat=DeleteEntity(Group1)
IF (NOT LEN(Destination$)) THEN
	 LOAD "typecontrol"
ELSE
	 LOAD Destination$
END IF
END

