Class: Geom::Vector3d
- Inherits:
-
Object
- Object
- Geom::Vector3d
Overview
Class Method Summary # collapse
-
.new ⇒ Geom::Vector3d
Construct a vector. With no parameters, it initializes to the zero vector; with two components, the Z component is 0. Bare numbers are interpreted in inches; alternatively, a Length can be passed.
-
.linear_combination(weight1, vector1, weight2, vector2) ⇒ Geom::Vector3d
Linear combination of two vectors, or a linear combination along three axes.
Instance Method Summary # collapse
-
#x ⇒ Float
X component, inches Float. Unlike Geom::Point3d#x Length.
-
#y ⇒ Float
Y component, inches Float.
-
#z ⇒ Float
Z component, inches Float.
-
#to_a(Float, Float, Float) ⇒ Array<Float>
Convert to [x, y, z], where x, y, and z are floats, consistent with Geom::Point3d#to_a.
-
#to_s ⇒ String
(x, y, z).
-
#length ⇒ Length
Vector length, returns Length.
-
#== ⇒ Boolean
Compare components with another vector, point, or [x, y, z].
-
#% ⇒ Numeric
Dot product.
-
#* ⇒ Geom::Vector3d
takes the cross product with another vector; multiplies by a Numeric value.
-
#+ ⇒ Geom::Vector3d
Adds two vectors.
-
#- ⇒ Geom::Vector3d
Subtracts one vector from another.
-
#< ⇒ Boolean
Compare by length.
-
#[] ⇒ Float
Return the component at the specified index as a Float.
-
#[]= ⇒ Numeric, Length
Set the components by index.
-
#x= ⇒ Numeric, Length
Set the X component.
-
#y= ⇒ Numeric, Length
Set the Y component.
-
#z= ⇒ Numeric, Length
Set the Z component.
-
#angle_between(other) ⇒ Numeric
The angle between another vector, in radians.
-
#axes(Geom::Vector3d, Geom::Vector3d, Geom::Vector3d) ⇒ Array<Geom::Vector3d>
Construct a set of orthogonal axes [x, y, z] with the vector as the Z axis.
-
#clone ⇒ Geom::Vector3d
Clones a vector.
-
#cross(other) ⇒ Geom::Vector3d
Cross product.
-
#dot(other) ⇒ Numeric
Dot product.
-
#inspect ⇒ String
Debug string.
-
#length= ⇒ Numeric, Length
Keep the direction but change the length.
-
#normalize ⇒ Geom::Vector3d
Returns the unit vector, without modifying self.
-
#normalize! ⇒ Geom::Vector3d
Makes the vector a unit vector in place.
-
#parallel?(other) ⇒ Boolean
Checks if the vectors are parallel within a tolerance.
-
#perpendicular?(other) ⇒ Boolean
Checks if the vectors are perpendicular (within tolerance).
-
#reverse ⇒ Geom::Vector3d
Reverse, returns a new vector.
-
#reverse! ⇒ Geom::Vector3d
Reverses the vector in place.
-
#samedirection?(other) ⇒ Boolean
Returns true if the vectors are parallel and in the same direction.
-
#set!(x, y, z) ⇒ Geom::Vector3d
Sets the components.
-
#unitvector? ⇒ Boolean
Is the length within the tolerance of 1.0.
-
#valid? ⇒ Boolean
Returns true if the vector is non-zero.
-
#transform!(transformation) ⇒ Geom::Vector3d
Applies the 3×3 transformation part of the transform to the vector in place.
-
#transform(transformation) ⇒ Geom::Vector3d
Applies the 3×3 part of the transformation to the vector and returns the new vector.
Class Method Details
Vector3d.new ⇒ vectorVector3d.new(x, y, z) ⇒ vectorVector3d.new(x, y) ⇒ vectorVector3d.new([x, y, z]) ⇒ vectorVector3d.new([x, y]) ⇒ vectorVector3d.new(vector) ⇒ vector
Construct a vector. With no parameters, it initializes to the zero vector; with two components, the Z component is 0. Bare numbers are interpreted in inches; alternatively, a Length can be passed.
Vector3d.linear_combination(weight1, vector1, weight2, vector2) ⇒ Geom::Vector3dVector3d.linear_combination(x, xaxis, y, yaxis, z, zaxis) ⇒ Geom::Vector3d
Linear combination of two vectors, or a linear combination along three axes.
Instance Method Details
vector.x ⇒ Float
X component, inches Float. Unlike Geom::Point3d#x Length.
vector.y ⇒ Float
Y component, inches Float.
vector.z ⇒ Float
Z component, inches Float.
vector.to_a ⇒ Array(Float, Float, Float)
Convert to [x, y, z], where x, y, and z are floats, consistent with Geom::Point3d#to_a.
vector.to_s ⇒ String
(x, y, z).
vector.length ⇒ Length
Vector length, returns Length.
vector == other ⇒ Boolean
Compare components with another vector, point, or [x, y, z].
vector % other ⇒ Numeric
Dot product.
vector * other ⇒ Geom::Vector3d
takes the cross product with another vector; multiplies by a Numeric value.
vector + other ⇒ Geom::Vector3d
Adds two vectors.
vector - other ⇒ Geom::Vector3d
Subtracts one vector from another.
vector < other ⇒ Boolean
Compare by length.
vector[index] ⇒ Float
Return the component at the specified index as a Float.
vector[index] = value ⇒ value
Set the components by index.
vector.x = value ⇒ value
Set the X component.
vector.y = value ⇒ value
Set the Y component.
vector.z = value ⇒ value
Set the Z component.
vector.angle_between(other) ⇒ Numeric
The angle between another vector, in radians.
vector.axes ⇒ Array(Geom::Vector3d, Geom::Vector3d, Geom::Vector3d)
Construct a set of orthogonal axes [x, y, z] with the vector as the Z axis.
vector.clone ⇒ Geom::Vector3d
Clones a vector.
vector.cross(other) ⇒ Geom::Vector3d
Cross product.
vector.dot(other) ⇒ Numeric
Dot product.
vector.inspect ⇒ String
Debug string.
vector.length = length ⇒ length
Keep the direction but change the length.
vector.normalize ⇒ Geom::Vector3d
Returns the unit vector, without modifying self.
vector.normalize! ⇒ self
Makes the vector a unit vector in place.
vector.parallel?(other) ⇒ Boolean
Checks if the vectors are parallel within a tolerance.
vector.perpendicular?(other) ⇒ Boolean
Checks if the vectors are perpendicular (within tolerance).
vector.reverse ⇒ Geom::Vector3d
Reverse, returns a new vector.
vector.reverse! ⇒ self
Reverses the vector in place.
vector.samedirection?(other) ⇒ Boolean
Returns true if the vectors are parallel and in the same direction.
vector.set!(x, y, z) ⇒ selfvector.set!(vector) ⇒ selfvector.set!(array) ⇒ self
Sets the components.
vector.unitvector? ⇒ Boolean
Is the length within the tolerance of 1.0.
vector.valid? ⇒ Boolean
Returns true if the vector is non-zero.
vector.transform!(transformation) ⇒ self
Applies the 3×3 transformation part of the transform to the vector in place.
vector.transform(transformation) ⇒ Geom::Vector3d
Applies the 3×3 part of the transformation to the vector and returns the new vector.