Class: Array
Overview
In SketchUp, Arrays may be used in place of either Geom::Point3d and Geom::Vector3d objects depending on how they are used.
The SketchUp Array class adds additional methods to the standard Ruby Array class. Specifically, it contains methods allowing an array to behave just as a Geom::Vector3d or Geom::Point3d object (which can be thought of as arrays of 3 coordinate values). Therefore, you can use the Array class in place of a Geom::Point3d or Geom::Vector3d as a way to pass coordinate values.
In addition to the builtin Ruby Array methods, the following methods have been added by SketchUp.
Instance Method Summary collapse

#cross(vector) ⇒ Vector3d
Compute the cross product between two vectors, particularly this vector and the given vector.

#distance(point) ⇒ Length
Compute the distance between this point and the given point.

#distance_to_line(line) ⇒ Length
Compute the distance from the current point to a line.

#distance_to_plane(plane) ⇒ Length
Compute the distance from the current point to a plane.

#dot(vector) ⇒ Float
Compute the dot product between the current and the specified vector.

#normalize ⇒ Array
Normalize the current vector (setting its length to one).

#normalize! ⇒ Array
Normalize the current vector in place (settings its length to one).

#offset(vector) ⇒ Array
Offset current point by a vector.

#offset!(vector) ⇒ Array
Offset current point by a vector in place.

#on_line?(line) ⇒ Boolean
Determine if the current point is on the given line.

#on_plane?(plane) ⇒ Boolean
Determine if the current point is on the given plane.

#project_to_line(line) ⇒ Array
Project point onto a line.

#project_to_plane(plane) ⇒ Array
Project point onto a plane.

#transform(transformation) ⇒ Array
Apply Geom::Transformation object to the current point defined by an Array object.

#transform!(transformation) ⇒ Array
Apply Geom::Transformation object to the current point defined by an Array object.

#vector_to(point) ⇒ Geom::Vector3d
Compute vector from the current point to the given point.

#x ⇒ Numeric
Get the X coordinate or the first element of the array.

#x= ⇒ Object
Set the X coordinate or the first element of the array.

#y ⇒ Numeric
Get the Y coordinate or the second element of the array.

#y= ⇒ Object
Set the Y coordinate or the second element of the array.

#z ⇒ Numeric
Get the Z coordinate or the third element of the array.

#z= ⇒ Object
Set the Z coordinate or the third element of the array.
Instance Method Details
#cross(vector) ⇒ Vector3d
Compute the cross product between two vectors, particularly this vector and the given vector.
50 51 
# File 'lib/array.rb', line 50 def cross(vector) end 
#distance(point) ⇒ Length
Compute the distance between this point and the given point.
68 69 
# File 'lib/array.rb', line 68 def distance(point) end 
#distance_to_line(line) ⇒ Length
Compute the distance from the current point to a line. Lines are defined by an array of a point and a vector or an array of two points. See the Geom module for instructions on how to create a line.
86 87 
# File 'lib/array.rb', line 86 def distance_to_line(line) end 
#distance_to_plane(plane) ⇒ Length
Compute the distance from the current point to a plane. See the Geom module for instructions on how to create a plane.
103 104 
# File 'lib/array.rb', line 103 def distance_to_plane(plane) end 
#dot(vector) ⇒ Float
Compute the dot product between the current and the specified vector.
120 121 
# File 'lib/array.rb', line 120 def dot(vector) end 
#normalize ⇒ Array
Normalize the current vector (setting its length to one). It returns a new array rather than changing the original in place.
132 133 
# File 'lib/array.rb', line 132 def normalize end 
#normalize! ⇒ Array
Normalize the current vector in place (settings its length to one).
143 144 
# File 'lib/array.rb', line 143 def normalize! end 
#offset(vector) ⇒ Array
Offset current point by a vector. This returns a new array rather than modifying the original in place.
158 159 
# File 'lib/array.rb', line 158 def offset(vector) end 
#offset!(vector) ⇒ Array
Offset current point by a vector in place. This modifies the current array.
172 173 
# File 'lib/array.rb', line 172 def offset!(vector) end 
#on_line?(line) ⇒ Boolean
Determine if the current point is on the given line. See the Geom module for instructions on how to create a line.
190 191 
# File 'lib/array.rb', line 190 def on_line?(line) end 
#on_plane?(plane) ⇒ Boolean
Determine if the current point is on the given plane. See the Geom module for instructions on how to create a plane.
208 209 
# File 'lib/array.rb', line 208 def on_plane?(plane) end 
#project_to_line(line) ⇒ Array
Project point onto a line. See the Geom module for instructions on how to create a line.
226 227 
# File 'lib/array.rb', line 226 def project_to_line(line) end 
#project_to_plane(plane) ⇒ Array
Project point onto a plane. See the Geom module for instructions on how to create a plane.
244 245 
# File 'lib/array.rb', line 244 def project_to_plane(plane) end 
#transform(transformation) ⇒ Array
Apply Geom::Transformation object to the current point defined by an Array object. This method returns a new transformed point rather than modifying the current point.
261 262 
# File 'lib/array.rb', line 261 def transform(transformation) end 
#transform!(transformation) ⇒ Array
Apply Geom::Transformation object to the current point defined by an Array object. This method modifies the current point.
277 278 
# File 'lib/array.rb', line 277 def transform!(transformation) end 
#vector_to(point) ⇒ Geom::Vector3d
Compute vector from the current point to the given point.
291 292 
# File 'lib/array.rb', line 291 def vector_to(point) end 
#x ⇒ Numeric
Get the X coordinate or the first element of the array.
309 310 
# File 'lib/array.rb', line 309 def x end 
#x= ⇒ Object
Set the X coordinate or the first element of the array.
322 323 
# File 'lib/array.rb', line 322 def x= end 
#y ⇒ Numeric
Get the Y coordinate or the second element of the array.
340 341 
# File 'lib/array.rb', line 340 def y end 
#y= ⇒ Object
Set the Y coordinate or the second element of the array.
353 354 
# File 'lib/array.rb', line 353 def y= end 
#z ⇒ Numeric
Get the Z coordinate or the third element of the array.
371 372 
# File 'lib/array.rb', line 371 def z end 
#z= ⇒ Object
Set the Z coordinate or the third element of the array.
384 385 
# File 'lib/array.rb', line 384 def z= end 