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