Class: Geom::Point3d
- Inherits:
-
Object
- Object
- Geom::Point3d
Overview
A point in three-dimensional space. Coordinates are stored in inches, so a bare 1 and 25.4.mm both represent one inch. As in SketchUp, Geom::Point3d#x, Geom::Point3d#y, Geom::Point3d#z, Geom::Point3d#[], and Geom::Point3d#distance return a Length.
Class Method Summary # collapse
-
.new ⇒ Geom::Point3d
Constructs a point. With no arguments, it is the origin; with two components, Z is 0. Numeric literals are in inches; also accept Length (e.g., 1.mm).
-
.linear_combination(weight1, point1, weight2, point2) ⇒ Geom::Point3d
Weighted sum of two points: weight1 * point1 weight2 * point2+.
Instance Method Summary # collapse
-
#x ⇒ Length
X coordinate, in internal inches Length. pt.x.to_mm gets the Float in millimeters; 1000.mm stored and read back is still 1000 mm.
-
#y ⇒ Length
Y coordinate, in internal inches Length.
-
#z ⇒ Length
Z coordinate, in internal inches Length.
-
#x= ⇒ Numeric, Length
Set the X coordinate.
-
#y= ⇒ Numeric, Length
Set the Y coordinate.
-
#z= ⇒ Numeric, Length
Set the Z coordinate.
-
#to_a(Float, Float, Float) ⇒ Array<Float>
Convert to [x, y, z], where x, y, and z are float values in inches, unaffected by display units and precision.
-
#to_s ⇒ String
(x, y, z).
-
#distance(other) ⇒ Length
Returns the Euclidean distance to another point, returning Length. other can be a point or [x, y, z].
-
#offset(vector) ⇒ Geom::Point3d
Offset the point along a vector, returning a new point. For a positive length, offset the point by that length in the direction of the vector.
-
#- ⇒ Geom::Vector3d, Geom::Point3d
Subtract another point to get a vector, or subtract a vector to get a new point.
-
#== ⇒ Boolean
Compare coordinates with another point or [x, y, z].
-
#transform(transformation) ⇒ Geom::Point3d
Apply a transformation to a point and return the new point. Accepts values convertible to Transformation, where Vector3d is treated as a translation.
-
#transform!(transformation) ⇒ Geom::Point3d
Applies a transformation in place to the point. The transformation rules are the same as for #transform.
-
#+ ⇒ Geom::Point3d
Add a vector to a Point3d, returning a new point.
-
#< ⇒ Boolean
Compare in dictionary order by X, Y, Z.
-
#[] ⇒ Length
Retrieve coordinates by index: 0 is X, 1 is Y, 2 is Z. Returns Length.
-
#[]= ⇒ Numeric, Length
Set coordinates by index.
-
#clone ⇒ Geom::Point3d
Duplicates the point.
-
#inspect ⇒ String
Debug string.
-
#offset!(vector) ⇒ Geom::Point3d
Translates along the vector in place.
-
#vector_to(other) ⇒ Geom::Vector3d
Returns a vector from this point to another point.
-
#distance_to_line(line) ⇒ Float
Distance to an infinite line. The line is defined as either [point, vector] or [point, point].
-
#distance_to_plane(plane) ⇒ Float
Distance to the plane. The plane is given as either [point, normal] or [A, B, C, D].
-
#on_line?(line) ⇒ Boolean
Does the point lie on the infinite line (within a length tolerance).
-
#on_plane?(plane) ⇒ Boolean
Does the point lie on the plane (within a length tolerance).
-
#project_to_line(line) ⇒ Geom::Point3d
Projects to the nearest point on an infinite line.
-
#project_to_plane(plane) ⇒ Geom::Point3d
Projects to the nearest point on the plane.
-
#set!(x, y, z) ⇒ Geom::Point3d
Sets the coordinates of the point.
Class Method Details
Point3d.new ⇒ pointPoint3d.new(x, y, z) ⇒ pointPoint3d.new(x, y) ⇒ pointPoint3d.new([x, y, z]) ⇒ pointPoint3d.new([x, y]) ⇒ pointPoint3d.new(point) ⇒ point
Constructs a point. With no arguments, it is the origin; with two components, Z is 0. Numeric literals are in inches; also accept Length (e.g., 1.mm).
Point3d.linear_combination(weight1, point1, weight2, point2) ⇒ Geom::Point3d
Weighted sum of two points: weight1 * point1 weight2 * point2+.
Instance Method Details
point.x ⇒ Length
X coordinate, in internal inches Length. pt.x.to_mm gets the Float in millimeters; 1000.mm stored and read back is still 1000 mm.
point.y ⇒ Length
Y coordinate, in internal inches Length.
point.z ⇒ Length
Z coordinate, in internal inches Length.
point.x = value ⇒ value
Set the X coordinate.
point.y = value ⇒ value
Set the Y coordinate.
point.z = value ⇒ value
Set the Z coordinate.
point.to_a ⇒ Array(Float, Float, Float)
Convert to [x, y, z], where x, y, and z are float values in inches, unaffected by display units and precision.
point.to_s ⇒ String
(x, y, z).
point.distance(other) ⇒ Length
Returns the Euclidean distance to another point, returning Length. other can be a point or [x, y, z].
point.offset(vector) ⇒ Geom::Point3dpoint.offset(vector, length) ⇒ Geom::Point3d
Offset the point along a vector, returning a new point. For a positive length, offset the point by that length in the direction of the vector.
point - point ⇒ Geom::Vector3dpoint - vector ⇒ Geom::Point3d
Subtract another point to get a vector, or subtract a vector to get a new point.
point == other ⇒ Boolean
Compare coordinates with another point or [x, y, z].
point.transform(transformation) ⇒ Geom::Point3d
Apply a transformation to a point and return the new point. Accepts values convertible to Transformation, where Vector3d is treated as a translation.
point.transform!(transformation) ⇒ self
Applies a transformation in place to the point. The transformation rules are the same as for #transform.
point + vector ⇒ Geom::Point3d
Add a vector to a Point3d, returning a new point.
point < other ⇒ Boolean
Compare in dictionary order by X, Y, Z.
point[index] ⇒ Length
Retrieve coordinates by index: 0 is X, 1 is Y, 2 is Z. Returns Length.
point[index] = value ⇒ value
Set coordinates by index.
point.clone ⇒ Geom::Point3d
Duplicates the point.
point.inspect ⇒ String
Debug string.
point.offset!(vector) ⇒ selfpoint.offset!(vector, length) ⇒ self
Translates along the vector in place.
point.vector_to(other) ⇒ Geom::Vector3d
Returns a vector from this point to another point.
point.distance_to_line(line) ⇒ Float
Distance to an infinite line. The line is defined as either [point, vector] or [point, point].
point.distance_to_plane(plane) ⇒ Float
Distance to the plane. The plane is given as either [point, normal] or [A, B, C, D].
point.on_line?(line) ⇒ Boolean
Does the point lie on the infinite line (within a length tolerance).
point.on_plane?(plane) ⇒ Boolean
Does the point lie on the plane (within a length tolerance).
point.project_to_line(line) ⇒ Geom::Point3d
Projects to the nearest point on an infinite line.
point.project_to_plane(plane) ⇒ Geom::Point3d
Projects to the nearest point on the plane.
point.set!(x, y, z) ⇒ selfpoint.set!(point) ⇒ selfpoint.set!(array) ⇒ self
Sets the coordinates of the point.