Class: Array
- Inherits:
-
Object
- Object
- Array
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 Method Summary # collapse
-
#cross(vector) ⇒ Object
The #cross method is used to compute the cross product between two vectors.
-
#distance(point) ⇒ Object
The #distance method is used to compute the distance between two points.
-
#distance_to_line(*args) ⇒ Object
The #distance_to_line method is used to compute the distance from a Geom::Point3d object to a line.
-
#distance_to_plane(*args) ⇒ Object
The #distance_to_plane method is used to compute the distance from a Geom::Point3d object to a plane.
-
#dot(vector) ⇒ Object
The #dot method is used to compute the dot product between two vectors.
-
#normalize ⇒ Object
The #normalize method is used to normalize a vector (setting its length to 1).
-
#normalize! ⇒ Object
The #normalize! method is used to normalize a vector in place (setting its length to 1).
-
#offset(*args) ⇒ Object
The #offset method is used to offset a point by a vector.
-
#offset!(*args) ⇒ Object
The #offset! method is used to offset a point by a vector.
-
#on_line?(*args) ⇒ Object
The #on_line? method is used to determine if a Geom::Point3d object is on a line.
-
#on_plane?(*args) ⇒ 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(*args) ⇒ Object
The #project_to_line method is used to retrieve the projection of a Geom::Point3d object onto a line.
-
#project_to_plane(*args) ⇒ Object
The #project_to_plane method retrieves the projection of a Geom::Point3d onto a plane.
-
#transform(transform) ⇒ Object
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.
-
#transform!(transform) ⇒ Object
The #transform! method is used to apply a Geom::Transformation object to a Geom::Point3d object defined by an Array object.
-
#vector_to(point) ⇒ Object
The #vector_to method is used to create an array as a vector from one point to a second point.
-
#x ⇒ Object?
The #x method retrieves the x coordinate.
-
#x=(x) ⇒ Object
The #x= method sets the x coordinate.
-
#y ⇒ Object?
The #y method retrieves the y coordinate.
-
#y=(y) ⇒ Object
The #y= method sets the y coordinate.
-
#z ⇒ Object?
The #z method retrieves the z coordinate.
-
#z=(z) ⇒ Object
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.
↑ #distance(point) ⇒ Length #distance(point) ⇒ Length
The #distance method is used to compute the distance between two points.
↑ #distance_to_line(point, vector) ⇒ Length #distance_to_line(point1, point2) ⇒ 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 #distance_to_plane(point1, point2, point3) ⇒ Length #distance_to_plane(float1, float2, float3, float4) ⇒ Length #distance_to_plane(array) ⇒ Length #distance_to_plane(array) ⇒ Length #distance_to_plane(array) ⇒ Length
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
The #dot method is used to compute the dot product between two vectors.
↑ #normalize ⇒ 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)
The #normalize! method is used to normalize a vector in place (setting its length to 1).
↑ #offset(vector) ⇒ Array(Length, Length, Length) #offset(vector) ⇒ Array(Length, Length) #offset(vector, length) ⇒ Array(Length, Length, Length) #offset(vector, length) ⇒ Array(Length, Length)
The #offset method is used to offset a point by a vector. it returns a new array rather than modifying the original in place.
↑ #offset!(vector) ⇒ Array(Length, Length, Length) #offset!(vector) ⇒ Array(Length, Length) #offset!(vector, length) ⇒ Array(Length, Length, Length) #offset!(vector, length) ⇒ Array(Length, Length)
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
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
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) #project_to_line(point1, point2) ⇒ 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) #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.
↑ #transform(transform) ⇒ Array<Length, Length> #transform(transform) ⇒ Array<Length, 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 an Array object.
This method returns a new Array object instead of modifying the original.
↑ #transform!(transform) ⇒ 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.