Vec3.kl

Types

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);

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 )

Functions

closestPointToLineRatio

Scalar closestPointToLineRatio ( in Vec3 P, in Vec3 lineP0, in Vec3 lineP1 )

Returns the line ratio for the closest line location from point P

distFromPointToLine

Scalar distFromPointToLine ( in Vec3 P, in Vec3 lineP0, in Vec3 lineP1 )

Returns the distance of this vector to a line defined by two points on the line

closestSegmentPoint

Vec3 closestSegmentPoint ( in Vec3 P, in Vec3 segmentP0, in Vec3 segmentP1, out Scalar ratio )

Returns the closest point this position to a line segment defined by the start and end points

distFromPointToSegment

Scalar distFromPointToSegment ( in Vec3 P, in Vec3 segmentP0, in Vec3 segmentP1 )

Returns the distance of this position to a line segment defined by the start and end points

distanceFromLineToLine

Float64 distanceFromLineToLine ( in Vec2_d l1_p0, in Vec2_d l1_p1, in Vec2_d l2_p0, in Vec2_d l2_p1, out Float64 l1_t, out Float64 l2_t )

dist3D_Line_to_Line(): Input: two 3D lines L1 and L2 Return: the shortest distance between L1 and L2

testCoplanarity

Boolean testCoplanarity ( in Vec3 x1, in Vec3 x2, in Vec3 x3, in Vec3 x4, in Vec3 v1, in Vec3 v2, in Vec3 v3, in Vec3 v4, out Scalar outFraction )

Coplanarity test for 4 moving points. These moving points could either be a point and a triangle, or 2 edges. The returned fraction tells us if they will be coplanar within the next time step. This algorithm is used to compute continuous collision between points and triangle, or between moving lines. Algorithm based on the following paper. http://wscg.zcu.cz/wscg2007/Papers_2007/journal/D11-full.pdf

x1 The first points position
x2 The second points position
x3 The third points position
x4 The fourth points position
v1 The first points displacement over a the given time step
v2 The second points displacement over a the given time step
v3 The third points displacement over a the given time step
v4 The fourth points displacement over a the given time step
outFraction The return value containing the fraction of the timestep where all 4 points became coplanar.

Math_min

RGBA Math_min ( in RGBA val1, in RGBA val2 )

Returns the minimum of two RGBA values

Math_max

RGBA Math_max ( in RGBA val1, in RGBA val2 )

Returns the minimum of two RGBA values

Math_clamp

Vec3_i Math_clamp ( in Vec3_i val, in Scalar minval, in Scalar maxval )

Clamps a Vec3_i value by min and max

mathRandomVec3

Vec3 mathRandomVec3 ( in Size seed, in Size index, in Float32 min, in Float32 max )