SBoundary PT¶
scene.spad line 3322 [edit on github]
PT: SPointCategory
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 parametersc1:PTholds minimum coordinatesc2:PTholds maximum coordinates
- coerce: % -> OutputForm
coerce(bd)outputs description ofbdas formatted text
- containsPoint?: (%, PT) -> Boolean
containsPoint?(n, p)returnstrueif the point is inside the boundary.nis the boundarypis the point
- ellipseBoundary: (PT, PT) -> %
ellipseBoundary(c1, c2)constructs an ellipse boundaryn-dimensional axis-aligned ellipoid with given parametersc1:PTholds centre pointc2:PTholds extent (radius for each coordinate)
- extendToPoint: (%, PT) -> %
extendToPoint(n, p)creates a boundary that is the union of a boundary and a point.nis the boundarypis 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.nis the boundary
- getMin: % -> PT
getMin(n)returns minimum coordinate of the boundary.nis the boundary
- intersection: List % -> %
intersection(x)constructs a compound boundary from the intersection ofxx:List % is supplied list of boundaries to form intersection.
- isBox?: % -> Boolean
isBox?(n)returnstrueif this is a rectangular boundary.
- isEllipse?: % -> Boolean
isEllipse?(n)returnstrueif this is a ellipsoid boundary.
- isNull?: % -> Boolean
isNull?(n)returnstrueif 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 pointp, intersects with the boundary.n:% is the boundaryp:PTis 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 linkedn:% 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 combinedy:% is second boundary to be combined
- union: List % -> %
union(x)constructs a compound boundary from the union ofxx:List % is supplied list of boundaries to form union