Vec2.kl¶
Types¶
Vec2 (struct)¶
The Vec2 type represents a vector with 2 components. The Vec2 is also used as the row type for the Mat22.
/*
** Example: Vec2
*/
Vec2 v(0.0, 0.0);
Methods¶
Vec2 ( in Scalar value ) | |
Vec2 ( in Scalar x, in Scalar y ) | |
Vec2 ( in Vec2 other ) | |
Vec2 () | |
Vec2 | add ? ( in Vec2 other ) |
Boolean | almostEqual ? ( in Vec2 other ) |
Boolean | almostEqual ? ( in Vec2 other, in Scalar precision ) |
Scalar | angleTo ? ( in Vec2 other ) |
Vec2 | clamp ? ( in Vec2 min, in Vec2 max ) |
Vec2 | clone ? () |
Scalar | component ? ( in Size i ) |
Scalar | cross ? ( in Vec2 other ) |
Scalar | distanceTo ? ( in Vec2 other ) |
Scalar | distanceToLine ? ( in Vec2 lineP0, in Vec2 lineP1 ) |
Scalar | distanceToSegment ? ( in Vec2 segmentP0, in Vec2 segmentP1 ) |
Vec2 | divide ? ( in Vec2 other ) |
Vec2 | divideScalar ? ( in Scalar other ) |
Scalar | dot ? ( in Vec2 other ) |
Boolean | equal ? ( in Vec2 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 ) | |
Vec2 | getBarycentricCoords ? ( in Vec2 a, in Vec2 b, in Vec2 c ) |
UInt32 | hash ? () |
Vec2 | inverse ? () |
Boolean | isInsideTriangle ? ( in Vec2 a, in Vec2 b, in Vec2 c ) |
Boolean | isInsideTriangle ? ( in Vec2 a, in Vec2 b, in Vec2 c, in Scalar tolerance ) |
Scalar | length ? () |
Scalar | lengthSquared ? () |
Vec2 | linearInterpolate ? ( in Vec2 other, in Scalar t ) |
Vec2 | multiply ? ( in Vec2 other ) |
Vec2 | multiplyScalar ? ( in Scalar other ) |
Vec2 | negate ? () |
normalize ! () | |
Vec2 | rotate ? ( in Scalar radians ) |
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 ) | |
setComponent ! ( in Size i, in Scalar v ) | |
setNull ! () | |
Scalar | setUnit ! () |
Vec2 | subtract ? ( in Vec2 other ) |
Vec2 | unit ? () |
Vec2 | unit_safe ? () |
Scalar | unitsAngleTo ? ( in Vec2 other ) |
Functions¶
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
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