Vec2_c (struct)

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

参考

Vec3, Vec4

/*
** Example: Vec2_c
*/

Vec2_c v(0.0, 0.0);

Vec2_c Vec2_c Vec2_c

Members

Complex x  
Complex y  

Methods

  Vec2_c ( in Complex value )
  Vec2_c ( in Complex x, in Complex y )
  Vec2_c ( in Vec2_c other )
  Vec2_c ()
Vec2_c add ? ( in Vec2_c other )
Boolean almostEqual ? ( in Vec2_c other )
Boolean almostEqual ? ( in Vec2_c other, in Float32 precision )
Vec2_c clone ? ()
Complex component ? ( in Size i )
Complex cross ? ( in Vec2_c other )
Complex distanceTo ? ( in Vec2_c other )
Vec2_c divide ? ( in Vec2_c other )
Vec2_c divideComplex ? ( in Complex other )
Complex dot ? ( in Vec2_c other )
Boolean equal ? ( in Vec2_c other )
UInt32 hash ? ()
Vec2_c inverse ? ()
Complex length ? ()
Complex lengthSquared ? ()
Vec2_c linearInterpolate ? ( in Vec2_c other, in Complex t )
Vec2_c multiply ? ( in Vec2_c other )
Vec2_c multiplyComplex ? ( in Complex other )
Vec2_c negate ? ()
  normalize ! ()
  set ! ( in Complex value )
  set ! ( in Complex x, in Complex y )
  setComponent ! ( in Size i, in Complex v )
  setNull ! ()
Complex setUnit ! ()
Vec2_c subtract ? ( in Vec2_c other )
Vec2_c unit ? ()
Vec2_c unit_safe ? ()

Operators

  - Vec2_c
Vec2_c = ( Param other )

Methods in detail

Vec2_c ( in Complex value )

Constructor with same scalar for all components


Vec2_c ( in Complex x, in Complex y )

Constructor from scalar components


Vec2_c ( in Vec2_c other )

copy constructor


Vec2_c ()

Default constructor


Vec2_c Vec2_c.add? ( in Vec2_c other )

Overload method for the add operator


Boolean Vec2_c.almostEqual? ( in Vec2_c other )

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


Boolean Vec2_c.almostEqual? ( in Vec2_c other, in Float32 precision )

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


Vec2_c Vec2_c.clone? ()

clone method


Complex Vec2_c.component? ( in Size i )

Returns the component of this vector by index


Complex Vec2_c.cross? ( in Vec2_c other )

Returns the cross product of this vector and another one


Complex Vec2_c.distanceTo? ( in Vec2_c other )

Returns the distance of this vector to another one


Vec2_c Vec2_c.divide? ( in Vec2_c other )

Overload method for the divide operator


Vec2_c Vec2_c.divideComplex? ( in Complex other )

Returns the division of this vector and a scalar


Complex Vec2_c.dot? ( in Vec2_c other )

Returns the dot product of this vector and another one


Boolean Vec2_c.equal? ( in Vec2_c other )

Returns true if this vector is the same as another one


UInt32 Vec2_c.hash? ()

Hash for this value


Vec2_c Vec2_c.inverse? ()

Returns the inversed version of this vector


Complex Vec2_c.length? ()

Returns the length of this vector


Complex Vec2_c.lengthSquared? ()

Returns the squared length of this vector


Vec2_c Vec2_c.linearInterpolate? ( in Vec2_c other, in Complex t )

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


Vec2_c Vec2_c.multiply? ( in Vec2_c other )

Overload method for the multiply operator


Vec2_c Vec2_c.multiplyComplex? ( in Complex other )

Returns the product of this vector and a scalar


Vec2_c Vec2_c.negate? ()

Returns the negated version of this vector


Vec2_c.normalize! ()


Vec2_c.set! ( in Complex value )

Setter from same scalar for all components


Vec2_c.set! ( in Complex x, in Complex y )

Setter from scalar components


Vec2_c.setComponent! ( in Size i, in Complex v )

Sets the component of this vector by index


Vec2_c.setNull! ()

Sets all components of this vec to 0.0


Complex Vec2_c.setUnit! ()

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


Vec2_c Vec2_c.subtract? ( in Vec2_c other )

Overload method for the subtract operator


Vec2_c Vec2_c.unit? ()

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


Vec2_c Vec2_c.unit_safe? ()

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

Operators in detail

unary -


Vec2_c = ( Param other )

Adds a vector to this one