Class: Geom::Point2d
- Inherits:
-
Object
- Object
- Geom::Point2d
Overview
Two-dimensional point. The corners of ModraUp::View#text_bounds are instances of this class. In LayOut, coordinates are in inches; viewport text boxes are in screen pixels.
offset/ vector_to/ transform/ require Geom::Vector2d and Geom::Transformation2d, not included.
Class Method Summary # collapse
-
.new ⇒ Geom::Point2d
Construct a 2D point. No arguments construct the origin point. Naked numbers are interpreted as inches; also accepts Length.
Instance Method Summary # collapse
-
#x ⇒ Length
X coordinate.
-
#y ⇒ Length
Y coordinate.
-
#x= ⇒ Numeric, Length
Set the X coordinate.
-
#y= ⇒ Numeric, Length
Set the Y coordinate.
-
#[] ⇒ Length
0 is the X coordinate, and 1 is the Y coordinate.
-
#[]= ⇒ Numeric, Length
Write by component.
-
#clone ⇒ Geom::Point2d
Duplicates a point with the same coordinates.
-
#set!(x, y) ⇒ Geom::Point2d
Sets the coordinates in place.
-
#to_a(Numeric, Numeric) ⇒ Array<Numeric>
[x, y]。
-
#to_s ⇒ String
Readable string representation.
-
#inspect ⇒ String
Debug string.
-
#== ⇒ Boolean
Compares within length tolerance. other can be a Geom::Point2d or [x, y].
-
#distance(other) ⇒ Numeric
Distance to another point.
Class Method Details
Point2d.new ⇒ pointPoint2d.new(x, y) ⇒ pointPoint2d.new(point) ⇒ point
Construct a 2D point. No arguments construct the origin point. Naked numbers are interpreted as inches; also accepts Length.
Instance Method Details
point.x ⇒ Length
X coordinate.
point.y ⇒ Length
Y coordinate.
point.x = value ⇒ value
Set the X coordinate.
point.y = value ⇒ value
Set the Y coordinate.
point[index] ⇒ Length
0 is the X coordinate, and 1 is the Y coordinate.
point[index] = value ⇒ value
Write by component.
point.clone ⇒ Geom::Point2d
Duplicates a point with the same coordinates.
point.set!(x, y) ⇒ selfpoint.set!(point) ⇒ self
Sets the coordinates in place.
point.to_a ⇒ Array(Numeric, Numeric)
[x, y]。
point.to_s ⇒ String
Readable string representation.
point.inspect ⇒ String
Debug string.
point == other ⇒ Boolean
Compares within length tolerance. other can be a Geom::Point2d or [x, y].
point.distance(other) ⇒ Numeric
Distance to another point.