Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ spline_sphe(3G) — PersonalVisualizer 2.11

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

curve_resolution(3G)

trimming_curve(3G)

vertex_format(3G)

spline_sphere(3G)

NAME

spline_sphere − draw a sphere using a spline surface

SYNOPSIS

C Syntax:

void spline_sphere(fildes,rad,x,y,z,dirx,diry,dirz,
refx,refy,refz);
int fildes;
float rad,x,y,z,dirx,diry,dirz,refx,refy,refz;

FORTRAN77 Syntax:

subroutine spline_sphere(fildes,rad,x,y,z,dirx,diry,dirz,
refx,refy,refz)
integer*4 fildes
real rad,x,y,z,dirx,diry,dirz,refx,refy,refz

Pascal Syntax:

procedure spline_sphere(fildes:integer;rad,x,y,z,dirx,
diry,dirz,refx,refy,refz:real);

DESCRIPTION

Input Parameters

fildes Integer file descriptor returned by gopen when an I/O path to a graphics device is opened. 

rad Radius of the sphere. 

x,y,z Position of the center of the sphere in modelling coordinates. 

dirx,diry,dirz Defines the direction vector, anchored at (x,y,z), of the sphere’s central axis. 

refx,refy,refz Defines a direction that determines the (u,v) origin of the sphere’s spline surface. 

Discussion

spline_sphere draws a sphere-shaped rational spline surface.  The sphere is centered at (x,y,z) and has a radius of rad. 

The sphere’s central axis runs through (x,y,z) in the direction defined by (dirx,diry,dirz).  The two points where the axis intersects the sphere are the poles of the sphere, and the pole closest to (dirx,diry,dirz) is the top or “north” pole.  (dirx,diry,dirz) is given as a vector direction and need not be normalized to unit length. 

spline_sphere converts the sphere parameters into a 9×5 (quadratic, quadratic) control-point matrix that defines an eight-patch (4×2) spline surface.  The (u,v) origin of this spline surface is set at the sphere’s “south” pole.  The reference direction (refx,refy,refz) determines the orientation of the (u,v) space.  The v axis runs along the perimeter of the sphere, from v=0.0 at the south pole to v=1.0 at the north pole, and passes through the point on the equator that is closest to (refx,refy,refz).  The reference direction is given as a vector, need not be normalized to unit length, and need not be perpendicular to the central axis.  The u axis maps in a right-hand fashion along the equator of the sphere starting at the v axis where u=0.0 and proceeding to u=1.0.

In cases where the precise orientation of the (u,v) space does not matter, (if trimming curves are not used, for example), both (dirx,diry,dirz) and (refx,refy,refz) can be arbitrarily set.  For fastest performance, set both to (0.0,0.0,0.0). 

If both the axis direction vector and the reference direction are set to (0.0,0.0,0.0) and trim curves are used, (0.0,0.0,1.0) is set as the axis direction and (1.0,0.0,0.0) is used for the reference direction.  If an axis direction is set, and the reference direction is either (0.0,0.0,0.0) or is parallel to the axis, a reference direction of (1.0,0.0,0.0) is used relative to an axis vector of (0.0,0.0,1.0).  The transformation from (0.0,0.0,1.0) to the axis also transforms the reference direction to its new orientation. 

Because the sphere is rendered as a spline surface, it is subject to all conditions set by the user with functions such as vertex_format, curve_resolution, trimming_curve, etc.  A vertex_format of CLOCKWISE (0) displays the outside of the surface, while COUNTER_CLOCKWISE (1) displays the inner surface.  spline_sphere sets its own u and v knot vectors, ignoring any existing Starbase knot vectors.  Existing Starbase knot vectors are saved when spline_sphere is called and then restored after the call. 

NOTES

This primitive command can be used with all global and non-global rendering modes. 

Starbase texture mapping may be applied to spline spheres.  The mapping of textures onto the sphere is determined by the (u,v) mapping of the spline surface on the sphere. 

The Starbase ray tracer is optimized for the smooth shaded sphere, as it uses the algebraic form to render the object.  A sphere which is passed to the ray tracer without smooth shading (no normals per vertex), will be treated by the ray tracer as an ordinary spline surface, which requires a slower and more memory-intensive rendering. 

ERRORS

Invalid file descriptor. 
rad less than or equal to 0.0. 

SEE ALSO

curve_resolution(3G), trimming_curve(3G), vertex_format(3G), Starbase Graphics Techniques.

  —  July 12, 1991

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026