|
Prisms Development Toolkit Documentation
Side Effects Software Inc. 1997
|
Programmers Reference Section
Matrix, Vector and Transform Subroutines
Primitive Generators
PolyDetailPointer
PolyCircle(Point center, float radius, float bAngle, int numPts)
Generate a circle at center with given radius, etc
PolyDetailPointer
PolyCircleS(Point center, float radius, int numPts)
Generate a sliced circle.
PolyDetailPointer
PolyArc(Point center, float radius, float start,
float end, int numPts)
Generate an arc with given start/end angles.
PolyDetailPointer
PolyArcS(Point center, float radius, float start,
float end, int numPts)
Generate a sliced arc.
PolyDetailPointer
PolyCube(float xCent, float yCent, float zCent,
float xSide, float ySide, float zSide)
Generate a cube with given dimensions.
PolyDetailPointer
PolyGridAllocate(int rows, int cols, int format)
Generate a grid (row x col) where format is one of
GRID_TRIANGLES GRID_ROWS GRID_COLUMNS
GRID_ROWCOLS
PolyDetailPointer
PolyLineT(Point first, Point last, int numPts)
return line between two points, with numPts interval points.
PolyDetailPointer
PolyLineD(Point first, Vector direct, float dist, int numPts)
return line from first, along direct, for dist, using numPts.
Adding Detail
void PolyAddPoint(PolyPointPointer newPt, PolyDetailPointer pdp)
void PolyAddPolygon(PolygonPointer newPy, PolyDetailPointer pdp)
Copies points and polys of newP to end of lists for pdp
void PolyAddDetail(PolyDetailPointer pdp1, PolyDetailPointer pdp2)
Adds all points/polys of pdp2 onto ends of pdp1
Uses PolyCopyDetail and PolyJoin
void PolyCopy(Polygon *ppoly, PolyDetail *dest)
copy poly to dest
PolyDetailPointer PolyCopyDetail(PolyDetail *pdp)
return copy of pdp
PolyDetailPointer PolyCopyUnique(PolyDetail *ipdp)
return copy with unique points for each polygon
PolygonPointer PolyCopyP(Polygon *ppoly, PolyDetail *dest)
same as PolyCopy but returns pointer to new polygon.
Joining Detail
void PolyJoin(PolyDetail *pdp1, PolyDetail *pdp2)
void PolyJoinPoints(PolyDetail *pdp1, PolyDetail *pdp2)
void PolyJoinPolys(PolyDetail *pdp1, PolyDetail *pdp2)
void PolyJoinFast(PolyDetail *pdp1, PolyDetail *pdp2)
Joins two pdps without copying data. PolyJoinFast does so
without renumbering points and polys, so should not be used
as last join. Upon return, suggest free(pdp2).
Cleaning Tools
int PolyRmConcave(PolyDetail *pdp, PolyDetail *xpdp, int quiet)
int PolyRmNonPlanar(PolyDetail *pdp, float delta,
PolyDetail *xpdp, int quiet)
Identify and/or remove concave (non-planar) polys in pdp.
If quiet == FALSE, print polygon numbers.
if xpdp == NULL do not remove concave (non-planar) polys, else
put concave polys into xpdp structure.
Return number of concave (non-planar) polys.
Delta is a tolerance for non-planarity.
int PolyRmDegenerate(PolyDetail *pdp, PolyDetail *xpdp)
Remove CLOSED polys of pdp which have 0, 1 or 2 points.
If xpdp != NULL, put those polys into xpdp.
Return number of polys removed.
int PolyRmUnusedPoints(PolyDetail *pdp)
Removes unused points from pdp. Returns number removed.
int PolyRmRepeatRef(PolyDetail *pdp)
Remove repeated point references in pdp. Return number removed.
PolyDetail *PolyRmSharedEdge(PolyDetail *pdp)
Removes shared edges from pdp, leaving outline.
PolyPointPointer PolyRmPoint(PolyPoint *ptp, PolyDetail *pdp)
PolygonPointer PolyRmPolygon(Polygon *plp, PolyDetail *pdp)
Remove the specified primitive from the pdp.
int PolyConsolidate(PolyDetail *pdp, float distance)
points within a cube of distance are consolidated with that point.
Keeps the color, texture and normal of point at center of cube.
int PolyConsolidateC(PolyDetail *pdp, float distance, float coldist)
points within a cube of distance and whose color values are
within coldist, are consolidated with that point.
Keeps texture and normal of point at center of cube, averages color.
int PolyConsolidateT(PolyDetail *pdp, float distance, float textdist)
points within a cube of distance and whose texture values are
within textdist, are consolidated with that point.
Keeps color and normal of point at center of cube, averages texture.
int PolyConsolidateCT(PolyDetail *pdp, float distance,
float coldist, float textdist)
points within a cube of distance and whose texture values are
within textdist, and whose color values are within coldist,
are consolidated with that point.
Keeps normal of point at center of cube, averages texture & color.
Extrusion Routines
void PolyExtrude3(PolyDetail *pdp, int cap1, int cap2, int ring)
void PolyExtrude3N(PolyDetail *pdp, int polyPerCross,
int cap1, int cap2, int ring)
Extrude between polys of pdp, using triangles
3N specifies number of polys in cross section
cap1 = TRUE: keep first xsection as endcap
cap2 = TRUE: keep last xsection as endcap
ring = TRUE: extrude between first and last xsection
void PolyExtrude3P(Polygon *xsec1, Polygon *xsec2, PolyDetail *pdp)
extrude between two polygons that reference points in pdp, add
new polys to pdp.
void PolyExtrude4(PolyDetail *pdp, int cap1, int cap2, int ring)
void PolyExtrude4N(PolyDetail *pdp, int polyPerCross,
int cap1, int cap2, int ring)
void PolyExtrude4P(Polygon *xsec1, Polygon *xsec2, PolyDetail *pdp)
As before, but use quads to extrude.
PolyDetailPointer
PolyExtrudeD(PolyDetail *pdp1, PolyDetail *pdp2,
int cap1, int cap2, int quadFlag)
Extrude between two detail structures, returning skin detail.
cap1 = TRUE: keep polys of pdp1 in result
cap2 = TRUE: keep polys of pdp2 in result
quadflag = TRUE: skin with quadrilaterals (else triangles)
PolyDetailPointer
PolyExtrudeL(PolyDetail *headPdp, int cap1, int cap2, int quadFlag)
As before, with input a single list.
Polygon Hole Routines
void PolyDeHole(PolyDetail *pdp, float dist)
PolyDetail *PolyHole(PolyDetail *orgpdp, float dist,
float angle, int snap)
Make or unmake a hole in the passed pdp. No new pdp is built.
snap = TRUE: snap points to outline plane
Polygon Clipping
int
PolyClip(Vector n, float d, PolyDetail *srcPdp,
PolyDetail *belowPdp, PolyDetail *abovePdp)
Clip plane defined by vector n and constand d is applied to srcPdp.
Clipped polygons above (+ direction of n) the plane are copied to
abovePdp, those below to belowPdp, those in the plane to both.
srcPdp is also modified to point to new polys.
static void
polyMakeConvex(PolyDetail *pdp, int maxpts)
make the polys in pdp convex, with each poly having <= maxpts
Matrix Application
void PolyMat44(Mat44 matrix, PolyDetail *source)
PolyDetailPointer PolyMat44Copy(Mat44 matrix, PolyDetail *source)
Apply the 4x4 matrix to each point in source. PolyMat44Copy
leaves the source unaltered. The new polydetail shares points
with source.
Normals
int PolyNormal(PolyDetail *pdp)
Calculate all normals for all polygons and points in pdp.
int PolyNormalP(Polygon *pdp)
Calculate normal for polygon and its points.
static void polyAreaNml(Polygon *pp, Vector *nml)
compute poly normal, scaled by area of the poly.
Debugging Routines
void PolyDump(PolyDetailPointer pdp, int level)
void PolyDumpPoint(PolyPointPointer ptp)
void PolyDumpPolygon(PolygonPointer plp)
dumps internal structures to stderr.
level one of POLYDETAIL, POLYPOINT, POLYGON, POLYVERTEX
polydump dumps entire pdp
DumpPoint and DumpPolygon dump one PolyPoint or Polygon
void PolyPrint(FILE *fp, PolyDetailPointer pdp, int level)
void PolyPrintPoint(FILE *fp, PolyPointPointer ptp)
void PolyPrintPolygon(FILE *fp, PolygonPointer plp)
as above, but to specified file
Polygon Tools
void PolyClose(RangeNode *numHead, PolyDetail *source, int flag)
Closes polys specified in numHead. If numHead is NULL, all are
closed. If flag is true then only close polys with
lastVtx->ppt==firstvxt->ppt
void PolyOpen(RangeNode *numHead, PolyDetail *source, int cflag)
Same as Close. If flag is TRUE, do not add a final vertex that
references same point as first vertex.
void PolyReverse(RangeNode *numHead, PolyDetail *pdp)
Reverse polys specified in numHead.
int PolyRenumber(PolyDetail *pdp)
Renumber points. Uses no existing numbers. Numbers have no meaning.
int PolyReorder(PolyDetail *pdp)
Reorder the points by polygon vertex.
int PolyNumPoints(PolyDetail *op)
Number the points and return the total.
int PolyNumPolys(PolyDetail *op)
Count polys, update the pdp total, and return the total.
int PolyNumVertices(PolyDetail *op)
Count vertices, update pdp poly totals and return the total.
int PolyNumVerticesP(Polygon *pp)
Count vertices and update poly total in passed poly.
void PolyNum(PolyDetail *op)
Number everything.
Polygon Extraction
void PolyExtract(RangeNode *numHead, PolyDetail *source,
PolyDetail *dest)
generate new pdp containing polys from source whose numbers are
in numHead
void PolyRemainder(RangeNode *numHead, PolyDetail *source)
generate new pdp with polys NOT in numHead
Miscellaneous Routines
void PolyCenter(PolyDetail *detail, Point *pt)
void PolyCenterP(Polygon *polygon, Point *pt)
Find the center of the passed pdp or polygon, using the average
of all points/vertices. Return result in pt.
PolyDetailPointer
PolyMerc(PolyDetail *source, float north, float south,
float east, float west)
wrap source around a unit sphere using inverse mercator projection.
Longitude and latitude are given by north, south, east, west, in
radians. Source is not altered.
int PolyPlanarPT(PolygonPointer pp, float tolerance)
Returns TRUE if polygon pp is planar within tolerance, else FALSE.
PolyPoint **PolySort(PolyDetail *pdp, int axis)
Return an array of PolyPointPointers sorted by the positional
coordinate for the specified axis (XINDEX, YINDEX or ZINDEX).
PolyDetailPointer
PolyInterp(PolyDetail *pdp1, PolyDetail *pdp2, float amount)
Interpolates position of points in 2 pdps, by amount. Will
also do color, texture, normals and poly color if flags set.
int PolyPlanarP(PolygonPointer pp)
return TRUE if passed poly is planar, else FALSE
Tookit Overview
Expression Functions |
User Functions |
Custom SOPs
Prisms Internal Format |
Programmer's Reference
Compiling SOPs |
Using sopbuild |
SOP Routine Reference
Dynamic SOPs |
Prisms Types |
Macros
Math Routines |
Data Routines |
Polygon Routines |
Winged-edge Routines
Copyright © 1997 Side Effects Software Inc.
477 Richmond Street West, Toronto, Ontario, Canada M5V 3E7