Vec (struct)

The Vec represents a dense vector.

/*
** Example: Vec
*/

// create a 7-element vector
Vec vec(7);

Vec Vec Vec

Members

Scalar[] vals  

Methods

  Vec ( in Integer size )
  Vec ( in Vec that )
  Vec ()
Boolean almostEqual ? ( in Vec other )
Boolean almostEqual ? ( in Vec that, in Scalar precision )
  appendDesc ? ( io String string )
Vec clamp ? ( in Vec min, in Vec max )
Vec clone ? ()
Scalar dot ? ( in Vec that )
Boolean equal ? ( in Vec that )
Scalar get ? ( in Integer ind )
UInt32 hash ? ()
Vec head ? ( in Integer n )
Scalar length ? ()
Scalar lengthSquared ? ()
Vec linearInterpolate ? ( in Vec that, in Scalar t )
  normalize ! ()
  resize ! ( in Integer newSize )
  set ! ( in Integer ind, in Scalar val )
  setAll ! ( in Scalar val )
  setNull ! ()
Scalar setUnit ! ()
Integer size ? ()
String sizeDesc ? ()
Vec sub ? ( in Integer s, in Integer e )
Vec unit ? ()
Integer validateSize ? ( in Vec that, in String desc )

Operators

  - Vec
Vec = ( Param other )

Methods in detail

Vec ( in Integer size )

Construct a vector with size elements


Vec ( in Vec that )

Construct a vector from the vector that


Vec ()

default constructor


Boolean Vec.almostEqual? ( in Vec other )

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


Boolean Vec.almostEqual? ( in Vec that, in Scalar precision )

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


Vec.appendDesc? ( io String string )

Append a String description of this vector’s size and contents to the io variable string


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

Clamps this vector per component by a min and max vector


Vec Vec.clone? ()

clone method


Scalar Vec.dot? ( in Vec that )


Boolean Vec.equal? ( in Vec that )

Returns true if this vector is the same as another one


Scalar Vec.get? ( in Integer ind )

Get value of the vector element at the ind position


UInt32 Vec.hash? ()

Hash for this matrix


Vec Vec.head? ( in Integer n )


Scalar Vec.length? ()

Return the length of the vector


Scalar Vec.lengthSquared? ()


Vec Vec.linearInterpolate? ( in Vec that, in Scalar t )

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


Vec.normalize! ()


Vec.resize! ( in Integer newSize )

Change the number of elements in the vector to newSize


Vec.set! ( in Integer ind, in Scalar val )

Set the value of element ind to val


Vec.setAll! ( in Scalar val )

Set the value of all vector elements to val


Vec.setNull! ()

Set the value of all vector elements to zero


Scalar Vec.setUnit! ()

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


Integer Vec.size? ()

Get the size of the vector


String Vec.sizeDesc? ()

Return a String description of this vector and its size


Vec Vec.sub? ( in Integer s, in Integer e )


Vec Vec.unit? ()

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


Integer Vec.validateSize? ( in Vec that, in String desc )

In Fabric guarded mode this method throws an exception if the size of the current vector differs from the size of the that vector

Operators in detail

unary -


Vec = ( Param other )

Add another matrix in place