
! script name: points.d/spherical
! topic: create point on sphere

!A
!A NAME:
!A
!A 	Spherical
!A
!A DESCRIPTION:
!A
!A 	This script creates points that lie on a sphere and are defined
!A 	by a radius and two angles.
!A	
!A		X= Rcos(Phi)cos(Theta)
!A		Y= Rcos(Phi)sin(Theta)
!A		Z= Rsin(Phi)
!A
!A~ image location - images/sphericalpt.jpg
!B INSTRUCTIONS:
!B
!B 	INPUT ABS RADIUS: Enter the radius of the sphere to be used in
!B 		creating the point.
!B
!B 	INPUT ABS THETA: The angle theta may be compared to longitude.
!B 		Theta is the angle that the projection of the radius 
!B 		onto the X axis creates.
!B
!B 	INPUT ABS PHI: The angle phi may be compared to latitude.  Phi
!B 		is the angle between the radius vector and the Z axis.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: spherical ")

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


DEG

ActivateUndo
Stat=SetXyzInput(WsSpherical)
Ploop:Pt=XyzInput("INPUT",WsXyzInput)
IF (ExitScript(Destination$)) THEN Leave

Stat=SetLastPoint(Pt,WsXyzInput)
ActivateUndo
Stat= AdvanceUndoNumber("point")
Stat= AddItemToUndo(WsUBCreateMode,Pt)
GOTO Ploop

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