Class: Geom::Point3d
 Inherits:

Object
 Object
 Geom::Point3d
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 3element Array. These Arraylevel 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) ⇒ Object
The linear_combination method is used to create a new point as a linear combination of two points.
Instance Method Summary # collapse

#+(point2) ⇒ Object
The '+' operator is a fast way to add to the current x, y and z values of a point, or to set the values of a point by adding to other points together.

#(point2) ⇒ Object
The '' operator is a fast way to subtract from the current x, y and z values of a point.

#<(point2) ⇒ Object
The '<' operator is a fast way to determine if another point is closer to the origin.

#==(point2) ⇒ Object
The == method is used to compare two points for equality.

#[](index) ⇒ Object
The [] method is used to retrieve the value of the point at the specified index.

#[]=(new_value) ⇒ Object
The []= method is used to set the x, y, or z value of the point based on the specific index of the value.

#clone ⇒ Object
The clone method is used to create another point identical to the point being cloned.

#distance(point2) ⇒ Object
The distance method is used to compute the distance from a point to another point.

#distance_to_line(line) ⇒ Object
The distance_to_line method is used to compute the distance from a point to a line.

#distance_to_plane(plane) ⇒ Object
The distance_to_plane method is used to compute the distance from the point to a plane.

#initialize(*args) ⇒ Object
constructor
The new method is used to create a new 3D point.

#inspect ⇒ Object
The inspect method is used to format a 3D point as a string.

#offset(vector, length = vector.length) ⇒ Object
The offset method is used to offset a point by a vector and return a new point.

#offset!(vector, length = vector.length) ⇒ Object
The offset! method is used to offset a point by a vector.

#on_line?(line) ⇒ Object
The on_line? method is used to determine if the point is on a line.

#on_plane?(plane) ⇒ Object
The on_plane? method is used to determine if the point is on a plane.

#project_to_line(line) ⇒ Object
The project_to_line method is used to retrieve the point on a line that is closest to this point.

#project_to_plane(plane) ⇒ Object
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 ⇒ Object
The to_a method is used to convert the point to an array of 3 numbers.

#to_s ⇒ Object
The to_s method is used to retrieve a string representation of a point.

#transform!(transform) ⇒ Object
The transform! method is used to apply a Transformation to a point.

#transform(transform) ⇒ Object
The transform! method is used to apply a Transformation to a point to create a new point.

#vector_to(point2) ⇒ Object
The vector_to team method retrieves the vector between points.

#x ⇒ Object
The x method retrieves the x value of the 3D point.

#x=(value) ⇒ Object
The x= method is used to set the x value of a 3D point.

#y ⇒ Object
The y method retrieves the y value of the 3D point.

#y=(value) ⇒ Object
The y= method is used to set the y value of a 3D point.

#z ⇒ Object
The z method retrieves the z value of the 3D point.

#z=(value) ⇒ Object
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.
Class Method Details
↑ .linear_combination(weight1, point1, weight2, point2) ⇒ Object
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.
Instance Method Details
↑ #+(point2) ⇒ Object
The '+' operator is a fast way to add to the current x, y and z values of a point, or to set the values of a point by adding to other points together.
↑ #(point2) ⇒ Object
The '' operator is a fast way to subtract from the current x, y and z values of a point.
↑ #<(point2) ⇒ Object
The '<' operator is a fast way to determine if another point is closer to the origin.
↑ #==(point2) ⇒ Object
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:
↑ #[](index) ⇒ Object
The [] method is used to retrieve the value of the point at the specified index.
↑ #[]=(new_value) ⇒ Object
The []= method is used to set the x, y, or z value of the point based on the specific index of the value.
↑ #clone ⇒ Object
The clone method is used to create another point identical to the point being cloned.
↑ #distance(point2) ⇒ Object
The distance method is used to compute the distance from a point to another point.
↑ #distance_to_line(line) ⇒ Object
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.
↑ #distance_to_plane(plane) ⇒ Object
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.
↑ #inspect ⇒ Object
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.
↑ #offset(vector, length = vector.length) ⇒ Object
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.
↑ #offset!(vector, length = vector.length) ⇒ Object
The offset! method is used to offset a point by a vector. The point itself is modified.
Unlike offset, the point itself is modified.
↑ #on_line?(line) ⇒ Object
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.
↑ #on_plane?(plane) ⇒ Object
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.
↑ #project_to_line(line) ⇒ Object
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.
↑ #project_to_plane(plane) ⇒ Object
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.
↑ #set!(point3d) ⇒ Geom::Point3d #set!(array3d) ⇒ Geom::Point3d
The #set! method is used to set the values of the Point3d.
↑ #to_a ⇒ Object
The to_a method is used to convert the point to an array of 3 numbers
↑ #to_s ⇒ Object
The to_s method is used to retrieve a string representation of a point.
↑ #transform!(transform) ⇒ Object
The transform! method is used to apply a Transformation to a point.
Unlike the transform method, the point itself is modified.
↑ #transform(transform) ⇒ Object
The transform! method is used to apply a Transformation to a point to create a new point.
↑ #vector_to(point2) ⇒ Object
The vector_to team method retrieves the vector between points.
↑ #x ⇒ Object
The x method retrieves the x value of the 3D point.
↑ #x=(value) ⇒ Object
The x= method is used to set the x value of a 3D point.
↑ #y ⇒ Object
The y method retrieves the y value of the 3D point.
↑ #y=(value) ⇒ Object
The y= method is used to set the y value of a 3D point.
↑ #z ⇒ Object
The z method retrieves the z value of the 3D point.
↑ #z=(value) ⇒ Object
The z= method is used to set the z value of a 3D point.