(****************************************************************************** ** GeometryFromPrims.sml ** sml ** ** Franklin Chen and Guy Blelloch ** Generates a GEOMETRY given a set of GEOMETRY_PRIMS ******************************************************************************) functor GeometryFromPrims (structure GP : GEOMETRY_PRIMS) :> GEOMETRY where Number = GP.Number = struct exception NYI structure Number = GP.Number structure Side : SIDE = Side exception BadDimension structure Vec = GP.Vec structure Point = PointFromVec(structure Vec = Vec) structure Box = BoxFromGeometryPrims(structure GP = GP structure Point = Point) structure HalfSpace = struct exception DegenerateInput structure Point = Point structure Vec = Vec structure Number = Number (* This stores the normal vector and offset of the plane from the origin along that normal vector *) type halfSpace = GP.plane type t = halfSpace val normal = GP.planeNormal val fromPoints = GP.planeFromPoints val fromNormal = GP.planeFromNormal val pointDist = GP.planeDistance val pointIn = GP.planeSide val invert = GP.planeInvert val == = GP.planeEqual fun !=(p1,p2) = not(GP.planeEqual(p1,p2)) val toString = GP.planeToString end structure Sphere = struct structure Point = Point structure Number = Number structure Vec = Vec type sphere = GP.sphere type t = sphere fun ==(s1,s2) = raise NYI fun !=(s1,s2) = not(==(s1,s2)) fun toString(s) = raise NYI fun translate(s) = raise NYI val pointIn = GP.sphereSide val fromPoints = GP.sphereFromPoints fun fromCenter(_) = raise NYI fun center s = raise NYI fun radius s = raise NYI end end