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 ベクタ関数

参考

Vec2, Vec4, Xfo

/*
** Example: Vec3
*/

Vec3 v(0.0, 0.0, 0.0);

Vec3 Vec3 Vec3

Members

Scalar x  
Scalar y  
Scalar z  

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 )

Operators

  - Vec3
Vec3 = ( Param other )

Methods in detail

Vec3 ( in Color c )

Constructor from a Color


Vec3 ( in Scalar value )

Constructor with same scalar for all components


Vec3 ( in Scalar x, in Scalar y, in Scalar z )

Constructor from scalar components


Vec3 ( in Vec3 other )

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


Vec3 Vec3.clone? ()

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


Vec3.get? ( io Float32 v<> )

Getter to (standard/external) float32 array


Vec3.get? ( io Float32 v<>, in UInt32 o )

Getter as external float32 array and an offset


Vec3.get? ( io Float32 v[] )

Getter as float32 array


Vec3.get? ( io Float32 v[], in UInt32 o )

Getter as float32 array and an offset


Vec3.get? ( io Float64 v<> )

Getter to (standard/external) float64 array


Vec3.get? ( io Float64 v<>, in UInt32 o )

Getter as external float64 array and an offset


Vec3.get? ( io Float64 v[] )

Getter as float64 array


Vec3.get? ( io Float64 v[], in UInt32 o )

Getter as float64 array and an offset


UInt32 Vec3.hash? ()

Hash for this value


Vec3 Vec3.inverse? ()

Returns the inversed version of this vector


Scalar Vec3.length? ()

Returns the length of this vector


Scalar Vec3.lengthSquared? ()

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


Vec3 Vec3.negate? ()

Returns the negated version of this vector


Vec3.normalize! ()


Vec3 Vec3.safeInverse? ()

Returns the inversed version of this vector by correcting bad components.


Vec3.set! ( in Float32 v<> )

Setter from (standard/external) float32 array


Vec3.set! ( in Float32 v<>, in UInt32 o )

Setter from (standard/external) float32 array and an offset


Vec3.set! ( in Float64 v<> )

Setter from (standard/external) float64 array


Vec3.set! ( in Float64 v<>, in UInt32 o )

Setter from (standard/external) float64 array and an offset


Vec3.set! ( in Scalar value )

Setter from same scalar for all components


Vec3.set! ( in Scalar x, in Scalar y, in Scalar z )

Setter from scalar components


Vec3.set! ( in Vec3 v )

Setter from another vector


Vec3.set! ( in Vec3_d v )

Setter from another vector


Vec3.set! ( in Vec3_i v )

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


Scalar Vec3.setUnit! ()

Sets this vector to its unit vector and returns its previous length


Vec3 Vec3.subtract? ( in Vec3 other )

Overload method for the subtract operator


Vec3 Vec3.unit? ()

Returns the unit vector of this one, throws and exception if almost zero length


Vec3 Vec3.unit_safe? ()

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)

Operators in detail

unary -


Vec3 = ( Param other )

Adds a vector to this one