This is the Math::Vector class.
Represents a vector of any dimension.
$v = Vector()
Creates a vector with the given components.
- optional items: Num... Variable number of arguments.
$v.dimension
Computed property. Dimension of the vector.
$v.dimensionHR
Computed property. Human-readable dimension of the vector.
$v.magnitude
Computed property. Magnitude of the vector.
$v.unitVector
Computed property. Unit vector in the direction of this vector.
$v.axisUnitVector($axis: VectorAxis)
Returns the unit vector in the direction of the given axis.
- axis: VectorAxis - Axis number or letter, starting at 1 or "i".
$v.x
Computed property. For a >=1D vector, the first comonent.
$v.y
Computed property. For a >=2D vector, the second component.
$v.z
Computed property. For a >=3D vector, the third component.
$v.direction
Computed property. For a 2D vector, its direction, measured in radians.
$v + ($ehs: Vector)
Addition of two vectors.
$v - ($lhs: Num)
Allows you to take the opposite vector -$u
.
$v - ($rhs: Vector)
Subtraction of a vector from another.
$v * ($ehs: Num)
Scalar multiplication of the vector.
$v / ($rhs: Num)
Scalar division of the vector.
$v * ($ehs: Vector)
Dot product of two vectors.
$v == ($ehs: Vector)
Vector equality.
$v.dot($ehs: Vector)
Dot product of this vector and another of the same dimension.
- ehs: Vector
$v.cross($ehs: Vector)
Cross product of two 3D vectors.
- ehs: Vector
$v.angleBetween($ehs: Vector)
Angle between this vector and another of the same dimension, measured in radians.
- ehs: Vector
$v.orthogonalTo($ehs: Vector)
True if this vector is orthogonal to another of the same dimension.
- ehs: Vector
$v.parallelTo($ehs: Vector)
True if this vector is parallel to another of the same dimension.
- ehs: Vector
$v.getValue($index: Num)
Fetches the component at the given index. Allows Vector to conform to
IndexedRead such that $vector[N]
is the N+1th component.
- index: Num
$v.copy()
Returns a copy of the vector.
Vector.zeroVector($dimension: Num)
Returns the zero vector in the given dimension.
- dimension: Num
Vector.axisUnitVector($dimension: Num, $axis: VectorAxis)
Returns the unit vector for the given dimension and axis.
-
dimension: Num
-
axis: VectorAxis - Axis number or letter, starting at 1 or "i".
An interface which accepts an axis letter starting at "i" or number starting at 1. For instance, a 3D vector is represented by axes i, j, and k, which correspond to the numbers 1, 2, and 3, respectively.
In order to comply, the object must satisfy the following condition.
- transform: Converts letters starting at 'i' to axis numbers.
End of the Math::Vector class.
This file was generated automatically by the Ferret compiler from Vector.frt.