Vec2_i (struct)¶
The Vec2_i type represents a vector with 2 components. The Vec2_i is also used as the row type for the Mat22.
/*
** Example: Vec2_i
*/
Vec2_i v(0.0, 0.0);
Methods¶
Vec2_i ( in SInt32 value ) | |
Vec2_i ( in SInt32 x, in SInt32 y ) | |
Vec2_i ( in Vec2_i other ) | |
Vec2_i () | |
Vec2_i | add ? ( in Vec2_i other ) |
Boolean | almostEqual ? ( in Vec2_i other ) |
Boolean | almostEqual ? ( in Vec2_i other, in SInt32 precision ) |
SInt32 | angleTo ? ( in Vec2_i other ) |
Vec2_i | clamp ? ( in Vec2_i min, in Vec2_i max ) |
Vec2_i | clone ? () |
SInt32 | component ? ( in Size i ) |
SInt32 | cross ? ( in Vec2_i other ) |
SInt32 | distanceTo ? ( in Vec2_i other ) |
SInt32 | distanceToLine ? ( in Vec2_i lineP0, in Vec2_i lineP1 ) |
SInt32 | distanceToSegment ? ( in Vec2_i segmentP0, in Vec2_i segmentP1 ) |
Vec2_i | divide ? ( in Vec2_i other ) |
Vec2_i | divideSInt32 ? ( in SInt32 other ) |
SInt32 | dot ? ( in Vec2_i other ) |
Boolean | equal ? ( in Vec2_i 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_i | getBarycentricCoords ? ( in Vec2_i a, in Vec2_i b, in Vec2_i c ) |
UInt32 | hash ? () |
Vec2_i | inverse ? () |
Boolean | isInsideTriangle ? ( in Vec2_i a, in Vec2_i b, in Vec2_i c ) |
Boolean | isInsideTriangle ? ( in Vec2_i a, in Vec2_i b, in Vec2_i c, in SInt32 tolerance ) |
SInt32 | length ? () |
SInt32 | lengthSquared ? () |
Vec2_i | linearInterpolate ? ( in Vec2_i other, in SInt32 t ) |
Vec2_i | multiply ? ( in Vec2_i other ) |
Vec2_i | multiplySInt32 ? ( in SInt32 other ) |
Vec2_i | negate ? () |
normalize ! () | |
Vec2_i | rotate ? ( in SInt32 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 SInt32 value ) | |
set ! ( in SInt32 x, in SInt32 y ) | |
setComponent ! ( in Size i, in SInt32 v ) | |
setNull ! () | |
SInt32 | setUnit ! () |
Vec2_i | subtract ? ( in Vec2_i other ) |
Vec2_i | unit ? () |
Vec2_i | unit_safe ? () |
SInt32 | unitsAngleTo ? ( in Vec2_i other ) |
Methods in detail¶
Constructor with same scalar for all components
Vec2_i ( in SInt32 x, in SInt32 y )
Constructor from scalar components
copy constructor
Vec2_i ()
Default constructor
Vec2_i Vec2_i.add? ( in Vec2_i other )
Overload method for the add operator
Boolean Vec2_i.almostEqual? ( in Vec2_i other )
Returns true if this vector is the same as another one (using a default precision)
Boolean Vec2_i.almostEqual? ( in Vec2_i other, in SInt32 precision )
Returns true if this vector is the same as another one (given a precision)
SInt32 Vec2_i.angleTo? ( in Vec2_i other )
Returns the angle (in radians) of this vector to another one
Vec2_i Vec2_i.clamp? ( in Vec2_i min, in Vec2_i max )
clamps this vector per component by a min and max vector
clone method
SInt32 Vec2_i.component? ( in Size i )
Returns the component of this vector by index
SInt32 Vec2_i.cross? ( in Vec2_i other )
Returns the cross product of this vector and another one
SInt32 Vec2_i.distanceTo? ( in Vec2_i other )
Returns the distance of this vector to another one
SInt32 Vec2_i.distanceToLine? ( in Vec2_i lineP0, in Vec2_i lineP1 )
Returns the distance of this vector to a line defined by two points on the line
SInt32 Vec2_i.distanceToSegment? ( in Vec2_i segmentP0, in Vec2_i segmentP1 )
Returns the distance of this vector to a line segment defined by the start and end points of the line segment
Vec2_i Vec2_i.divide? ( in Vec2_i other )
Overload method for the divide operator
Vec2_i Vec2_i.divideSInt32? ( in SInt32 other )
Returns the division of this vector and a scalar
SInt32 Vec2_i.dot? ( in Vec2_i other )
Returns the dot product of this vector and another one
Boolean Vec2_i.equal? ( in Vec2_i other )
Returns true if this vector is the same as another one
Vec2_i.get? ( io Float32 v<> )
Getter as external float32 array
Vec2_i.get? ( io Float32 v<>, in UInt32 o )
Getter as external float32 array and an offset
Vec2_i.get? ( io Float32 v[] )
Getter as float32 array
Vec2_i.get? ( io Float32 v[], in UInt32 o )
Getter as float32 array and an offset
Vec2_i.get? ( io Float64 v<> )
Getter as external float64 array
Vec2_i.get? ( io Float64 v<>, in UInt32 o )
Getter as external float64 array and an offset
Vec2_i.get? ( io Float64 v[] )
Getter as float64 array
Vec2_i.get? ( io Float64 v[], in UInt32 o )
Getter as float64 array and an offset
Vec2_i Vec2_i.getBarycentricCoords? ( in Vec2_i a, in Vec2_i b, in Vec2_i c )
Returns the barycentric coordinates of this vector in the triangle formed by a, b and c
Hash for this value
Returns the inversed version of this vector
Boolean Vec2_i.isInsideTriangle? ( in Vec2_i a, in Vec2_i b, in Vec2_i c )
Returns true if this Vec2 is inside of a triangle formed by a, b and c
Boolean Vec2_i.isInsideTriangle? ( in Vec2_i a, in Vec2_i b, in Vec2_i c, in SInt32 tolerance )
Returns true if this Vec2 is inside of a triangle and has a minimum distance defined by tolerance.
Returns the length of this vector
SInt32 Vec2_i.lengthSquared? ()
Returns the squared length of this vector
Vec2_i Vec2_i.linearInterpolate? ( in Vec2_i other, in SInt32 t )
Linearly interpolates this vector with another one based on a scalar blend value (0.0 to 1.0)
Vec2_i Vec2_i.multiply? ( in Vec2_i other )
Overload method for the multiply operator
Vec2_i Vec2_i.multiplySInt32? ( in SInt32 other )
Returns the product of this vector and a scalar
Returns the negated version of this vector
Vec2_i.normalize! ()
Vec2_i Vec2_i.rotate? ( in SInt32 radians )
Turns the vector provided a rotation in radians
Vec2_i.set! ( in Float32 v<> )
Setter from (standard/external) float32 array
Vec2_i.set! ( in Float32 v<>, in UInt32 o )
Setter from (standard/external) float32 array and an offset
Vec2_i.set! ( in Float64 v<> )
Setter from (standard/external) float64 array
Vec2_i.set! ( in Float64 v<>, in UInt32 o )
Setter from (standard/external) float64 array and an offset
Vec2_i.set! ( in SInt32 value )
Setter from same scalar for all components
Vec2_i.set! ( in SInt32 x, in SInt32 y )
Setter from scalar components
Vec2_i.setComponent! ( in Size i, in SInt32 v )
Sets the component of this vector by index
Vec2_i.setNull! ()
Sets all components of this vec to 0.0
Sets this vector to its unit vector and returns its previous length
Vec2_i Vec2_i.subtract? ( in Vec2_i 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
SInt32 Vec2_i.unitsAngleTo? ( in Vec2_i other )
Returns the angle (in radians) of this vector to another one
注釈
expects both vectors to be units (else use angleTo)