>
Vectors and matricesGTS Library Reference Manual | |||
---|---|---|---|
<<< Previous Page | Home | Up | Next Page >>> |
#include <gts.h> typedef GtsVector[3]; #define gts_vector_init (v, p1, p2) #define gts_vector_scalar (v1, v2) #define gts_vector_cross (C,A,B) #define gts_vector_norm (v) #define gts_vector_normalize (v) void gts_vector_print ( |
The functions described in this section allow to perform simple transformations on point coordinates. In particular projection onto a plane passing through the vertices of a given triangle or quadratic optimization problems.
#define gts_vector_init(v, p1, p2) |
Given two points p1 and p2, fills v with the coordinates of vector p1->p2.
#define gts_vector_scalar(v1, v2) |
Given two vectors v1 and v2 evaluates to the scalar product v1.v2.
v1 : | a |
v2 : | another |
#define gts_vector_cross(C,A,B) |
Given two vectors A and B fills C with the coordinates of the cross-product A^B.
C : | a |
A : | another |
B : | and another. |
void gts_vector_print ( |
Print s to file fptr.
v : | a |
fptr : | a file descriptor. |
GtsMatrix* gts_matrix_new ( |
Allocates memory and initializes a new GtsMatrix.
a00 : | element [0][0]. |
a01 : | element [0][1]. |
a02 : | element [0][2]. |
a10 : | element [1][0]. |
a11 : | element [1][1]. |
a12 : | element [1][2]. |
a20 : | element [2][0]. |
a21 : | element [2][1]. |
a22 : | element [2][2]. |
Returns : | a pointer to the newly created GtsMatrix. |
void gts_matrix_assign (GtsMatrix *m, |
Set values of matrix elements.
m : | a GtsMatrix. |
a00 : | element [0][0]. |
a01 : | element [0][1]. |
a02 : | element [0][2]. |
a10 : | element [1][0]. |
a11 : | element [1][1]. |
a12 : | element [1][2]. |
a20 : | element [2][0]. |
a21 : | element [2][1]. |
a22 : | element [2][2]. |
|
m : | a GtsMatrix. |
Returns : | the value of the det(m). |
GtsMatrix* gts_matrix_projection (GtsTriangle *t); |
Creates a new GtsMatrix representing the projection onto a plane of normal given by t.
t : | a GtsTriangle. |
Returns : | a pointer to the newly created GtsMatrix. |
|
Given a system of n constraints A.x=b adds to it the compatible constraints defined by A1.x=b1. The compatibility is determined by insuring that the resulting system is well-conditioned (see Lindstrom and Turk (1998, 1999)).
|
Solve a quadratic optimization problem: Given a quadratic objective function f which can be written as: f(x) = x^t.H.x + c^t.x + k, where H is the symmetric positive definite Hessian of f and k is a constant, find the minimum of f subject to the set of n prior linear constraints, defined by the first n rows of A and b (A.x = b). The new constraints given by the minimization are added to A and b only if they are linearly independent as determined by gts_matrix_compatible_row().
A : | a GtsMatrix. |
b : | a |
n : | the number of constraints (must be smaller than 3). |
H : | a symmetric positive definite Hessian. |
c : | a |
Returns : | the new number of constraints defined by A and b. |
void gts_matrix_print (GtsMatrix *m, |
Print m to file fptr.
m : | a GtsMatrix. |
fptr : | a file descriptor. |