opensolid/geometry/3.0.1

NOTE: this package is not compatible with Elm 0.19.1

BoundingBox3d

BoundingBox3d

A BoundingBox3d is a rectangular box in 3D defined by its minimum and maximum X, Y and Z values. It is possible to generate bounding boxes for most geometric objects; for example, Triangle3d.boundingBox takes a Triangle3d and returns a BoundingBox3d that contains that triangle. There are several use cases where it is more efficient to deal with the bounding box of an object than the object itself, such as:

  • Intersection checking: If (for example) the bounding boxes of a line segment and a triangle do not overlap, then the line segment and triangle cannot possibly intersect each other. Expensive intersection checking therefore only has to be performed for line segments and triangles whose bounding boxes do overlap.
  • 3D rendering: When rendering a 3D scene, any object whose bounding box is not visible must itself be not visible, and therefore does not have to be drawn. This provides a simple form of culling.
type alias BoundingBox3d =
BoundingBox3d

Constructors

{ minX : Float
, maxX : Float
, minY : Float
, maxY : Float
, minZ : Float
, maxZ : Float
}
-> BoundingBox3d
singleton : Point3d -> BoundingBox3d
from : Point3d -> Point3d -> BoundingBox3d
hull : BoundingBox3d -> BoundingBox3d -> BoundingBox3d
intersection : BoundingBox3d -> BoundingBox3d -> Maybe BoundingBox3d
aggregate : List BoundingBox3d -> Maybe BoundingBox3d
containingPoints : List Point3d -> Maybe BoundingBox3d

Properties

BoundingBox3d
-> { minX : Float
, maxX : Float
, minY : Float
, maxY : Float
, minZ : Float
, maxZ : Float
}
minX : BoundingBox3d -> Float
maxX : BoundingBox3d -> Float
minY : BoundingBox3d -> Float
maxY : BoundingBox3d -> Float
minZ : BoundingBox3d -> Float
maxZ : BoundingBox3d -> Float
dimensions : BoundingBox3d -> ( Float, Float, Float )
midX : BoundingBox3d -> Float
midY : BoundingBox3d -> Float
midZ : BoundingBox3d -> Float
centroid : BoundingBox3d -> Point3d

Queries

contains : Point3d -> BoundingBox3d -> Bool
isContainedIn : BoundingBox3d -> BoundingBox3d -> Bool
intersects : BoundingBox3d -> BoundingBox3d -> Bool
overlappingBy : Order -> Float -> BoundingBox3d -> BoundingBox3d -> Bool
separatedBy : Order -> Float -> BoundingBox3d -> BoundingBox3d -> Bool

Transformations

scaleAbout : Point3d -> Float -> BoundingBox3d -> BoundingBox3d
translateBy : Vector3d -> BoundingBox3d -> BoundingBox3d
translateIn : Direction3d -> Float -> BoundingBox3d -> BoundingBox3d