Vec2_d (struct)

The Vec2_d type represents a vector with 2 components. The Vec2_d is also used as the row type for the Mat22.

参考

Vec3, Vec4

/*
** Example: Vec2_d
*/

Vec2_d v(0.0, 0.0);

Vec2_d Vec2_d Vec2_d

Members

Float64 x  
Float64 y  

Methods

  Vec2_d ( in Float64 value )
  Vec2_d ( in Float64 x, in Float64 y )
  Vec2_d ( in Vec2_d other )
  Vec2_d ()
Vec2_d add ? ( in Vec2_d other )
Boolean almostEqual ? ( in Vec2_d other )
Boolean almostEqual ? ( in Vec2_d other, in Float64 precision )
Float64 angleTo ? ( in Vec2_d other )
Vec2_d clamp ? ( in Vec2_d min, in Vec2_d max )
Vec2_d clone ? ()
Float64 component ? ( in Size i )
Float64 cross ? ( in Vec2_d other )
Float64 distanceTo ? ( in Vec2_d other )
Float64 distanceToLine ? ( in Vec2_d lineP0, in Vec2_d lineP1 )
Float64 distanceToSegment ? ( in Vec2_d segmentP0, in Vec2_d segmentP1 )
Vec2_d divide ? ( in Vec2_d other )
Vec2_d divideFloat64 ? ( in Float64 other )
Float64 dot ? ( in Vec2_d other )
Boolean equal ? ( in Vec2_d 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_d getBarycentricCoords ? ( in Vec2_d a, in Vec2_d b, in Vec2_d c )
UInt32 hash ? ()
Vec2_d inverse ? ()
Boolean isInsideTriangle ? ( in Vec2_d a, in Vec2_d b, in Vec2_d c )
Boolean isInsideTriangle ? ( in Vec2_d a, in Vec2_d b, in Vec2_d c, in Float64 tolerance )
Float64 length ? ()
Float64 lengthSquared ? ()
Vec2_d linearInterpolate ? ( in Vec2_d other, in Float64 t )
Vec2_d multiply ? ( in Vec2_d other )
Vec2_d multiplyFloat64 ? ( in Float64 other )
Vec2_d negate ? ()
  normalize ! ()
Vec2_d rotate ? ( in Float64 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 Float64 value )
  set ! ( in Float64 x, in Float64 y )
  setComponent ! ( in Size i, in Float64 v )
  setNull ! ()
Float64 setUnit ! ()
Vec2_d subtract ? ( in Vec2_d other )
Vec2_d unit ? ()
Vec2_d unit_safe ? ()
Float64 unitsAngleTo ? ( in Vec2_d other )

Operators

  - Vec2_d
Vec2_d = ( Param other )

Methods in detail

Vec2_d ( in Float64 value )

Constructor with same scalar for all components


Vec2_d ( in Float64 x, in Float64 y )

Constructor from scalar components


Vec2_d ( in Vec2_d other )

copy constructor


Vec2_d ()

Default constructor


Vec2_d Vec2_d.add? ( in Vec2_d other )

Overload method for the add operator


Boolean Vec2_d.almostEqual? ( in Vec2_d other )

Returns true if this vector is the same as another one (using a default precision)


Boolean Vec2_d.almostEqual? ( in Vec2_d other, in Float64 precision )

Returns true if this vector is the same as another one (given a precision)


Float64 Vec2_d.angleTo? ( in Vec2_d other )

Returns the angle (in radians) of this vector to another one


Vec2_d Vec2_d.clamp? ( in Vec2_d min, in Vec2_d max )

clamps this vector per component by a min and max vector


Vec2_d Vec2_d.clone? ()

clone method


Float64 Vec2_d.component? ( in Size i )

Returns the component of this vector by index


Float64 Vec2_d.cross? ( in Vec2_d other )

Returns the cross product of this vector and another one


Float64 Vec2_d.distanceTo? ( in Vec2_d other )

Returns the distance of this vector to another one


Float64 Vec2_d.distanceToLine? ( in Vec2_d lineP0, in Vec2_d lineP1 )

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


Float64 Vec2_d.distanceToSegment? ( in Vec2_d segmentP0, in Vec2_d segmentP1 )

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


Vec2_d Vec2_d.divide? ( in Vec2_d other )

Overload method for the divide operator


Vec2_d Vec2_d.divideFloat64? ( in Float64 other )

Returns the division of this vector and a scalar


Float64 Vec2_d.dot? ( in Vec2_d other )

Returns the dot product of this vector and another one


Boolean Vec2_d.equal? ( in Vec2_d other )

Returns true if this vector is the same as another one


Vec2_d.get? ( io Float32 v<> )

Getter as external float32 array


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

Getter as external float32 array and an offset


Vec2_d.get? ( io Float32 v[] )

Getter as float32 array


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

Getter as float32 array and an offset


Vec2_d.get? ( io Float64 v<> )

Getter as external float64 array


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

Getter as external float64 array and an offset


Vec2_d.get? ( io Float64 v[] )

Getter as float64 array


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

Getter as float64 array and an offset


Vec2_d Vec2_d.getBarycentricCoords? ( in Vec2_d a, in Vec2_d b, in Vec2_d c )

Returns the barycentric coordinates of this vector in the triangle formed by a, b and c


UInt32 Vec2_d.hash? ()

Hash for this value


Vec2_d Vec2_d.inverse? ()

Returns the inversed version of this vector


Boolean Vec2_d.isInsideTriangle? ( in Vec2_d a, in Vec2_d b, in Vec2_d c )

Returns true if this Vec2 is inside of a triangle formed by a, b and c


Boolean Vec2_d.isInsideTriangle? ( in Vec2_d a, in Vec2_d b, in Vec2_d c, in Float64 tolerance )

Returns true if this Vec2 is inside of a triangle and has a minimum distance defined by tolerance.


Float64 Vec2_d.length? ()

Returns the length of this vector


Float64 Vec2_d.lengthSquared? ()

Returns the squared length of this vector


Vec2_d Vec2_d.linearInterpolate? ( in Vec2_d other, in Float64 t )

Linearly interpolates this vector with another one based on a scalar blend value (0.0 to 1.0)


Vec2_d Vec2_d.multiply? ( in Vec2_d other )

Overload method for the multiply operator


Vec2_d Vec2_d.multiplyFloat64? ( in Float64 other )

Returns the product of this vector and a scalar


Vec2_d Vec2_d.negate? ()

Returns the negated version of this vector


Vec2_d.normalize! ()


Vec2_d Vec2_d.rotate? ( in Float64 radians )

Turns the vector provided a rotation in radians


Vec2_d.set! ( in Float32 v<> )

Setter from (standard/external) float32 array


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

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


Vec2_d.set! ( in Float64 v<> )

Setter from (standard/external) float64 array


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

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


Vec2_d.set! ( in Float64 value )

Setter from same scalar for all components


Vec2_d.set! ( in Float64 x, in Float64 y )

Setter from scalar components


Vec2_d.setComponent! ( in Size i, in Float64 v )

Sets the component of this vector by index


Vec2_d.setNull! ()

Sets all components of this vec to 0.0


Float64 Vec2_d.setUnit! ()

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


Vec2_d Vec2_d.subtract? ( in Vec2_d other )

Overload method for the subtract operator


Vec2_d Vec2_d.unit? ()

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


Vec2_d Vec2_d.unit_safe? ()

Returns the unit vector of this one, with an arbitrary value if almost zero length


Float64 Vec2_d.unitsAngleTo? ( in Vec2_d 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 -


Vec2_d = ( Param other )

Adds a vector to this one