Class: Geom::BoundingBox
Overview
The bounding box returned for Face Me components is the center of its entire range of motion. This behavior changed in SketchUp 7.1. In 7.0 and earlier, the Sketchup::Drawingelement.#bounds method would return the bounds around the Face Me component's current, visible center.
Bounding boxes are three-dimensional boxes (eight corners), aligned with the global axes, that surround entities within your model. There is a default bounding box for any new model that will surround all entities, including all groups and components. Additionally, there are bounding boxes for Sketchup::Drawingelement objects, including components and groups. Bounding boxes are only large enough to exactly bound the entities within your model, group, or component.
You can also create arbitrary BoundingBox objects by calling BoundingBox.new.
Instance Method Summary collapse
-
#add(*args) ⇒ Geom::BoundingBox
Add a point, vertex, or other bounding boxes to the bounding box.
-
#center ⇒ Geom::Point3d
Get the center point of the bounding box.
-
#clear ⇒ Geom::BoundingBox
Remove all points from the bounding box.
-
#contains?(thing) ⇒ Boolean
Determine if the current bounding box contains a specific Point3d or BoundingBox object.
-
#corner(n) ⇒ Geom::Point3d
Get point at specified corner of the bounding box.
-
#depth ⇒ Length
Get the depth of the bounding box.
-
#diagonal ⇒ Length
Get the length of the diagonal of the bounding box.
-
#empty? ⇒ Boolean
Determine if the bounding box is empty, such as if the bounds have not been set.
-
#height ⇒ Length
Get the height of the bounding box.
-
#initialize ⇒ BoundingBox
constructor
Create a new, empty, bounding box.
-
#intersect(other_bounding_box) ⇒ Geom::BoundingBox
Intersect this bounding box with another bounding box.
-
#max ⇒ Geom::Point3d
Get the maximum point in the bounding box.
-
#min ⇒ Geom::Point3d
Get the minimum point in the bounding box.
-
#valid? ⇒ Boolean
Determine if the bounding box is valid (contains points).
-
#width ⇒ Length
Get the width of the bounding box.
Constructor Details
#initialize ⇒ BoundingBox
Create a new, empty, bounding box.
40 41 |
# File 'lib/boundingbox.rb', line 40 def initialize end |
Instance Method Details
#add(*args) ⇒ Geom::BoundingBox
Add a point, vertex, or other bounding boxes to the bounding box. The size of the bounding box will increase as necessary to accommodate the new items.
Adding one point to an empty bounding box does not increase the size of the bounding box. You must add at least two points before methods such as BoundingBox.#diagonal will return a size greater than zero.
63 64 |
# File 'lib/boundingbox.rb', line 63 def add(*args) end |
#center ⇒ Geom::Point3d
Get the center point of the bounding box.
75 76 |
# File 'lib/boundingbox.rb', line 75 def center end |
#clear ⇒ Geom::BoundingBox
Remove all points from the bounding box. A cleared BoundingBox does not have an points; therefore, the size is zero.
94 95 |
# File 'lib/boundingbox.rb', line 94 def clear end |
#contains?(thing) ⇒ Boolean
Determine if the current bounding box contains a specific Point3d or Geom::BoundingBox object.
112 113 |
# File 'lib/boundingbox.rb', line 112 def contains?(thing) end |
#corner(n) ⇒ Geom::Point3d
Get point at specified corner of the bounding box.
There are 8 corners to a bounding box, identified by the numbers 0..7. Points are returned in the currently set units (inches by default).
These are which index refers to which corner: 0 = 0, 0, 0 1 = 1, 0, 0 2 = 0, 1, 0 3 = 1, 1, 0 4 = 0, 0, 1 5 = 1, 0, 1 6 = 0, 1, 1 7 = 1, 1, 1
141 142 |
# File 'lib/boundingbox.rb', line 141 def corner(n) end |
#depth ⇒ Length
Get the depth of the bounding box.
The depth is returned in the currently set units (inches by default).
155 156 |
# File 'lib/boundingbox.rb', line 155 def depth end |
#diagonal ⇒ Length
Get the length of the diagonal of the bounding box.
The diagonal is returned in the currently set units (inches by default).
169 170 |
# File 'lib/boundingbox.rb', line 169 def diagonal end |
#empty? ⇒ Boolean
Determine if the bounding box is empty, such as if the bounds have not been set. This is the opposite of the #valid? method.
182 183 |
# File 'lib/boundingbox.rb', line 182 def empty? end |
#height ⇒ Length
Get the height of the bounding box.
The height is returned in the currently set units (inches, by default).
196 197 |
# File 'lib/boundingbox.rb', line 196 def height end |
#intersect(other_bounding_box) ⇒ Geom::BoundingBox
Prior to SU2015 this method would return incorrect result in some cases. For correct result in these versions you must first check if the bounding boxes actually overlap - then call this to get the resulting bounding box.
Intersect this bounding box with another bounding box. This method returns a new bounding box object rather than modifying the current one.
219 220 |
# File 'lib/boundingbox.rb', line 219 def intersect(other_bounding_box) end |
#max ⇒ Geom::Point3d
If you attempt to call this method on an empty bounding box, you will receive a point consisting of very large negative numbers.
Get the maximum point in the bounding box.
235 236 |
# File 'lib/boundingbox.rb', line 235 def max end |
#min ⇒ Geom::Point3d
If you attempt to call this method on an empty bounding box, you will receive a point consisting of very large negative numbers.
Get the minimum point in the bounding box.
251 252 |
# File 'lib/boundingbox.rb', line 251 def min end |
#valid? ⇒ Boolean
Determine if the bounding box is valid (contains points). This method is the opposite of the #empty? method.
264 265 |
# File 'lib/boundingbox.rb', line 264 def valid? end |
#width ⇒ Length
Get the width of the bounding box.
The width is returned in the currently set units (inches by default).
278 279 |
# File 'lib/boundingbox.rb', line 278 def width end |