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

参考

Vec2, Vec3

/*
** Example: Vec4
*/

Vec4 v(0.0, 0.0, 0.0, 0.0);

Vec4 Vec4 Vec4

Members

Scalar x  
Scalar y  
Scalar z  
Scalar t  

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 ? ()

Operators

Vec4 = ( Param other )

Methods in detail

Vec4 ( in Color c )

Constructor from a Color


Vec4 ( in Scalar value )

Constructor with same scalar for all components


Vec4 ( in Scalar x, in Scalar y, in Scalar z, in Scalar t )

Constructor from scalar components


Vec4 ( in Vec4 other )

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


Vec4 Vec4.clone? ()

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


Vec4.get? ( io Float32 v<> )

Getter as external float32 array


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

Getter as external float32 array and an offset


Vec4.get? ( io Float32 v[] )

Getter as float32 array


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

Getter as float32 array and an offset


Vec4.get? ( io Float64 v<> )

Getter as external float64 array


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

Getter as external float64 array and an offset


Vec4.get? ( io Float64 v[] )

Getter as float64 array


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

Getter as float64 array and an offset


UInt32 Vec4.hash? ()

Hash for this value


Vec4 Vec4.inverse? ()

Returns the inversed version of this vector


Scalar Vec4.length? ()

Returns the length of this vector


Scalar Vec4.lengthSquared? ()

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


Vec4 Vec4.negate? ()

Returns the negated version of this vector


Vec4.normalize! ()


Vec4.set! ( in Float32 v<> )

Setter from (standard/external) float32 array


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

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


Vec4.set! ( in Float64 v<> )

Setter from (standard/external) float64 array


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

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


Vec4.set! ( in Scalar value )

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


Vec4.set! ( in Vec3 v )

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


Scalar Vec4.setUnit! ()

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


Vec4 Vec4.subtract? ( in Vec4 other )

Overload method for the subtract operator


Vec3 Vec4.toVec3? ()

Returns the X, Y and Z components as Vec3


Vec4 Vec4.unit? ()

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)


Vec3 Vec4.xyz? ()

Returns a Vec3 containing the X, Y and Z components.

Operators in detail

Vec4 = ( Param other )

Adds a vector to this one