Class: Geom::BoundingBox
- Inherits:
-
Object
- Object
- Geom::BoundingBox
Overview
Axis-aligned bounding box. Obtained from drawing elements such as ModraUp::Face#bounds.
Constants # collapse
- Geom::BoundingBox::CORNER_LEFT_FRONT_BOTTOM
CORNER_LEFT_FRONT_BOTTOM = 0
#corner left front bottom.
- Geom::BoundingBox::CORNER_RIGHT_FRONT_BOTTOM
CORNER_RIGHT_FRONT_BOTTOM = 1
#corner right front bottom.
- Geom::BoundingBox::CORNER_LEFT_BACK_BOTTOM
CORNER_LEFT_BACK_BOTTOM = 2
#corner left back bottom.
- Geom::BoundingBox::CORNER_RIGHT_BACK_BOTTOM
CORNER_RIGHT_BACK_BOTTOM = 3
#corner The right back bottom corner.
- Geom::BoundingBox::CORNER_LEFT_FRONT_TOP
CORNER_LEFT_FRONT_TOP = 4
#corner left front top.
- Geom::BoundingBox::CORNER_RIGHT_FRONT_TOP
CORNER_RIGHT_FRONT_TOP = 5
#corner right front top.
- Geom::BoundingBox::CORNER_LEFT_BACK_TOP
CORNER_LEFT_BACK_TOP = 6
#corner left back top.
- Geom::BoundingBox::CORNER_RIGHT_BACK_TOP
CORNER_RIGHT_BACK_TOP = 7
#corner The right back top corner.
Class Method Summary # collapse
-
.new ⇒ Geom::BoundingBox
An empty bounding box. Use #add to join points.
Instance Method Summary # collapse
-
#add(point, ...) ⇒ Geom::BoundingBox
Merge a point, array of points, vertices, or another bounding box into it.
-
#min ⇒ Geom::Point3d
Minimum corner point.
-
#max ⇒ Geom::Point3d
Maximum corner point.
-
#center ⇒ Geom::Point3d
Center point.
-
#clear ⇒ Geom::BoundingBox
Clear the bounding box, making #empty? return true.
-
#contains?(point) ⇒ Boolean
Does a point or another bounding box completely fall within this box.
-
#corner(index) ⇒ Geom::Point3d
One of the eight corner points. index ranges from 0..7, or can be a constant like CORNER_LEFT_FRONT_BOTTOM.
-
#width ⇒ Length
X-direction dimension, returns Length.
-
#height ⇒ Length
The height in the Y direction (along the green axis), returns Length.
-
#depth ⇒ Length
Depth in the Z direction (along the blue axis), returns Length.
-
#diagonal ⇒ Length
The length of the space diagonal, returns Length.
-
#empty? ⇒ Boolean
If no points have been added, it returns true. Opposite of #valid?.
-
#valid? ⇒ Boolean
Returns true if it contains at least one point.
-
#intersect(other) ⇒ Geom::BoundingBox
Intersection with another bounding box. Returns an empty box if they do not intersect.
Class Method Details
BoundingBox.new ⇒ bounds
An empty bounding box. Use #add to join points.
Instance Method Details
bounds.add(point, ...) ⇒ selfbounds.add(points) ⇒ selfbounds.add(other_bounds) ⇒ self
Merge a point, array of points, vertices, or another bounding box into it.
bounds.min ⇒ Geom::Point3d
Minimum corner point.
bounds.max ⇒ Geom::Point3d
Maximum corner point.
bounds.center ⇒ Geom::Point3d
Center point.
bounds.clear ⇒ self
Clear the bounding box, making #empty? return true.
bounds.contains?(point) ⇒ Booleanbounds.contains?(other_bounds) ⇒ Boolean
Does a point or another bounding box completely fall within this box.
bounds.corner(index) ⇒ Geom::Point3d
One of the eight corner points. index ranges from 0..7, or can be a constant like CORNER_LEFT_FRONT_BOTTOM.
bounds.width ⇒ Length
X-direction dimension, returns Length.
bounds.height ⇒ Length
The height in the Y direction (along the green axis), returns Length.
bounds.depth ⇒ Length
Depth in the Z direction (along the blue axis), returns Length.
bounds.diagonal ⇒ Length
The length of the space diagonal, returns Length.
bounds.empty? ⇒ Boolean
If no points have been added, it returns true. Opposite of #valid?.
bounds.valid? ⇒ Boolean
Returns true if it contains at least one point.
bounds.intersect(other) ⇒ Geom::BoundingBox
Intersection with another bounding box. Returns an empty box if they do not intersect.