-- File: SVComponents.doc
-- Last Edited by: Bier, December 17, 1982 3:09 pm
-- Author: Eric Bier on December 22, 1982 2:54 am
-- Contents: A description of solidviews modules for its future maintainers.

The file MakeSolidViews.cm will always contain a complete listing of Solidviews components in a working compilation order. That listing divides the components roughly into three classifications: Utilities (first paragraph), Core Modules (next 3), and User Interface (next 2).

This document categorizes the parts as Mathematical Utilities, Solidviews Utilities, Drawing, Ray Tracing, Text Files, Display Lists, and User Interface.

Mathematical Utilities

SV2d defines basic two dimensional types such as polygon, path, line segment, and trigonometric line segment. SV2d has no implementation module.

Algebra3d. (rename SVAlgebra and put earlier in MakeSolidviews.cm) Quadratic formula. That's all. There may be a way to make the quadratic formula part of Cedar in which case Algebra3d can go away.

SVAngle defines basic operations on angles, differentiating between a position angle and a differential angle. Position angles in Solidviews are in degrees where -180 < theta <= 180. I have come to the conclusion that using degrees was a mistake. Only good for the user interface.

SVVector2d. 2d Vectors. Dot Product, Magnitude, rotate by theta degrees, etc.

SVVector3d. 3d Vectors. Cross Product, Magnitude, Scale, Parallel? Project onto xy plane, etc.

SVMatrix2d. Homogeneous 3 by 3 matrices for 2d graphics. Identity, Scale, Translate, RotateCCW, MatMult, Cofactor, Determinant, Inverse, etc.

Matrix3d. One of the exportable interfaces (See Display Lists below). Homogeneous 4 by 4 matrices for 3d graphics. Identity, Update a point, UpdateVector, GetPerspective, Scale, Translate, RotateAboutXAxis, MatMult, InverseNoScaling, Cofactor, Determinant, Transpose, Inverse, Normalize, etc.

SVPolygon2d. Routines for manipulating ordered sequences of 2d points (much used by the scratchpad). AddPolyPoint, CopyPoly, IsClockwisePoly?, InvertPolyInPlace, PathToPolygon, InsertPathPoint, SplicePathPoint, and a point in polygon test (BoysePointInPoly-- much used in ray tracing linear sweeps).

SVPolygon3d. Like SVPolygon2d. Sequences of 3d points (assumed to be coplanar). Includes PlaneFromPoly3d, PlaneFromPointAndNormal, SignedPointToPlaneDistance, PointOnNormalSideOfPlane?, ProjectPolyToXYPlane, etc.

SVLines2d. Line intersections. Distance from line. Distance from endpoint. Most of this operations use a rich (and relatively slow) data structure to represent lines (ie using the ycos(theta) - xsin(theta) - d = 0 form of the line equation, where theta is a position angle as defined in SVAngle.

Solidviews Utilities

BitMap3d. Creates an alternate display context which writes onto a bitmap (for double buffering). Routines are: GetAltDisplayContext, ResizeBitMap, DrawAltDisplayContext, Erase

Shading
. The lighting model. DiffuseReflectance and DiffuseAndSpecularReflectance.

SVCoordSys2d. Uses the tools of SVMatrix2d to implement to position and reposition CoordSystem2ds with respect to each other. FindAinTermsOfB, FindTranslationOfAinTermsOfB, PutAinTermsOfB, TranslateAwrtB, RotateCCWAwrtB, AlignAwrtB, AbutAwrtB, etc.

CoordSysImpl. Uses the tools of Matrix3d to position and reposition CoordSystems with respect to each other. FindAinTermsOfB, FindTranslationOfAinTermsOfB, TPutAinTermsOfB, TTranslateAwrtB, TXRotateAwrtB, TYRotateAwrtB, TZRotateAwrtB, TAlignAwrtB, TAbutAwrtB, etc. Procedures marked with a 'T' are not for genral consumption. The new method of updated coordinate systems relies on walking the display list (assembly tree). (For instance scaling operations walk to the leaves and scale them exclusively). Use procedures in SVTransforms.

SVArtworkImpl. Defines artwork (surface texture patterns) and defines artwork to simple surface mappings, simple surface to artwork mappings and routines for opening and drawing artworks.

PadGraphicsImpl. MoveTo, LineTo, DrawSquare, Draw2dVector for two dimensional edittors. Most of its procedures take an origin, and scalar as arguments (this should be converted to a CoordSystem2d). The LineTo MoveTo procedures use origin and scalar to convert from PAD coordinates to screen coordinates (where origin is the center of PAD with respect to screen).

CSGGraphicsImpl. (should be renamed to SVGraphicsImpl) MoveTo, LineTo, DrawTo for 3d. They take three dimensional points in a local coordinate system, the local coordinate system, and a camera, convert the points to camera coordinates, perform perspective transformation and draw. CSGGraphics defines Camera and procedures for altering cameras.

SVMappingsImpl. Procedures to deal with artwork to surface mappings. Most of these procedures have never been implemented. The useful ones are: CartesianToPolar, PolarToCartesian, CreateTube, CreateBox, TubeToImage, BoxToImage, SurfacePolyToImagePoly

SVBoundBoxImpl. BoundBoxes are used for ray tracing and may soon be used for selection feedback. SVBoundBoxImpl provides simple routines for finding a bounding box given a set of points on a bounding polyhedron. The BoundBox Type is the same as found in Roth's paper on Ray Tracing.

SVFacesImpl. Procedures for breaking up linear and revolute sweeps into faces for ray tracing purposes. (Used by SweepCastImpl)

CSGimpl. Definitions for Rays and Classifications. Procs for combining bound boxes by union, intersection and difference operators.

SVFiles. Creates the abstraction that reading and writing scenes is a simple matter of opening and closing files. OpenScene, SaveScene, StoreScene, FileExists, OpenFile, FilenameMinusExtension. That's all.

SVImage. Implements type Image. Opening an Image involves opening four AIS files. Wrting to an image writes to all four ais files. Used by ray tracing.

Display Lists

DisplayList3d. The main interface of Solidviews. Procedures for building and modifying the scene tree and drawing it onto a display context.

SVDisplayListFiling. Contains just the procedure AddSubassemblyToAssemblyWithCS which would be part of DisplayList3d only it is not intended for general consumption. It is used by Filein3d.

SVTransforms. The prescribed method for rotating, scaling, and translating parts of a scene.

Drawing

SVDraw. Three simple drawing routines built directly on top of Graphics.

Draw3d. Drawing routines for commonly used 3d shapes. DrawCoordSys, DrawVector, DrawLocalVector, Draw2dCoordSys, DrawX, and DrawBoundBoxes

Master Object Classes

SweepGeometry. Creates a representation for linear and revolute sweep shapes used to complete the definition of these master object classes given in BasicObject3d. Draws wire frames and shaped approximations given a representation.

PredefSweeps. Routines for creating an instance of the master object classes Sphere, Cube, Cylinder, Cone, and Torus. GetUnitSphere, GetUnitCube, GetUnitCylinder, GetUnitCone, CreateTorus, CreateTorus

Ray Tracing

SVPrimitive. One procedure: FromAssembly. When a ray tracing tree (CSGTree) is being made from a DisplayList3d.Scene, each primitive assembly in the scene is converted to a CSG.Primitive. This procedure does the part of the conversion which is independent of the class of the assmbly's master object. BasicObject3d does the other part.

CastRays. Contains SingleRay, SingleRay2, and DrawTree. This interface manages the global object-class-independent part of ray tracing and calls the object dependent procedures.

ObjectCast. BlockCast, SphereCast, CylinderCast, ConeCast and ToroidCast (not implemented). Finds the intersection of a ray with these types of surfaces.

SVFacesCast. Finds the intersection of a ray with the component parts of sweep shapes -- ede on rectangles, conical frustra, cylinders, and disks.

SweepCast. Uses SVFacesCast. Puts the results together and returns a complete list of the interaction of the ray with the Sweep shape. Chief procedures are LinCast and RevoCast.

Preprocess3d. Preprocess is the only significant procedure. Opens all of the artworks in a CSG Tree and calculates all the bounding boxes given the current viewing angle. Always preprocess a CSG tree before casting rays at it.

Text Files

TFO3d. A utility which knows how to describe various solidviews types in text (Rope.ROPE) form and write them onto an IO.STREAM.

TFI3d. Knows how to read ropes off of an IO.STREAM and convert them into Solidviews types.

Fileout3d. Uses TFO3d to create a text description of a DisplayList3d.Scene.

Filein3d. Uses TFI3d to read a text description of a 3d scene from an IO.STREAM and create a DisplayList3d.Scene.

User Interface

SVViewerTools. A utility for reading a writing the contents of a text viewer. Routines are: GetReal, GetBool, GetColor, GetThreeReals, SetReal, SetBool, SetColor, and SetThreeReals.