vectΒΆ

class vect

A multidimensional packed float array.

Members

Constructors:

vect result create ( int size , int dimension ) Create a new vect of given size
vect result create ( int size , int dimension , float init ) Create a new vect of given size with initialisation
vect result create ( table value ) Create a new vect of size 1, initialised with the given value

Methods:

vect result barycentric ( vect input , a table ) Create a vect of interpolated vertices from the set of barycentric coordinates and the triplet of vertices
nil clear ( vect input ) Free the memory allocated by the vect
nil copy ( vect destination , vect source , int dest_start ) Copy data from source to destination at a given position
nil copy ( vect destination , vect source , int dest_start , int dest_stride , int src_start , int src_stride ) Copy data from source to destination from a position and a stride
nil copy ( vect destination , vect source ) Copy the whole data from source to destination
nil copy ( vect destination , vect source , int dest_start , int dest_stride ) Copy data from source to destination from a position and a stride
int result dimension ( vect input ) Return the dimension of the vect, in number of columns
float result get ( vect input , int row , int column ) Get a single float in the vect
point3 result get ( vect input , int row ) Get a whole row in the vect
vect result|nil pack ( vect source , vect mask ) Duplicate source vect but only keep values which respective mask is different from 0
nil set ( vect input , int row , float|table value ) Set a whole row in the vect
int result size ( vect input ) Return the size of the vect, in number of rows

Documentation

vect result barycentric ( vect input , a table )

Create a vect of interpolated vertices from the set of barycentric coordinates and the triplet of vertices

Arguments:

  • input a set of barycentric coordinates
  • table triplet of vertices to interpolate

Return:

  • result the interpolated vertices


nil clear ( vect input )

Free the memory allocated by the vect

When called, this method clears the memory taken by the vect is freed, and thus the vect cannot be used any more.
Arguments:

  • input the vect to clear


nil copy ( vect destination , vect source , int dest_start )

Copy data from source to destination at a given position

Arguments:

  • destination float array to copy into
  • source float array to copy from
  • dest_start start position to copy data into (1 indexed)


nil copy ( vect destination , vect source , int dest_start , int dest_stride , int src_start , int src_stride )

Copy data from source to destination from a position and a stride

Arguments:

  • destination float array to copy into
  • source float array to copy from
  • dest_start start destination position to copy data into (1 indexed)
  • dest_stride destination stride in number of rows to copy into
  • src_start start source position to copy data from (1 indexed)
  • src_stride source stride in number of rows to copy from


nil copy ( vect destination , vect source )

Copy the whole data from source to destination

Arguments:

  • destination float array to copy into
  • source float array to copy from


nil copy ( vect destination , vect source , int dest_start , int dest_stride )

Copy data from source to destination from a position and a stride

Arguments:

  • destination float array to copy into
  • source float array to copy from
  • dest_start start position to copy data into (1 indexed)
  • dest_stride destination stride in number of rows to copy


int result dimension ( vect input )

Return the dimension of the vect, in number of columns

Arguments:

  • input The vect to get the dimension

Return:

  • result the dimension of the vect


float result get ( vect input , int row , int column )

Get a single float in the vect

Arguments:

  • input the vect to get a row from
  • row the row of the vect to get
  • column the column of the vect to get

Return:

  • result the value extracted from the vect at row,column


point3 result get ( vect input , int row )

Get a whole row in the vect

Arguments:

  • input the vect to get a row from
  • row the row of the vect to get

Return:

  • result the value extracted from the vect, padded with zeroes if dimension is less than 3


vect result|nil pack ( vect source , vect mask )

Duplicate source vect but only keep values which respective mask is different from 0

Arguments:

  • source float array to pack
  • mask mask array

Return:

  • result|nil The resulting packed vect, or nil if mask is filled with 0


nil set ( vect input , int row , float|table value )

Set a whole row in the vect

Arguments:

  • input the vect to set
  • row the row of the vect to set
  • value the value to the in the vect


int result size ( vect input )

Return the size of the vect, in number of rows

Arguments:

  • input The vect to get the size

Return:

  • result the size of the vect