ShapeTwiddle.mesa
Last Edited by: Crow, September 30, 1987 6:43:45 pm PDT
DIRECTORY Rope, G3dRender;
ShapeTwiddle: CEDAR DEFINITIONS
~ BEGIN
Types
Context:    TYPE ~ G3dRender.Context;
Shape:    TYPE ~ G3dRender.Shape;
NatPair:    TYPE ~ RECORD [x, y: NAT];
Shape Manipulations
ScaleShape: PROCEDURE [context: Context, name: Rope.ROPE,
        scale, xRatio, yRatio, zRatio: REAL ← 1.0,
        applyXfm: BOOLEANFALSE];
Scale vertices, global scale is scaled by ratio for each axis. Transform vertices to current
position before scaling. New vertices will be the transformed and scaled result. Position transform is reset to identity.
ScaleTexture: PROCEDURE [ context: Context, name: Rope.ROPE,
   scale, xRatio, yRatio, zRatio: REAL ← 1.0];
Scales texture coordinates of vertices. xRatio, etc. can be used to set scale assymetrically.
eg. texture.x ← texture.x * scale * xRatio.
Accumulated scale factor is stored on shape shadingProps list ($TextureScale).
CleanUp: PROC [context: Context, name: Rope.ROPE,
 deSeam: BOOLEANFALSE, tolerance: REAL ← 0.0];
Throw out unused vertices. If deseaming, then coalesce vertices no more than "tolerance" apart. If deseaming polygons, eliminate redundant vertex pointers.
CopyShape: PROC [context: Context, dstName, srcName: Rope.ROPE]
RETURNS[Shape];
Copy shape so that the copy may be abused by the other routines herein whil maintaining the original intact.
Combine: PROC [context: Context, dstName, src1, src2: Rope.ROPE]
RETURNS[Shape];
Combine two objects, producing a new object with all the vertices and patches of both.
DeletePatches: PROC [context: Context, dstName, srcName: Rope.ROPE,
  patchList: LIST OF NatPair]
RETURNS[Shape];
Produce a new object without the listed intervals of patches. Good for disassembling objects. Use "CleanUp" afterwards, since all vertices are copied to the new object.
Bounds: PROC [context: Context, name: Rope.ROPE]
RETURNS
[xMin, xMax, yMin, yMax, zMin, zMax: REAL];
Find the bounding box of the vertices after applying the position transform.
Procedures for expansion of/to polygons
ShapeExpand: PROC[ context: Context, name: Rope.ROPE,
       limitType: ATOMNIL, limit: REAL ← 0.0]
     RETURNS [Shape];
Expands a whole shape, calling procedures supplied by the surface type
ShapeSubdivide: PROC[ context: Context, name: Rope.ROPE,
        limitType: ATOMNIL, limit: REAL ← 0.0]
     RETURNS [Shape];
Subdivide a whole shape once, calling procedures supplied by the surface type
END.