VCLib Documentation  6.12.2

2D->2D Polynomial

2D->2D Polynomial

Data Structures

struct  VCPolynom2D2D
 2D->2D Polynomial Representation More...
 

Functions

I32 vc_poly2d2d_allocate (VCPolynom2D2D *poly, I32 orderX, I32 orderY, I32 orderRestrictedIff1)
 Allocates memory for a VCPolynom2D2D structure. More...
 
void vc_poly2d2d_free (VCPolynom2D2D *poly)
 Frees a previously allocated VCPolynom2D2D structure. More...
 
I32 vc_poly2d2d_map (F64 xIn, F64 yIn, F64 *xOut, F64 *yOut, VCPolynom2D2D *poly)
 Calculates a result using a VCPolynom2D2D structure. More...
 
I32 vc_poly2d2d_copy (VCPolynom2D2D *polyFrom, VCPolynom2D2D *polyTo)
 Copies a VCPolynom2D2D structure. More...
 
void vc_poly2d2d_print (VCPolynom2D2D *poly, I32 indentation)
 Prints out a VCPolynom2D2D struct. More...
 
I32 vc_poly2d2d_load_and_allocate_from_ini (VCPolynom2D2D *poly, char *filename, I8 tiCompatibleIff1)
 Reads and allocates a VCPolynom2D2D struct from an INI file. More...
 
I32 vc_poly2d2d_store_as_ini (char *filename, VCPolynom2D2D *poly, I8 tiCompatibleIff1)
 Stores VCPolynom2D2D struct values as INI file. More...
 
I32 vc_poly2d2d_pow_to_idx (I32 *idx, I32 powX, I32 powY, VCPolynom2D2D *poly, I32 polyYIf1ElseX)
 Returns the index number of the coeffX or coeffY of specific powers. More...
 
I32 vc_poly2d2d_idx_to_pow (I32 *powX, I32 *powY, I32 idx, VCPolynom2D2D *poly, I32 polyYIf1ElseX)
 Returns the powers represented by the index of the coeffX or coeffY VCPolynom2D2D structure. More...
 
I32 vc_poly2d2d_total_cnt_coeff (I32 *cntCoeffX, I32 *cntCoeffY, VCPolynom2D2D *poly)
 Returns the number of values at the coeffX or coeffY array. More...
 

Detailed Description


Data Structure Documentation

◆ VCPolynom2D2D

struct VCPolynom2D2D

This struct represents a polynomial of order [N,M] defined as follows:

  • if 1 != orderRestrictedIff1:

    \begin{eqnarray*}\begin{array}{rccccccc} X(x,y) = & c_{00} x^{0} y^{0} &+& c_{01} x^{0} y^{1} &+& \dots &+& c_{0N} x^{0} y^{N} \\ + & c_{10} x^{1} y^{0} &+& c_{11} x^{1} y^{1} &+& \dots &+& c_{1N} x^{1} y^{N} \\ & \vdots & & \vdots & & \vdots && \vdots \\ + & c_{N0} x^{N} y^{0} &+& c_{N1} x^{N} y^{1} &+& \dots &+& c_{NN} x^{N} y^{N},\\ \\ Y(x,y) = & d_{00} x^{0} y^{0} &+& d_{01} x^{0} y^{1} &+& \dots &+& d_{0M} x^{0} y^{M} \\ + & d_{10} x^{1} y^{0} &+& d_{11} x^{1} y^{1} &+& \dots &+& d_{1M} x^{1} y^{M} \\ & \vdots & & \vdots & & \vdots && \vdots \\ + & d_{M0} x^{M} y^{0} &+& d_{M1} x^{M} y^{1} &+& \dots &+& d_{MM} x^{M} y^{M} \\ \end{array} \end{eqnarray*}

  • if 1 == orderRestrictedIff1, using $ A:= B-N$, $B:= ((N+1)*(N+2))/2$ and $ C:= D-M$, $D:= ((M+1)*(M+2))/2$ :

    \begin{eqnarray*}\begin{array}{rl} X(x,y) = & c_{0} x^{0} y^{0} \\ + & c_{1} x^{1} y^{0} + c_{2} x^{0} y^{1} \\ + & c_{3} x^{2} y^{0} + c_{4} x^{1} y^{1} + c_{5} x^{0} y^{2} \\ + & \dots \\ + & c_{A} x^{N} y^{0} + c_{A+1} x^{N-1} y^{1} + \dots + c_{B} x^{0} y^{N},\\ \\ Y(x,y) = & d_{0} x^{0} y^{0} \\ + & d_{1} x^{1} y^{0} + d_{2} x^{0} y^{1} \\ + & d_{3} x^{2} y^{0} + d_{4} x^{1} y^{1} + d_{5} x^{0} y^{2} \\ + & \dots \\ + & d_{C} x^{M} y^{0} + d_{C+1} x^{M-1} y^{1} + \dots + d_{D} x^{0} y^{M} \\ \end{array} \end{eqnarray*}

Due to numerical stability at the polynomial estimation, there may be transforms which are additionally done instead of inherently at the polynomial itself:

If the value of transformInIff1 is 1, the polynomials input values x and y are calculated from given xInput and yInput as pre-transform by the following formula:

\begin{eqnarray*}\begin{array}{rl} x &= (xInput - offsInX) / scaleInX \\ y &= (yInput - offsInY) / scaleInY \\ \end{array}\end{eqnarray*}

Likewise if the value of transformOutIff1 is 1, the polynomials output values X and Y are post-transformed to the result XOutput and YOutput by the following formula:

\begin{eqnarray*}\begin{array}{rl} XOutput &= (X * scaleXOut) + offsXOut \\ YOutput &= (Y * scaleYOut) + offsYOut \\ \end{array}\end{eqnarray*}

Data Fields
I32 orderRestrictedIff1

If 1, per coefficient sum of orders of x and y is smaller or equals orderX or orderY, see description.

I32 orderX

Maximum order in polynomial for calculating X(x,y).

I32 orderY

Maximum order in polynomial for calculating Y(x,y).

F64 * coeffX

Coefficients of polynomial for calculating X(x,y).

F64 * coeffY

Coefficients of polynomial for calculating Y(x,y).

I32 transformInIff1

If 1, prior to application of the input value to the polynomial it is transformed: in = (in - offsIn) / scaleIn.

F64 offsXIn

Offset for Input Value X Component.

F64 offsYIn

Offset for Input Value Y Component.

F64 scaleXIn

Scale Factor for Input Value X Component.

F64 scaleYIn

Scale Factor for Input Value Y Component.

I32 transformOutIff1

If 1, after mapping through the polynomial the output value is transformed: out = (out * scaleOut) + offsOut.

F64 offsXOut

Offset for Output Value X Component.

F64 offsYOut

Offset for Output Value Y Component.

F64 scaleXOut

Scale Factor for Output Value X Component.

F64 scaleYOut

Scale Factor for Output Value Y Component.

Function Documentation

◆ vc_poly2d2d_allocate()

I32 vc_poly2d2d_allocate ( VCPolynom2D2D poly,
I32  orderX,
I32  orderY,
I32  orderRestrictedIff1 
)

The function allocates memory for a VCPolynom2D2D structure.

Parameters
polyThe polynom struct with internals to be allocated.
orderX,orderYThe maximum order of the polynom $X(x,y)$ and $Y(x,y)$.
orderRestrictedIff1Selects which type of coefficients are available, see VCPolynom2D2D for an explanation.
Return values
ERR_NONEon Success.
ERR_PARAMif orderX or orderY are malformed.
ERR_MEMORYif memory allocation fails.
See also
vc_poly2d2d_free().

◆ vc_poly2d2d_free()

void vc_poly2d2d_free ( VCPolynom2D2D poly)

The function frees a previously allocated VCPolynom2D2D structure.

Parameters
polyThe polynom struct to be freed.
See also
vc_poly2d2d_allocate().

◆ vc_poly2d2d_map()

I32 vc_poly2d2d_map ( F64  xIn,
F64  yIn,
F64 xOut,
F64 yOut,
VCPolynom2D2D poly 
)

The function calculates a result using a VCPolynom2D2D structure.

Parameters
polyThe polynom struct with internals to be allocated.
xIn,yInInput Values $x$ and $y$ for the polynom poly.
xOut,yOutOutput Values $X(x,y)$ and $Y(x,y)$ of the polynom poly.
Return values
ERR_NONEon Success.
ERR_SINGULARif transformInIff1 is 1 and scaleX/YIn is 0.
See also
vc_poly2d2d_total_cnt_coeff(), vc_poly2d2d_idx_to_pow(), vc_poly2d2d_pow_to_idx().

◆ vc_poly2d2d_copy()

I32 vc_poly2d2d_copy ( VCPolynom2D2D polyFrom,
VCPolynom2D2D polyTo 
)

The function copies a VCPolynom2D2D structure to another.

Parameters
polyFromThe polynom struct with internals to be copied from.
polyToThe polynom struct with internals to be copied to.
Return values
ERR_NONEon Success.
ERR_INCONSif order differs.
ERR_MEMORYif any polynomial is not allocated.
See also
vc_poly2d2d_allocate().

◆ vc_poly2d2d_print()

void vc_poly2d2d_print ( VCPolynom2D2D poly,
I32  indentation 
)

This function prints out a VCPolynom2D2D struct.

Parameters
polyThe polynom struct.

◆ vc_poly2d2d_load_and_allocate_from_ini()

I32 vc_poly2d2d_load_and_allocate_from_ini ( VCPolynom2D2D poly,
char *  filename,
I8  tiCompatibleIff1 
)

This function reads and allocates a VCPolynom2D2D struct from an INI file.

Parameters
filenameThe input INI file.
polyThe unallocated output polynom struct, on success it is allocated, free with vc_poly2d2d_free().
tiCompatibleIff1Use the same value at writing: If set to 1, the ini file can be interchanged between ARM and TI. On TI based platforms, this value has to be 1.
Return values
ERR_NONEon Success.
<0on Error, especially ERR_FIO if file reading fails, either by missing entries, or by opening.
See also
vc_poly2d2d_store_as_ini().

◆ vc_poly2d2d_store_as_ini()

I32 vc_poly2d2d_store_as_ini ( char *  filename,
VCPolynom2D2D poly,
I8  tiCompatibleIff1 
)

This function stores VCPolynom2D2D struct values as INI file.

Parameters
filenameThe output INI file.
polyThe polynom struct.
tiCompatibleIff1Use the same value at reading: If set to 1, the ini file can be interchanged between ARM and TI. On TI based platforms, this value has to be 1.
Return values
ERR_NONEon Success.
<0on Error, especially (-10 + 100 * vcmenu_store_values_in_file()).
See also
vc_poly2d2d_load_and_allocate_from_ini().

◆ vc_poly2d2d_pow_to_idx()

I32 vc_poly2d2d_pow_to_idx ( I32 idx,
I32  powX,
I32  powY,
VCPolynom2D2D poly,
I32  polyYIf1ElseX 
)

If the powers $powX$ and $powY$ for the coeffX or coeffY is given, this function determines the index idx of the coeffX or coeffY. The function vc_poly2d2d_idx_to_pow() is reverse.

Parameters
idxOutput Index for estimating powers for.
powX,powYInput Powers $ c_{idx} x^{powX} y^{powY}$.
polyThe polynom struct.
Return values
ERR_PARAMif orderX or orderY are malformed.
See also
vc_poly2d2d_total_cnt_coeff(), vc_poly2d2d_idx_to_pow(), vc_poly2d2d_pow_to_idx().

◆ vc_poly2d2d_idx_to_pow()

I32 vc_poly2d2d_idx_to_pow ( I32 powX,
I32 powY,
I32  idx,
VCPolynom2D2D poly,
I32  coeffYIff1 
)

If an index idx for the coeffX or coeffY is given, this function determines the powers of the $x$ and $y$ variables. The function vc_poly2d2d_pow_to_idx() is reverse.

Parameters
powX,powYOutput Powers $ c_{idx} x^{powX} y^{powY}$, if not needed, set to NULL.
idxInput Index for estimating powers for.
polyThe polynom struct.
Return values
ERR_NONEon Success.
See also
vc_poly2d2d_total_cnt_coeff(), vc_poly2d2d_idx_to_pow(), vc_poly2d2d_pow_to_idx().

◆ vc_poly2d2d_total_cnt_coeff()

I32 vc_poly2d2d_total_cnt_coeff ( I32 cntCoeffX,
I32 cntCoeffY,
VCPolynom2D2D poly 
)

This function returns the number of values at the coeffX or coeffY array.

Parameters
cntCoeffX,cntCoeffYOutput number, if not needed, set to NULL.
polyThe polynom struct.
See also
vc_poly2d2d_total_cnt_coeff(), vc_poly2d2d_idx_to_pow(), vc_poly2d2d_pow_to_idx().