Vec2_cd (struct)

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

参考

Vec3, Vec4

/*
** Example: Vec2_cd
*/

Vec2_cd v(0.0, 0.0);

Vec2_cd Vec2_cd Vec2_cd

Members

Complex_d x  
Complex_d y  

Methods

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

Operators

  - Vec2_cd
Vec2_cd = ( Param other )

Methods in detail

Vec2_cd ( in Complex_d value )

Constructor with same scalar for all components


Vec2_cd ( in Complex_d x, in Complex_d y )

Constructor from scalar components


Vec2_cd ( in Vec2_cd other )

copy constructor


Vec2_cd ()

Default constructor


Vec2_cd Vec2_cd.add? ( in Vec2_cd other )

Overload method for the add operator


Boolean Vec2_cd.almostEqual? ( in Vec2_cd other )

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


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

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


Vec2_cd Vec2_cd.clone? ()

clone method


Complex_d Vec2_cd.component? ( in Size i )

Returns the component of this vector by index


Complex_d Vec2_cd.cross? ( in Vec2_cd other )

Returns the cross product of this vector and another one


Complex_d Vec2_cd.distanceTo? ( in Vec2_cd other )

Returns the distance of this vector to another one


Vec2_cd Vec2_cd.divide? ( in Vec2_cd other )

Overload method for the divide operator


Vec2_cd Vec2_cd.divideComplex_d? ( in Complex_d other )

Returns the division of this vector and a scalar


Complex_d Vec2_cd.dot? ( in Vec2_cd other )

Returns the dot product of this vector and another one


Boolean Vec2_cd.equal? ( in Vec2_cd other )

Returns true if this vector is the same as another one


UInt32 Vec2_cd.hash? ()

Hash for this value


Vec2_cd Vec2_cd.inverse? ()

Returns the inversed version of this vector


Complex_d Vec2_cd.length? ()

Returns the length of this vector


Complex_d Vec2_cd.lengthSquared? ()

Returns the squared length of this vector


Vec2_cd Vec2_cd.linearInterpolate? ( in Vec2_cd other, in Complex_d t )

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


Vec2_cd Vec2_cd.multiply? ( in Vec2_cd other )

Overload method for the multiply operator


Vec2_cd Vec2_cd.multiplyComplex_d? ( in Complex_d other )

Returns the product of this vector and a scalar


Vec2_cd Vec2_cd.negate? ()

Returns the negated version of this vector


Vec2_cd.normalize! ()


Vec2_cd.set! ( in Complex_d value )

Setter from same scalar for all components


Vec2_cd.set! ( in Complex_d x, in Complex_d y )

Setter from scalar components


Vec2_cd.setComponent! ( in Size i, in Complex_d v )

Sets the component of this vector by index


Vec2_cd.setNull! ()

Sets all components of this vec to 0.0


Complex_d Vec2_cd.setUnit! ()

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


Vec2_cd Vec2_cd.subtract? ( in Vec2_cd other )

Overload method for the subtract operator


Vec2_cd Vec2_cd.unit? ()

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


Vec2_cd Vec2_cd.unit_safe? ()

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

Operators in detail

unary -


Vec2_cd = ( Param other )

Adds a vector to this one