Class: Geom::Point3d
Class Method Summary collapse
-
.linear_combination(weight1, point1, weight2, point2) ⇒ Geom::Point3d
Creates a new point as a linear combination of two points.
Instance Method Summary collapse
-
#+(vector) ⇒ Geom::Point3d
Returns a new point which is offset from the receiver by the given vector.
-
#-(vector) ⇒ Object
Subtracts from this point.
-
#<(point2) ⇒ Boolean
Compare two points coordinate by coordinate.
-
#==(point2) ⇒ Boolean
Compare Point3ds using SketchUp tolerance.
-
#[](index) ⇒ Numeric
Retrieves the coordinate of the point at the specified index.
-
#[]=(index, value) ⇒ Numeric
Retrieves the coordinate of the point at the specified index.
-
#clone ⇒ Geom::Point3d
Creates another point identical to the point being cloned.
-
#distance(point2) ⇒ Length
Compute the distance from this point to another point.
-
#distance_to_line(line) ⇒ Length
Computes the distance from this point to a line.
-
#distance_to_plane(plane) ⇒ Length
Computes the distance from this point to a plane.
-
#initialize(*args) ⇒ Point3d
constructor
Creates a new 3D point.
-
#inspect ⇒ String
Returns a string containing a human-readable representation of this point.
-
#offset(vector, length = vector.length) ⇒ Geom::Point3d
Offsets a point by a vector and returns a new point.
-
#offset!(vector, length = vector.length) ⇒ self
Applies an offset by a vector to this point.
-
#on_line?(line) ⇒ Boolean
Determines if this point is on a line.
-
#on_plane?(plane) ⇒ Boolean
Determines if this point is on a plane.
-
#project_to_line ⇒ Geom::Point3d
Retrieves the point on a line that is closest to this point.
-
#project_to_plane ⇒ Geom::Point3d
Retrieves the point on a plane that is closest to this point.
-
#set!(x, y = self.x, z = self.y) ⇒ self
Sets the values of this point.
-
#to_a ⇒ Array(Length,Length,Length)
Returns an array representation of this point.
-
#to_s ⇒ String
Returns a string representation of this point.
-
#transform(transformation) ⇒ Geom::Point3d
Applies a transformation to a copy this point to create a new point.
-
#transform!(transformation) ⇒ self
Applies a transformation to this point.
-
#vector_to(point2) ⇒ Geom::Vector3d
Creates a vector between this point and another point.
-
#x ⇒ Length
Retrieves the x coordinate of this point.
-
#x=(value) ⇒ Numeric
Sets the x value of this point.
-
#y ⇒ Length
Retrieves the y coordinate of this point.
-
#y=(value) ⇒ Numeric
Sets the y value of this point.
-
#z ⇒ Length
Retrieves the z coordinate of this point.
-
#z=(value) ⇒ Numeric
Sets the z value of this point.
Constructor Details
Class Method Details
.linear_combination(weight1, point1, weight2, point2) ⇒ Geom::Point3d
Creates a new point as a linear combination of two points. This method is generally used to get a point at some percentage along a line connecting the two points. The weights should sum up to 1 if you want to get a on that line. The weights should be between 0 and 1 if you want to get a point between the two points.
109 110 |
# File 'lib/point3d.rb', line 109 def self.linear_combination(weight1, point1, weight2, point2) end |
Instance Method Details
#+(vector) ⇒ Geom::Point3d
Returns a new point which is offset from the receiver by the given vector.
26 27 |
# File 'lib/point3d.rb', line 26 def +(vector) end |
#-(vector) ⇒ Geom::Point3d #-(point2) ⇒ Geom::Vector3d
Subtracts from this point.
38 39 |
# File 'lib/point3d.rb', line 38 def -(vector) end |
#<(point2) ⇒ Boolean
Compare two points coordinate by coordinate. First the x coordinates are compared, if they are equal, the y coordinates are compared, if those are equal finally the z coordinates.
49 50 |
# File 'lib/point3d.rb', line 49 def < (point2) end |
#==(point2) ⇒ Boolean
Compare Geom::Point3ds using SketchUp tolerance.
55 56 |
# File 'lib/point3d.rb', line 55 def ==(point2) end |
#[](index) ⇒ Numeric
Retrieves the coordinate of the point at the specified index.
62 63 |
# File 'lib/point3d.rb', line 62 def [](index) end |
#[]=(index, value) ⇒ Numeric
Retrieves the coordinate of the point at the specified index.
70 71 |
# File 'lib/point3d.rb', line 70 def []=(index, value) end |
#clone ⇒ Geom::Point3d
Creates another point identical to the point being cloned.
75 76 |
# File 'lib/point3d.rb', line 75 def clone end |
#distance(point2) ⇒ Length
Compute the distance from this point to another point.
81 82 |
# File 'lib/point3d.rb', line 81 def distance(point2) end |
#distance_to_line(line) ⇒ Length
Computes the distance from this point to a line.
87 88 |
# File 'lib/point3d.rb', line 87 def distance_to_line(line) end |
#distance_to_plane(plane) ⇒ Length
Computes the distance from this point to a plane.
93 94 |
# File 'lib/point3d.rb', line 93 def distance_to_plane(plane) end |
#inspect ⇒ String
Returns a string containing a human-readable representation of this point.
98 99 |
# File 'lib/point3d.rb', line 98 def inspect end |
#offset(vector, length = vector.length) ⇒ Geom::Point3d
Offsets a point by a vector and returns a new point. The length of the vector must not be zero.
116 117 |
# File 'lib/point3d.rb', line 116 def offset(vector, length=vector.length) end |
#offset!(vector, length = vector.length) ⇒ self
Applies an offset by a vector to this point. The length of the vector must not be zero.
123 124 |
# File 'lib/point3d.rb', line 123 def offset!(vector, length=vector.length) end |
#on_line?(line) ⇒ Boolean
Determines if this point is on a line.
129 130 |
# File 'lib/point3d.rb', line 129 def on_line?(line) end |
#on_plane?(plane) ⇒ Boolean
Determines if this point is on a plane.
135 136 |
# File 'lib/point3d.rb', line 135 def on_plane?(plane) end |
#project_to_line ⇒ Geom::Point3d
Retrieves the point on a line that is closest to this point.
141 142 |
# File 'lib/point3d.rb', line 141 def project_to_line end |
#project_to_plane ⇒ Geom::Point3d
Retrieves the point on a plane that is closest to this point.
147 148 |
# File 'lib/point3d.rb', line 147 def project_to_plane end |
#set!(x, y = self.x, z = self.y) ⇒ self
Sets the values of this point.
155 156 |
# File 'lib/point3d.rb', line 155 def set!(x, y=self.x, z=self.y) end |
#to_a ⇒ Array(Length,Length,Length)
Returns an array representation of this point.
160 161 |
# File 'lib/point3d.rb', line 160 def to_a end |
#to_s ⇒ String
Returns a string representation of this point.
165 166 |
# File 'lib/point3d.rb', line 165 def to_s end |
#transform(transformation) ⇒ Geom::Point3d
Applies a transformation to a copy this point to create a new point.
171 172 |
# File 'lib/point3d.rb', line 171 def transform(transformation) end |
#transform!(transformation) ⇒ self
Applies a transformation to this point. Unlike the #transform method, the point itself is modified.
178 179 |
# File 'lib/point3d.rb', line 178 def transform!(transformation) end |
#vector_to(point2) ⇒ Geom::Vector3d
Creates a vector between this point and another point.
184 185 |
# File 'lib/point3d.rb', line 184 def vector_to(point2) end |
#x ⇒ Length
Retrieves the x coordinate of this point.
189 190 |
# File 'lib/point3d.rb', line 189 def x end |
#x=(value) ⇒ Numeric
Sets the x value of this point.
195 196 |
# File 'lib/point3d.rb', line 195 def x=(value) end |
#y ⇒ Length
Retrieves the y coordinate of this point.
200 201 |
# File 'lib/point3d.rb', line 200 def y end |
#y=(value) ⇒ Numeric
Sets the y value of this point.
206 207 |
# File 'lib/point3d.rb', line 206 def y=(value) end |
#z ⇒ Length
Retrieves the z coordinate of this point.
211 212 |
# File 'lib/point3d.rb', line 211 def z end |
#z=(value) ⇒ Numeric
Sets the z value of this point.
217 218 |
# File 'lib/point3d.rb', line 217 def z=(value) end |