Vec4 (struct)¶
The Vec4 type represents a vector with 4 components. The Vec4 is also used as the row type for the Mat44.
注釈
Vec4 utilizes the KL ベクタ関数
/*
** Example: Vec4
*/
Vec4 v(0.0, 0.0, 0.0, 0.0);
Methods¶
Vec4 ( in Color c ) | |
Vec4 ( in Scalar value ) | |
Vec4 ( in Scalar x, in Scalar y, in Scalar z, in Scalar t ) | |
Vec4 ( in Vec4 other ) | |
Vec4 () | |
Vec4 | add ? ( in Vec4 other ) |
Boolean | almostEqual ? ( in Vec4 other ) |
Boolean | almostEqual ? ( in Vec4 other, in Scalar precision ) |
Scalar | angleTo ? ( in Vec4 other ) |
Vec4 | clamp ? ( in Vec4 min, in Vec4 max ) |
Vec4 | clone ? () |
Scalar | component ? ( in Size i ) |
Scalar | distanceTo ? ( in Vec4 other ) |
Vec4 | divide ? ( in Vec4 other ) |
Vec4 | divideScalar ? ( in Scalar other ) |
Scalar | dot ? ( in Vec4 other ) |
Boolean | equal ? ( in Vec4 other ) |
get ? ( io Float32 v<> ) | |
get ? ( io Float32 v<>, in UInt32 o ) | |
get ? ( io Float32 v[] ) | |
get ? ( io Float32 v[], in UInt32 o ) | |
get ? ( io Float64 v<> ) | |
get ? ( io Float64 v<>, in UInt32 o ) | |
get ? ( io Float64 v[] ) | |
get ? ( io Float64 v[], in UInt32 o ) | |
UInt32 | hash ? () |
Vec4 | inverse ? () |
Scalar | length ? () |
Scalar | lengthSquared ? () |
Vec4 | linearInterpolate ? ( in Vec4 other, in Scalar t ) |
Vec3 | makeHomogeneousVec3 ? () |
Vec4 | multiply ? ( in Vec4 other ) |
Vec4 | multiplyScalar ? ( in Scalar other ) |
Vec4 | negate ? () |
normalize ! () | |
set ! ( in Float32 v<> ) | |
set ! ( in Float32 v<>, in UInt32 o ) | |
set ! ( in Float64 v<> ) | |
set ! ( in Float64 v<>, in UInt32 o ) | |
set ! ( in Scalar value ) | |
set ! ( in Scalar x, in Scalar y, in Scalar z, in Scalar t ) | |
set ! ( in Vec3 v ) | |
setComponent ! ( in Size i, in Scalar v ) | |
setNull ! () | |
Scalar | setUnit ! () |
Vec4 | subtract ? ( in Vec4 other ) |
Vec3 | toVec3 ? () |
Vec4 | unit ? () |
Scalar | unitsAngleTo ? ( in Vec4 other ) |
Vec3 | xyz ? () |
Methods in detail¶
Constructor from a Color
Constructor with same scalar for all components
Vec4 ( in Scalar x, in Scalar y, in Scalar z, in Scalar t )
Constructor from scalar components
copy constructor
Vec4 ()
Default constructor
Vec4 Vec4.add? ( in Vec4 other )
Overload method for the add operator
Boolean Vec4.almostEqual? ( in Vec4 other )
Returns true if this vector is the same as another one (using a default precision)
Boolean Vec4.almostEqual? ( in Vec4 other, in Scalar precision )
Returns true if this vector is the same as another one (given a precision)
Scalar Vec4.angleTo? ( in Vec4 other )
Returns the angle (in radians) of this vector to the given vector
Vec4 Vec4.clamp? ( in Vec4 min, in Vec4 max )
clamps this vector per component by a min and max vector
clone method
Scalar Vec4.component? ( in Size i )
Returns the component of this vector by index
Scalar Vec4.distanceTo? ( in Vec4 other )
Returns the distance of this vector to the given vector
Vec4 Vec4.divide? ( in Vec4 other )
Overload method for the divide operator
Vec4 Vec4.divideScalar? ( in Scalar other )
Returns the division of this vector and a scalar
Scalar Vec4.dot? ( in Vec4 other )
Returns the dot product of this vector and another one
Boolean Vec4.equal? ( in Vec4 other )
Returns true if this vector is the same as another one
Getter as external float32 array
Vec4.get? ( io Float32 v<>, in UInt32 o )
Getter as external float32 array and an offset
Getter as float32 array
Vec4.get? ( io Float32 v[], in UInt32 o )
Getter as float32 array and an offset
Getter as external float64 array
Vec4.get? ( io Float64 v<>, in UInt32 o )
Getter as external float64 array and an offset
Getter as float64 array
Vec4.get? ( io Float64 v[], in UInt32 o )
Getter as float64 array and an offset
Hash for this value
Returns the inversed version of this vector
Returns the length of this vector
Returns the squared length of this vector
Vec4 Vec4.linearInterpolate? ( in Vec4 other, in Scalar t )
Linearly interpolates this vector with the given vector based on a scalar blend value (0.0 to 1.0)
Vec3 Vec4.makeHomogeneousVec3? ()
Returns a homogeneous Vec3
Vec4 Vec4.multiply? ( in Vec4 other )
Overload method for the multiply operator
Vec4 Vec4.multiplyScalar? ( in Scalar other )
Returns the product of this vector and a scalar
Returns the negated version of this vector
Vec4.normalize! ()
Setter from (standard/external) float32 array
Vec4.set! ( in Float32 v<>, in UInt32 o )
Setter from (standard/external) float32 array and an offset
Setter from (standard/external) float64 array
Vec4.set! ( in Float64 v<>, in UInt32 o )
Setter from (standard/external) float64 array and an offset
Setter from same scalar for all components
Vec4.set! ( in Scalar x, in Scalar y, in Scalar z, in Scalar t )
Setter from scalar components
Setter from a Vec3 (t = 1.0)
Vec4.setComponent! ( in Size i, in Scalar v )
Sets the component of this vector by index
Vec4.setNull! ()
Sets all components of this vec to 0.0
Sets this vector to its unit vector and returns its previous length
Vec4 Vec4.subtract? ( in Vec4 other )
Overload method for the subtract operator
Returns the X, Y and Z components as Vec3
Returns the unit vector of this one
Scalar Vec4.unitsAngleTo? ( in Vec4 other )
Returns the angle (in radians) of this vector to the given vector
注釈
expects both vectors to be units (else use angleTo)
Returns a Vec3 containing the X, Y and Z components.