Class: Geom::Bounds2d
- Inherits:
-
Object
- Object
- Geom::Bounds2d
Overview
An axis-aligned rectangle defined by a top-left and bottom-right Geom::Point2d. In LayOut documents, the units are inches; ModraUp::View#text_bounds returns the bounds in viewport pixels.
Class Method Summary # collapse
-
.new ⇒ Geom::Bounds2d
Constructs a 2D bounding box. An empty box (zero point, zero size) is created with no parameters. float_array is [x, y, width, height]; point_array is an array of two points.
Instance Method Summary # collapse
-
#set!(other) ⇒ Geom::Bounds2d
Change in place to be the same box as the parameter. The parameter is the same as in #initialize.
-
#upper_left ⇒ Geom::Point2d
Upper left corner.
-
#lower_right ⇒ Geom::Point2d
Lower right corner.
-
#width ⇒ Float
Width (right-bottom X minus left-top X).
-
#height ⇒ Float
Height (right-bottom Y minus left-top Y).
-
#to_a(Geom::Point2d, Geom::Point2d) ⇒ Array<Geom::Point2d>
[upper_left, lower_right]。
-
#== ⇒ Boolean
Returns true if the two edges are equal within the length tolerance.
Class Method Details
Bounds2d.new ⇒ boundsBounds2d.new(other) ⇒ boundsBounds2d.new(upper_left, lower_right) ⇒ boundsBounds2d.new(x, y, width, height) ⇒ boundsBounds2d.new(point_array) ⇒ boundsBounds2d.new(float_array) ⇒ bounds
Constructs a 2D bounding box. An empty box (zero point, zero size) is created with no parameters. float_array is [x, y, width, height]; point_array is an array of two points.
Instance Method Details
bounds.set!(other) ⇒ selfbounds.set!(upper_left, lower_right) ⇒ selfbounds.set!(x, y, width, height) ⇒ selfbounds.set!(point_array) ⇒ selfbounds.set!(float_array) ⇒ self
Change in place to be the same box as the parameter. The parameter is the same as in #initialize.
bounds.upper_left ⇒ Geom::Point2d
Upper left corner.
bounds.lower_right ⇒ Geom::Point2d
Lower right corner.
bounds.width ⇒ Float
Width (right-bottom X minus left-top X).
bounds.height ⇒ Float
Height (right-bottom Y minus left-top Y).
bounds.to_a ⇒ Array(Geom::Point2d, Geom::Point2d)
[upper_left, lower_right]。
bounds == other ⇒ Boolean
Returns true if the two edges are equal within the length tolerance.