Class: Geom::Point3d
- Inherits:
-
Object
- Object
- Geom::Point3d
- Defined in:
- lib/sketchup-api-stubs/stubs/Geom/Point3d.rb
Overview
The Point3d class allows you to work with a point in 3D space. The point is basically just a series of values representing x, y and z coordinates.
The values are specified as [x,y,z]. For example [100,200,300]. To create a point call Geom::Point3d.new, where the creation method can take a variety of arguments:
In addition to the methods below, there are a series of geometry related methods that are on the Array class, since Point3d objects can also be represented as a 3-element Array. These Array-level methods are for operations such as determining if a point is on a line, on a plane, etc. See the Array class for details.
Class Method Summary collapse
-
.linear_combination(weight1, point1, weight2, point2) ⇒ Geom::Point3d
The Point3d.linear_combination method is used to create a new point as a linear combination of two points.
Instance Method Summary collapse
-
#+(vector) ⇒ Geom::Point3d
The #+ operator is a fast way to add to the current x, y and z values of a vector.
-
#-(point2) ⇒ Geom::Vector3d
The ‘-’ operator is a fast way to subtract from the current x, y and z values of a point.
-
#<(point2) ⇒ Boolean
The ‘<’ operator is a fast way to determine if another point is closer to the origin.
-
#==(point2) ⇒ Boolean
The == method is used to compare two points for equality.
-
#[](index) ⇒ Length
The [] method is used to retrieve the value of the point at the specified index.
-
#[]=(index, new_value) ⇒ Numeric
The []= method is used to set the x, y, or z value of the point based on the specific index of the value.
-
#clone ⇒ Geom::Point3d
The clone method is used to create another point identical to the point being cloned.
-
#distance(point2) ⇒ Length
The distance method is used to compute the distance from a point to another point.
-
#distance_to_line(line) ⇒ Float
The distance_to_line method is used to compute the distance from a point to a line.
-
#distance_to_plane(plane) ⇒ Float
The distance_to_plane method is used to compute the distance from the point to a plane.
-
#initialize(*args) ⇒ Point3d
constructor
The new method is used to create a new 3D point.
-
#inspect ⇒ String
The inspect method is used to format a 3D point as a string.
-
#offset(vector, length = vector.length) ⇒ Geom::Point3d
The offset method is used to offset a point by a vector and return a new point.
-
#offset!(vector, length = vector.length) ⇒ Geom::Point3d
The offset! method is used to offset a point by a vector.
-
#on_line?(line) ⇒ Boolean
The on_line? method is used to determine if the point is on a line.
-
#on_plane?(plane) ⇒ Boolean
The on_plane? method is used to determine if the point is on a plane.
-
#project_to_line(line) ⇒ Geom::Point3d
The project_to_line method is used to retrieve the point on a line that is closest to this point.
-
#project_to_plane(plane) ⇒ Geom::Point3d
The project_to_plane method is used to retrieve the point on a plane that is closest to the point.
-
#set!(*args) ⇒ Object
The #set! method is used to set the values of the Point3d.
-
#to_a ⇒ Array(Length, Length, Length)
The to_a method is used to convert the point to an array of 3 numbers.
-
#to_s ⇒ String
The to_s method is used to retrieve a string representation of a point.
-
#transform(transform) ⇒ Geom::Point3d
Apply a Transformation to a point, returning a new point.
-
#transform!(transform) ⇒ Geom::Point3d
Apply a Transformation to a point.
-
#vector_to(point2) ⇒ Geom::Vector3d
The vector_to team method retrieves the vector between points.
-
#x ⇒ Length
The x method retrieves the x value of the 3D point.
-
#x=(value) ⇒ Numeric
The x= method is used to set the x value of a 3D point.
-
#y ⇒ Length
The y method retrieves the y value of the 3D point.
-
#y=(value) ⇒ Numeric
The y= method is used to set the y value of a 3D point.
-
#z ⇒ Length
The z method retrieves the z value of the 3D point.
-
#z=(value) ⇒ Numeric
The z= method is used to set the z value of a 3D point.
Constructor Details
#initialize ⇒ Geom::Point3d #initialize(x, y, z = 0.0) ⇒ Geom::Point3d #initialize(point3d) ⇒ Geom::Point3d #initialize(array3d) ⇒ Geom::Point3d #initialize(array2d) ⇒ Geom::Point3d #initialize(input_point) ⇒ Geom::Point3d #initialize(vertex) ⇒ Geom::Point3d
The new method is used to create a new 3D point.
327 328 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Point3d.rb', line 327 def initialize(*args) end |
Class Method Details
.linear_combination(weight1, point1, weight2, point2) ⇒ Geom::Point3d
The linear_combination method is used to create 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.
A linear combination is a standard term for vector math. It is defined as point = weight1 * point1 + weight2 * point2.
68 69 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Point3d.rb', line 68 def self.linear_combination(weight1, point1, weight2, point2) end |
Instance Method Details
#+(vector) ⇒ Geom::Point3d
The #+ operator is a fast way to add to the current x, y and z values of a vector.
97 98 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Point3d.rb', line 97 def +(vector) end |
#-(point2) ⇒ Geom::Vector3d
The ‘-’ operator is a fast way to subtract from the current x, y and z values of a point.
113 114 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Point3d.rb', line 113 def -(point2) end |
#<(point2) ⇒ Boolean
The ‘<’ operator is a fast way to determine if another point is closer to the origin.
130 131 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Point3d.rb', line 130 def <(point2) end |
#==(point2) ⇒ Boolean
The == method is used to compare two points for equality.
This uses the standard SketchUp tolerance to determine if two points are the same.
Points can be compared to one another or to an array representing x, y and z coordinates, as in the following examples:
163 164 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Point3d.rb', line 163 def ==(point2) end |
#[](index) ⇒ Length
The [] method is used to retrieve the value of the point at the specified index.
182 183 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Point3d.rb', line 182 def [](index) end |
#[]=(index, new_value) ⇒ Numeric
The []= method is used to set the x, y, or z value of the point based on the specific index of the value.
202 203 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Point3d.rb', line 202 def []=(index, new_value) end |
#clone ⇒ Geom::Point3d
The clone method is used to create another point identical to the point being cloned.
215 216 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Point3d.rb', line 215 def clone end |
#distance(point2) ⇒ Length
The distance method is used to compute the distance from a point to another point.
232 233 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Point3d.rb', line 232 def distance(point2) end |
#distance_to_line(line) ⇒ Float
This function returns a ‘Float` value, not a `Length`.
The distance_to_line method is used to compute the distance from a point to a line.
See Geom module for how to specify a line.
254 255 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Point3d.rb', line 254 def distance_to_line(line) end |
#distance_to_plane(plane) ⇒ Float
This function returns a ‘Float` value, not a `Length`.
The distance_to_plane method is used to compute the distance from the point to a plane.
See module Geom for how to specify a plane.
274 275 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Point3d.rb', line 274 def distance_to_plane(plane) end |
#inspect ⇒ String
The inspect method is used to format a 3D point as a string.
You will not often use these function directly. Instead, they are called automatically when an object is output using a print command like ‘puts’, which writes to the Ruby console.
343 344 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Point3d.rb', line 343 def inspect end |
#offset(vector, length = vector.length) ⇒ Geom::Point3d
The offset method is used to offset a point by a vector and return a new point. The length of the vector must not be zero.
364 365 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Point3d.rb', line 364 def offset(vector, length = vector.length) end |
#offset!(vector, length = vector.length) ⇒ Geom::Point3d
The offset! method is used to offset a point by a vector. The point itself is modified.
Unlike offset, the point itself is modified.
387 388 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Point3d.rb', line 387 def offset!(vector, length = vector.length) end |
#on_line?(line) ⇒ Boolean
The on_line? method is used to determine if the point is on a line.
See module Geom for the various ways to specify a line.
405 406 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Point3d.rb', line 405 def on_line?(line) end |
#on_plane?(plane) ⇒ Boolean
The on_plane? method is used to determine if the point is on a plane.
See module Geom for the various ways to specify a plane.
422 423 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Point3d.rb', line 422 def on_plane?(plane) end |
#project_to_line(line) ⇒ Geom::Point3d
The project_to_line method is used to retrieve the point on a line that is closest to this point.
The line may be defined by either a point and a vector or by two points.
442 443 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Point3d.rb', line 442 def project_to_line(line) end |
#project_to_plane(plane) ⇒ Geom::Point3d
The project_to_plane method is used to retrieve the point on a plane that is closest to the point.
The plane may be defined by either a point on the plane and a vector perpendicular to the plane or by the coeficients to the plane equation AX + BY + CZ + D = 0. See Geom for details.
464 465 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Point3d.rb', line 464 def project_to_plane(plane) end |
#set!(x, y, z) ⇒ Geom::Point3d #set!(array3d) ⇒ Geom::Point3d #set!(point3d) ⇒ Geom::Point3d
The #set! method is used to set the values of the Point3d.
491 492 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Point3d.rb', line 491 def set!(*args) end |
#to_a ⇒ Array(Length, Length, Length)
The to_a method is used to convert the point to an array of 3 numbers
508 509 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Point3d.rb', line 508 def to_a end |
#to_s ⇒ String
The to_s method is used to retrieve a string representation of a point.
520 521 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Point3d.rb', line 520 def to_s end |
#transform(transform) ⇒ Geom::Point3d
Apply a Transformation to a point, returning a new point. The original vector is unchanged by this method.
538 539 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Point3d.rb', line 538 def transform(transform) end |
#transform!(transform) ⇒ Geom::Point3d
Apply a Transformation to a point. The point itself is modified.
555 556 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Point3d.rb', line 555 def transform!(transform) end |
#vector_to(point2) ⇒ Geom::Vector3d
The vector_to team method retrieves the vector between points.
577 578 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Point3d.rb', line 577 def vector_to(point2) end |
#x ⇒ Length
The x method retrieves the x value of the 3D point.
589 590 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Point3d.rb', line 589 def x end |
#x=(value) ⇒ Numeric
The x= method is used to set the x value of a 3D point.
604 605 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Point3d.rb', line 604 def x=(value) end |
#y ⇒ Length
The y method retrieves the y value of the 3D point.
616 617 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Point3d.rb', line 616 def y end |
#y=(value) ⇒ Numeric
The y= method is used to set the y value of a 3D point.
631 632 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Point3d.rb', line 631 def y=(value) end |
#z ⇒ Length
The z method retrieves the z value of the 3D point.
643 644 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Point3d.rb', line 643 def z end |
#z=(value) ⇒ Numeric
The z= method is used to set the z value of a 3D point.
658 659 |
# File 'lib/sketchup-api-stubs/stubs/Geom/Point3d.rb', line 658 def z=(value) end |