Class: Array
Relationships | |
Inherits: | Object |
Overview
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.
Instance Attribute Summary
-
#x ⇒ Object?
rw
The #x method retrieves the x coordinate.
-
#x=(x) ⇒ Object
rw
The #x= method sets the x coordinate.
-
#y ⇒ Object?
rw
The #y method retrieves the y coordinate.
-
#y=(y) ⇒ Object
rw
The #y= method sets the y coordinate.
-
#z ⇒ Object?
rw
The #z method retrieves the z coordinate.
-
#z=(z) ⇒ Object
rw
The #z= method sets the z coordinate.
Instance Method Summary
-
#cross(vector) ⇒ Geom::Vector3d
The #cross method is used to compute the cross product between two vectors.
-
#distance(point) ⇒ Length
The #distance method is used to compute the distance between two points.
-
#distance_to_line(point, vector) ⇒ Length
The #distance_to_line method is used to compute the distance from a
::Geom::Point3d
object to a line. -
#distance_to_plane(point, vector) ⇒ Length
The #distance_to_plane method is used to compute the distance from a
::Geom::Point3d
object to a plane. -
#dot(vector) ⇒ Float
The #dot method is used to compute the dot product between two vectors.
-
#normalize ⇒ Array(Float, Float, Float)
The #normalize method is used to normalize a vector (setting its length to 1).
-
#normalize! ⇒ Array(Float, Float, Float)
The #normalize! method is used to normalize a vector in place (setting its length to 1).
-
#offset(vector) ⇒ Array(Length, Length, Length)
The #offset method is used to offset a point by a vector.
-
#offset!(vector) ⇒ Array(Length, Length, Length)
The #offset! method is used to offset a point by a vector.
-
#on_line?(point, vector) ⇒ Boolean
The #on_line? method is used to determine if a
::Geom::Point3d
object is on a line. -
#on_plane?(point, vector) ⇒ Boolean
The #on_plane? method is used to determine if a
::Geom::Point3d
object is on a plane (to within SketchUp’s standard floating point tolerance). -
#project_to_line(point, vector) ⇒ Array(Length, Length, Length)
The #project_to_line method is used to retrieve the projection of a
::Geom::Point3d
object onto a line. -
#project_to_plane(point, vector) ⇒ Array(Length, Length, Length)
The #project_to_plane method retrieves the projection of a
::Geom::Point3d
onto a plane. -
#transform(transform) ⇒ Array<Length, Length>
The #transform method is used to apply a
::Geom::Transformation
or::Geom::Transformation2d
object to a::Geom::Point3d
or::Geom::Point2d
object defined by anArray
object. -
#transform!(transform) ⇒ Array
The #transform! method is used to apply a
::Geom::Transformation
object to a::Geom::Point3d
object defined by anArray
object. -
#vector_to(point) ⇒ Geom::Vector3d
The #vector_to method is used to create an array as a vector from one point to a second point.
Instance Attribute Details
#x ⇒ Object
? (rw)
The #x
method retrieves the x coordinate.
#x=(x) ⇒ Object
(rw)
The #x=
method sets the x coordinate.
#y ⇒ Object
? (rw)
The #y
method retrieves the y coordinate.
#y=(y) ⇒ Object
(rw)
The #y=
method sets the y coordinate.
#z ⇒ Object
? (rw)
The #z
method retrieves the z coordinate.
#z=(z) ⇒ Object
(rw)
The #z=
method sets the z coordinate.
Instance Method Details
#cross(vector) ⇒ Geom::Vector3d
#cross(vector) ⇒ Geom::Vector2d
The #cross
method is used to compute the cross product between two vectors.
The #distance
method is used to compute the distance between two points.
The #distance_to_line
method is used to compute the distance from a ::Geom::Point3d
object to a line.
The #distance_to_plane
method is used to compute the distance from a ::Geom::Point3d
object to a plane.
#dot(vector) ⇒ Float
#dot(vector) ⇒ Float
Float
#dot(vector) ⇒ Float
The #dot
method is used to compute the dot product between two vectors.
#normalize ⇒ Array
(Float
, Float
, Float
)
#normalize ⇒ Array
(Float
, Float
)
Array
(Float
, Float
, Float
)
#normalize ⇒ Array
(Float
, Float
)
The arguments and return value will be converted to a floating point value. (Unlike in the Geom::Vector3d#normalize! method.)
The #normalize
method is used to normalize a vector (setting its length to 1). It returns a new array rather than changing the original in place.
#normalize! ⇒ Array
(Float
, Float
, Float
)
#normalize! ⇒ Array
(Float
, Float
)
Array
(Float
, Float
, Float
)
#normalize! ⇒ Array
(Float
, Float
)
The #normalize!
method is used to normalize a vector in place (setting its length to 1).
The #offset
method is used to offset a point by a vector. it returns a new array rather than modifying the original in place.
The #offset!
method is used to offset a point by a vector. The array is modified in place.
#on_line?(point, vector) ⇒ Boolean
#on_line?(point1, point2) ⇒ Boolean
Boolean
#on_line?(point1, point2) ⇒ Boolean
The #on_line?
method is used to determine if a ::Geom::Point3d
object is on a line.
#on_plane?(point, vector) ⇒ Boolean
#on_plane?(point1, point2, point3) ⇒ Boolean
#on_plane?(float1, float2, float3, float4) ⇒ Boolean
#on_plane?(array) ⇒ Boolean
#on_plane?(array) ⇒ Boolean
#on_plane?(array) ⇒ Boolean
Boolean
#on_plane?(point1, point2, point3) ⇒ Boolean
#on_plane?(float1, float2, float3, float4) ⇒ Boolean
#on_plane?(array) ⇒ Boolean
#on_plane?(array) ⇒ Boolean
#on_plane?(array) ⇒ Boolean
The #on_plane?
method is used to determine if a ::Geom::Point3d
object is on a plane (to within SketchUp’s standard floating point tolerance).
The #project_to_line
method is used to retrieve the projection of a ::Geom::Point3d
object onto a line.
#project_to_plane(point, vector) ⇒ Array
(Length, Length, Length)
#project_to_plane(point1, point2, point3) ⇒ Array
(Length, Length, Length)
#project_to_plane(float1, float2, float3, float4) ⇒ Array
(Length, Length, Length)
#project_to_plane(array) ⇒ Array
(Length, Length, Length)
#project_to_plane(array) ⇒ Array
(Length, Length, Length)
#project_to_plane(array) ⇒ Array
(Length, Length, Length)
Array
(Length, Length, Length)
#project_to_plane(point1, point2, point3) ⇒ Array
(Length, Length, Length)
#project_to_plane(float1, float2, float3, float4) ⇒ Array
(Length, Length, Length)
#project_to_plane(array) ⇒ Array
(Length, Length, Length)
#project_to_plane(array) ⇒ Array
(Length, Length, Length)
#project_to_plane(array) ⇒ Array
(Length, Length, Length)
The #project_to_plane
method retrieves the projection of a ::Geom::Point3d
onto a plane.
The #transform
method is used to apply a ::Geom::Transformation
or ::Geom::Transformation2d
object to a ::Geom::Point3d
or ::Geom::Point2d
object defined by an Array
object.
This method returns a new Array
object instead of modifying the original.
#transform!(transform) ⇒ Array
#transform!(transform) ⇒ Array
Array
#transform!(transform) ⇒ Array
This method modifies the original.
The #transform!
method is used to apply a ::Geom::Transformation
object to a ::Geom::Point3d
object defined by an Array
object.
#vector_to(point) ⇒ Geom::Vector3d
#vector_to(point) ⇒ Geom::Vector2d
The #vector_to
method is used to create an array as a vector from one point to a second point.