# SBoundary PT¶

SBoundary implements boundaries for use in scene graph This defines the outer extent of the scene, or of an element in the scene, or of some branch in the scene. The difference between this boundary and an n-dimensional surface, such as IFS, is that boundary must always have a well defined inside and an outside. SBoundary does not necessarily follow the exact outer contours of the shape but just constructs a simple boundary shape where all points of the shape are guaranteed to be inside the boundary. Currently there are the following boundary forms: Simple types: “box”::Symbol which is a n-dimensional axis-aligned rectangle. “ellipoid”::Symbol which is a n-dimensional axis-aligned ellipse. Compound types: This is a combination of simple and other compound types such as union or intersection. “union”::Symbol represents union of supplied list “intersection”::Symbol represents intersection of supplied list Null types: “none” is used for a node which does not have a boundary in space, for example, when the boundary of a material node is requested. The uses of SBoundary are: 1) So we know how much to scale a given scene to fit in a given size. 2) So that we know where to terminate arrows going in out out of of the shape. 3) To detect if objects intersect (collision detect), or if one object is contained completely inside another.

boxBoundary: (PT, PT) -> %
boxBoundary(c1, c2) constructs a box boundary (n-dimensional axis-aligned rectangle) with given parameters c1: PT holds minimum coordinates c2: PT holds maximum coordinates
coerce: % -> OutputForm
coerce(bd) outputs description of bd as formatted text
containsPoint?: (%, PT) -> Boolean
containsPoint?(n, p) returns true if the point is inside the boundary. n is the boundary p is the point
ellipseBoundary: (PT, PT) -> %
ellipseBoundary(c1, c2) constructs an ellipse boundary n-dimensional axis-aligned ellipoid with given parameters c1: PT holds centre point c2: PT holds extent (radius for each coordinate)
extendToPoint: (%, PT) -> %
extendToPoint(n, p) creates a boundary that is the union of a boundary and a point. n is the boundary p is the point
getCentre: % -> PT
getCentre(n) returns centre coordinate of the boundary. n: % is the boundary
getMax: % -> PT
getMax(n) returns maximum coordinate of the boundary. n is the boundary
getMin: % -> PT
getMin(n) returns minimum coordinate of the boundary. n is the boundary
intersection: List % -> %
intersection(x) constructs a compound boundary from the intersection of x x: List % is supplied list of boundaries to form intersection.
isBox?: % -> Boolean
isBox?(n) returns true if this is a rectangular boundary.
isEllipse?: % -> Boolean
isEllipse?(n) returns true if this is a ellipsoid boundary.
isNull?: % -> Boolean
isNull?(n) returns true if this is a null boundary, that is no boundary
lineIntersect: (%, PT) -> PT
lineIntersect(n, p) returns the point where a line, from the centre of the boundary to the point p, intersects with the boundary. n: % is the boundary p: PT is the point at the end of the line (outside boundary)
link: (%, %) -> List PT
link(m, n) returns a line which is the shortest distance between the two boundaries. The line is represented by its two endpoints. m: % is the first boundary to be linked n: % is the second boundary to be linked
nullBoundary: () -> %
nullBoundary() constructs a null boundary, for example, when the boundary of a material node is requested.
sunion: (%, %) -> %
sunion(x, y) gives the union of two boundaries as a box, that is it gives a box that is external to both. x: % is first boundary to be combined y: % is second boundary to be combined
union: List % -> %
union(x) constructs a compound boundary from the union of x x: List % is supplied list of boundaries to form union