Main Page   Modules   Alphabetical List   Data Structures   Data Fields  

RpSpline
[Math Tools]


Data Structures

struct   RpSpline

Functions

RpSpline RpSplineStreamRead (RwStream *stream)
const RpSpline RpSplineStreamWrite (const RpSpline *spline, RwStream *stream)
RwUInt32  RpSplineStreamGetSize (const RpSpline *spline)
RwInt32  RpSplineGetNumControlPoints (const RpSpline *spline)
RwV3d RpSplineGetControlPoint (RpSpline *spline, RwInt32 control, RwV3d *point)
RpSpline RpSplineSetControlPoint (RpSpline *spline, RwInt32 control, RwV3d *point)
RwV3d RpSplineFindPosition (RpSpline *spline, RwInt32 path, RwReal where, RwV3d *pos, RwV3d *tangent)
RwReal  RpSplineFindMatrix (RpSpline *spline, RwInt32 path, RwReal where, RwV3d *up, RwMatrix *matrix)
RpSpline RpSplineClone (RpSpline *spline)
RpSpline RpSplineRead (RwChar *name)
RwBool  RpSplineWrite (RpSpline *spline, RwChar *name)
RwBool  RpSplineDestroy (RpSpline *spline)
RpSpline RpSplineCreate (RwInt32 numCtrlPoints, RwInt32 type, RwV3d *ctrlPoints)
RwBool  RpSplinePluginAttach (void)

Detailed Description

Spline Plugin for RenderWare Graphics.

RpSpline Plugin Overview

Requirements

Overview

The RpSpline plugin provides a number of useful API extensions to support the use and manipulation of interpolating cubic uniform B-Spline curves.

Functions provided allow you to create splines and store them in RpSpline datatypes. These splines can then be used within your application. Supporting functions include the ability to adjust the control points, find a location along a spline and generate Frenet matrices.

For more background on cubic uniform B-Splines, see the page 90 of the book: "Advanced Animation and Rendering Techniques", Watt and Watt, Addison Wesley, ISBN 0-201-54412-1. http://www.awlonline.com/productpage/?ISBN=0201544121


Function Documentation

RpSpline* RpSplineClone RpSpline   spline
 

RpSplineClone copies the specified spline. This function creates a new spline with exactly the same attributes as the original.

The spline plugin must be attached before using this function.

Parameters:
spline  Pointer to the spline.
Returns:
Returns a pointer to the new spline if successful or NULL if there is an error.
See also:
RpSplineCreate , RpSplineRead , RpSplineStreamRead , RpSplineDestroy , RpSplinePluginAttach
RpSpline* RpSplineCreate RwInt32    numCtrlPoints,
RwInt32    type,
RwV3d   ctrlPoints
 

RpSplineCreate is used to create a new interpolating cubic spline of the specified type with the given array of control point positions. The number of control points must be greater than or equal to four.

Parameters:
numCtrlPoints  An RwInt32 value equal to the number of control points.
type  An RwInt32 value equal to the spline type:
  • rpSPLINETYPEOPENLOOPBSPLINE Open loop - the curve starts at the first control point and ends at the last control point.
  • rpSPLINETYPECLOSEDLOOPBSPLINE Closed loop - the curve at the end control point is joined to the curve at the start control point.
Parameters:
ctrlPoints  Pointer to an array of RwV3d values containing the positions of the control points.
Returns:
Returns a pointer to the new spline if successful or NULL is there is an error.
See also:
RpSplineDestroy , RpSplinePluginAttach
RwBool RpSplineDestroy RpSpline   spline
 

RpSplineDestroy is used to destroy the specified spline.

Note this function does not free the memory holding the original control point array if the spline was created with RpSplineCreate.

The spline plugin must be attached before using this function.

Parameters:
spline  Pointer to the spline.
Returns:
Returns TRUE if successful or FALSE if there is an error
See also:
RpSplineCreate , RpSplinePluginAttach
RwReal RpSplineFindMatrix RpSpline   spline,
RwInt32    path,
RwReal    where,
RwV3d   up,
RwMatrix   matrix
 

RpSplineFindMatrix is used to calculate a matrix representing the Frenet matrix at the given parameter position along the specified spline. This matrix can be used to transform an object's frame to the given parameter position and orientation as follows: look-at vector tangent to the path (pointing in the sense of increasing parameter value), look-up vector as specified by up, and look-right vector pointing either towards or away from the center of curvature.

The spline plugin must be attached before using this function.

Parameters:
spline  Pointer to the spline.
path  An RwInt32 value equal to the spline path type:
  • rpSPLINEPATHSMOOTH - "Constant velocity" path.
  • rpSPLINEPATHNICEENDS - "Acceleration" into path, "decelerate" out of path.
where  An RwReal value equal to the position along the spline; start position is defined as zero; end position as one.
up  An RwV3d value equal to the frame's look-up vector. Specifying NULL calculates a matrix with look-up vector aligned with that of the Frenet frame and a look-right vector pointing towards the center of curvature.
matrix  An RwMatrix value that will receive the matrix.
Returns:
Returns an RwReal value equal to the spline's curvature at the point in question if successful or -1 if there is an error.
See also:
RpSplineFindPosition , RpSplineGetControlPoint , RpSplinePluginAttach
RwV3d* RpSplineFindPosition RpSpline   spline,
RwInt32    path,
RwReal    where,
RwV3d   pos,
RwV3d   tangent
 

RpSplineFindPosition is used to calculate the position and the unit tangent vector (pointing in the sense of increasing parameter value) of a point on the specified spline with the given parameter value.

The spline plugin must be attached before using this function.

Parameters:
spline  Pointer to the spline.
path  An RwInt32 value equal to the spline path type:
  • rpSPLINEPATHSMOOTH - "Constant velocity" path. Note that this refers to constant velocity in control point space, and not in cartesian space. The plugin assumes that each control point is one unit away from its neighbours. If you require constant velocity in cartesian (world) space then the control points must be distributed evenly along the spline in world space. At this time RenderWare does not perform this resampling.
  • rpSPLINEPATHNICEENDS - "Accelerate" into path, "deccelerate" out of path.
where  An RwReal value equal to the position along the spline: start position is defined as zero; end position as one.
pos  An RwV3d value that will receive the position of the required point.
tangent  An RwV3d value that will receive the position of the end point of the unit tangent vector. If the tangent is not required to be computed, its value can be set to NULL.
Returns:
Returns an RwV3d value equal to the position of the required point if successful or NULL if there is an error.
See also:
RpSplineFindMatrix , RpSplineGetControlPoint , RpSplineGetNumControlPoints , RpSplinePluginAttach
RwV3d* RpSplineGetControlPoint RpSpline   spline,
RwInt32    control,
RwV3d   point
 

RpSplineGetControlPoint is used to retrieve the position of the given control point in the specified spline.

The spline plugin must be attached before using this function.

Parameters:
spline  Pointer to the spline.
control  An RwInt32 value equal to the index of the control point in the range of 0 to numPoints-1.
point  Pointer to an RwV3d value that will receive the position of the control point.
Returns:
Returns pointer to the control point position if successful or NULL is there is an error.
See also:
RpSplineSetControlPoint , RpSplineGetNumControlPoints , RpSplineFindPosition , RpSplineFindMatrix , RpSplinePluginAttach
RwInt32 RpSplineGetNumControlPoints const RpSpline   spline
 

RpSplineGetNumControlPoints is used to retrieve the number of control points defining the specified spline

The spline plugin must be attached before using this function.

Parameters:
spline  Pointer to the spline.
Returns:
Returns an RwInt32 value equal to the number of control points if successful or zero if there is an error.
See also:
RpSplineSetControlPoint , RpSplineGetControlPoint , RpSplineFindPosition , RpSplineFindMatrix , RpSplinePluginAttach
RwBool RpSplinePluginAttach void   
 

RpSplinePluginAttach is used to attach the spline plugin to the RenderWare system to enable the generation of interpolating cubic splines. The spline plugin must be attached between initializing the system with RwEngineInit and opening it with RwEngineOpen.

Note:
The include file rpspline.h is required and must be included by an application wishing the use interpolating cubic splines.
Returns:
Returns TRUE if successful or FALSE if there is an error
See also:
RwEngineInit , RwEngineOpen , RwEngineStart
RpSpline* RpSplineRead RwChar   name
 

RpSplineRead is used to read a spline from the given disk file. This function uses the binary stream mechanism for reading the spline data.

The spline plugin must be attached before using this function.

Parameters:
name  Pointer to a string containing the name of the input file.
Returns:
Returns a pointer to the new spline if successful or NULL if there is an error.
See also:
RpSplineStreamRead , RpSplineWrite , RpSplineStreamWrite , RpSplinePluginAttach
RpSpline* RpSplineSetControlPoint RpSpline   spline,
RwInt32    control,
RwV3d   point
 

RpSplineSetControlPoint is used to redefine the position of the given contrl point in the specified spline and recalculate the spline.

The spline plugin must be attached before using this function.

Parameters:
spline  Pointer to the spline.
control  An RwInt32 value equal to the index of the control point (index of the first control point is zero).
point  Pointer to an RwV3d value equal to the position of the control point.
Returns:
Returns a pointer to the spline if successful or NULL if there is an error.
See also:
RpSplineGetControlPoint , RpSplineGetNumControlPoints , RpSplineFindPosition , RpSplineFindMatrix , RpSplinePluginAttach
RwUInt32 RpSplineStreamGetSize const RpSpline   spline
 

RpSplineStreamGetSize is used to determine the size in bytes of the binary representation of the specified spline object. This is used in the binary chunk header to indicate the size of the chunk. The size does not include the size of the chunk header.

The spline plugin must be attached before using this function.

Parameters:
spline  Pointer to the spline.
Returns:
Returns an RwUInt32 value equal to the chunk size of the spline if successful or zero if there is an error.
See also:
RpSplineStreamRead , RpSplineStreamWrite , RpSplinePluginAttach
RpSpline* RpSplineStreamRead RwStream   stream
 

RpSplineStreamRead is used to read a spline from the specified binary stream. Note that prior to this function call a binary spline chunk must be found in the stream using the RwStreamFindChunk API function.

The spline plugin must be attached before using this function.

The sequence to locate and read a spline from a binary stream is as follows

   RwStream *stream;
   RpSpline *newSpline;
  
   stream = RwStreamOpen(rwSTREAMFILENAME, rwSTREAMREAD, "mybinary.xxx");
   if( stream )
   {
       if( RwStreamFindChunk(stream, rwID_SPLINE, NULL, NULL) )
       {
           newSpline = RpSplineStreamRead(stream);
       }
  
       RwStreamClose(stream, NULL);
   }
Parameters:
stream  Pointer to the stream.
Returns:
Returns a pointer to the new spline if successful or NULL if there is an error.
See also:
RpSplineStreamWrite , RpSplineStreamGetSize , RwStreamOpen , RwStreamClose , RwStreamFindChunk , RpSplinePluginAttach
const RpSpline* RpSplineStreamWrite const RpSpline   spline,
RwStream   stream
 

RpSplineStreamWrite is used to write the specified spline to the given binary stream. Note that the stream will have been opened prior to this function call.

The spline plugin must be attached before using this function.

Parameters:
spline  Pointer to the spline.
stream  Pointer to the stream.
Returns:
Returns a pointer to the spline if successful or NULL if there is an error.
See also:
RpSplineStreamRead , RwStreamOpen , RwStreamClose , RpSplinePluginAttach
RwBool RpSplineWrite RpSpline   spline,
RwChar   name
 

RpSplineWrite is used to write the specified spline to the given disk file. This function uses the binary stream mechanism for writing the spline data.

The spline plugin must be attached before using this function.

Parameters:
spline  Pointer to the spline
name  Pointer to a string containing the name of the output file
Returns:
Returns TRUE if successful or FALSE if there is an error
See also:
RpSplineStreamWrite , RpSplineRead , RpSplineStreamRead , RpSplinePluginAttach

Criterion Software © 1993-2003 Criterion Software Limited. All rights reserved. Built Tue Apr 22 12:46:28 2003. Send Feedback
Converted from CHM to HTML with chm2web Pro 2.85 (unicode)