link.c File Reference

Detailed Description

Implementaton of the function operating on Tlink.

See Also
Tlink, link.h.

Definition in file link.c.

Macros

#define MAX_ROT_VARS   14
 Maximum number of variables used to represent a link rotation. More...
 

Functions

void AdjustLinkForceParameters (Tlink *l)
 Adjust the range of the force-related parameters of the link. More...
 
void GetRotVarID (unsigned int r, TCuikSystem *cs, unsigned int *vID, Tlink *l)
 Obtains information about the variables used to codify the rotation of the link. More...
 
void GetRotVarIDAxisX (TCuikSystem *cs, Tlink *l)
 Obtains information about the variables used to codify the rotation of the link. More...
 
void GetRotVarIDFLinks (TCuikSystem *cs, Tlink *l)
 Obtains information about the variables used to codify the rotation of the link. More...
 
void GetRotVarIDLinks (TCuikSystem *cs, Tlink *l)
 Obtains information about the variables used to codify the rotation of the link. More...
 
void GetRotVarIDQLinks (TCuikSystem *cs, Tlink *l)
 Obtains information about the variables used to codify the rotation of the link. More...
 
void GenerateLinkConf (Tparameters *p, TCuikSystem *cs, Tlink *l)
 Adds the link configuration variables to the system. More...
 
void GenerateLinkRotAxisX (Tparameters *p, unsigned int lID, TCuikSystem *cs, Tlink *l)
 Version of GenerateLinkRot for axis X links. More...
 
void GenerateLinkRotLinks (Tparameters *p, unsigned int lID, TCuikSystem *cs, Tlink *l)
 Version of GenerateLinkRot for partial matrix representation. More...
 
void GenerateLinkRotFLinks (Tparameters *p, unsigned int lID, TCuikSystem *cs, Tlink *l)
 Version of GenerateLinkRot for full matrix representation. More...
 
void GenerateLinkRotQLinks (Tparameters *p, unsigned int lID, TCuikSystem *cs, Tlink *l)
 Version of GenerateLinkRot for quaternions representation. More...
 
void ApplyLinkRotAxisX (double sf, unsigned int sv, double *p, Tequation *eq, TCuikSystem *cs, boolean groundLink, Tlink *l)
 Version of ApplyLinkRot for axis X links. More...
 
void ApplyLinkRotDeformX (Tparameters *pr, double sf, unsigned int sv, double *p, Tequation *eq, TCuikSystem *cs, boolean groundLink, Tlink *l)
 Version of ApplyLinkRot for deform X links. More...
 
void ApplyLinkRotLinks (double sf, unsigned int sv, double *p, Tequation *eq, TCuikSystem *cs, boolean groundLink, Tlink *l)
 Version of ApplyLinkRot for partial matrix representation. More...
 
void ApplyLinkRotFLinks (double sf, unsigned int sv, double *p, Tequation *eq, TCuikSystem *cs, boolean groundLink, Tlink *l)
 Version of ApplyLinkRot for full matrix representation. More...
 
void ApplyLinkRotQLinks (double sf, unsigned int sv, double *p, Tequation *eq, TCuikSystem *cs, boolean groundLink, Tlink *l)
 Version of ApplyLinkRot for quaternion representation. More...
 
void RegenerateLinkSolutionConf (unsigned int r, TCuikSystem *cs, double *sol, Tlink *l)
 Computes the force-related dummy variables from the system ones. More...
 
void RegenerateLinkSolutionLinks (unsigned int r, TCuikSystem *cs, double *sol, boolean groundLink, Tlink *l)
 Version of RegenerateLinkSolution for partial matrix representation. More...
 
void RegenerateLinkSolutionQLinks (unsigned int r, TCuikSystem *cs, double *sol, boolean groundLink, Tlink *l)
 Version of RegenerateLinkSolution for quaternion representation. More...
 
void RegenerateLinkBoxConf (unsigned int r, TCuikSystem *cs, Tbox *b, Tlink *l)
 Computes the force-related dummy variables from the system ones. More...
 
void RegenerateLinkBoxLinks (unsigned int r, TCuikSystem *cs, Tbox *b, boolean groundLink, Tlink *l)
 Version of RegenerateLinkBox for partial matrix representation. More...
 
void RegenerateLinkBoxQLinks (unsigned int r, TCuikSystem *cs, Tbox *b, boolean groundLink, Tlink *l)
 Version of RegenerateLinkBox for quaternion representation. More...
 
void GetTransform2LinkAxisX (unsigned int r, TCuikSystem *cs, double *sol, boolean groundLink, double *trans, THTransform *t, Tlink *l)
 Version of GetTransform2Link for axis X links. More...
 
void GetTransform2LinkLinks (unsigned int r, TCuikSystem *cs, double *sol, boolean groundLink, double *trans, THTransform *t, Tlink *l)
 Version of GetTransform2Link for partial matrix representation. More...
 
void GetTransform2LinkFLinks (unsigned int r, TCuikSystem *cs, double *sol, boolean groundLink, double *trans, THTransform *t, Tlink *l)
 Version of GetTransform2Link for full matrix representation. More...
 
void GetTransform2LinkQLinks (unsigned int r, TCuikSystem *cs, double *sol, boolean groundLink, double *trans, THTransform *t, Tlink *l)
 Version of GetTransform2Link for quaternion representation. More...
 
void GenerateLinkSolutionAxisX (unsigned int r, THTransform *t, TCuikSystem *cs, double *sol, boolean groundLink, Tlink *l)
 Version of GenerateLinkSolution for axis X links. More...
 
void GenerateLinkSolutionLinks (unsigned int r, THTransform *t, TCuikSystem *cs, double *sol, boolean groundLink, Tlink *l)
 Version of GenerateLinkSolution for partial matrix representation. More...
 
void GenerateLinkSolutionFLinks (unsigned int r, THTransform *t, TCuikSystem *cs, double *sol, boolean groundLink, Tlink *l)
 Version of GenerateLinkSolution for full matrix representation. More...
 
void GenerateLinkSolutionQLinks (unsigned int r, THTransform *t, TCuikSystem *cs, double *sol, boolean groundLink, Tlink *l)
 Version of GenerateLinkSolution for quaternion representation. More...
 
void SetTransVars (boolean *vars, TCuikSystem *cs, Tlink *l)
 Identifies the variables giving the translation of the link. More...
 
void SetRotVars (unsigned int r, boolean *vars, TCuikSystem *cs, Tlink *l)
 Identifies the variables giving the rotation of the link. More...
 
boolean EmptyLinkConf (TLinkConf *ld)
 Identifies empty link internal configuration. More...
 
void GetLinkConfTransform (unsigned int bID, THTransform *t, TLinkConf *ld)
 Builds the internal transformation. More...
 
void DeleteLinkConf (TLinkConf *ld)
 Destructor. More...
 
void InitLink (char *name, Tlink *l)
 Constructor. More...
 
void InitNoRotLink (char *name, Tlink *l)
 Constructor. More...
 
void InitAxisXLink (char *name, unsigned int forceModel, Tinterval *length, Tinterval *force, Tlink *l)
 Constructor. More...
 
void InitDeformXLink (char *name, unsigned int forceModel, Tinterval *length, double stiffness, Tinterval *rest, Tinterval *force, Tlink *l)
 Constructor. More...
 
void InitPrismaticXLink (char *name, unsigned int forceModel, Tinterval *length, double stiffness, Tinterval *rest, Tinterval *force, Tlink *l)
 Constructor. More...
 
void CopyLink (Tlink *l_dst, Tlink *l_src)
 Copy constructor. More...
 
void AddBody2Link (Tpolyhedron *b, Tlink *l)
 Adds a body to the link. More...
 
void AddForce2Link (double fx, double fy, double fz, Tlink *l)
 Adds an external force to a link. More...
 
double GetForceOnLink (unsigned int dim, Tlink *l)
 Retrives the external force applied to a link. More...
 
void NoForceEquilibriumLink (Tlink *l)
 Deactivates the force equilibrium on a link. More...
 
boolean IsForceEquilibriumLink (Tlink *l)
 Determines if forces on link must be in equilibrium. More...
 
void SetLinkTrans (unsigned int dim, double t, Tlink *l)
 Fixes the translation of a link. More...
 
double GetLinkTrans (unsigned int dim, Tlink *l)
 Retrives the (eventually) fixed translation of a link. More...
 
TintervalGetLinkLength (Tlink *l)
 Nominal length of the link. More...
 
double GetLinkStiffness (Tlink *l)
 Stiffness of the link. More...
 
TintervalGetLinkRest (Tlink *l)
 The rest value. More...
 
TintervalGetLinkMaxForce (Tlink *l)
 The max force range. More...
 
void ChangeLinkReferenceFrame (unsigned int r, double **p1, double **p2, Tlink *l)
 Sets a new reference frame for the link. More...
 
unsigned int LinkNBodies (Tlink *l)
 Gets the number of convex parts of the link. More...
 
unsigned int LinkNAtoms (Tlink *l)
 Gets the number of atoms in a link. More...
 
TpolyhedronGetLinkBody (unsigned int i, Tlink *l)
 Gets one of the convex parts of the link. More...
 
unsigned int GetLinkBodyStatus (unsigned int i, Tlink *l)
 Gets the status of one of the convex parts of the link. More...
 
char * GetLinkName (Tlink *l)
 Gets the name of a link. More...
 
unsigned int GetLinkType (Tlink *l)
 Gets the type of a link. More...
 
boolean IsVariableLengthLink (Tlink *l)
 Identies links with variable length. More...
 
unsigned int GetLinkForceModel (Tlink *l)
 Identify the force model of the link. More...
 
void GetLinkForceVars (unsigned int r, unsigned int *xID, unsigned int *yID, unsigned int *zID, unsigned int *le, unsigned int *re, unsigned int *f, TCuikSystem *cs, Tlink *l)
 Get the identifier of the force-related variables of the link. More...
 
double LinkPotentialEnergy (unsigned int r, TCuikSystem *cs, double *p, Tlink *l)
 Potential energy stored in the link. More...
 
void LinkForceField (unsigned int r, TCuikSystem *cs, double *p, double *g, Tlink *l)
 Gradient of the potential energy stored in the link. More...
 
void GetLinkTransSeq (Tparameters *p, TCuikSystem *cs, TTransSeq *ts, Tlink *l)
 Build the sequence of transforms passing through the link. More...
 
void GetLinkTransform (double *dof, THTransform *t, Tlink *l)
 The homogeneous transform traversing the link. More...
 
void GetLinkTransformFromConf (TLinkConf *def, THTransform *t, Tlink *l)
 The homogeneous transform traversing the link. More...
 
void GetLinkConfFromSolution (unsigned int r, TCuikSystem *cs, double *sol, TLinkConf *def, Tlink *l)
 Computes a link configuration. More...
 
void GetLinkConfFromDOF (double *dof, TLinkConf *def, Tlink *l)
 Computes a link configuration. More...
 
void GenerateSolutionFromLinkConf (unsigned int r, TCuikSystem *cs, TLinkConf *def, double *sol, Tlink *l)
 Sets the solution entries corresponding to a link configuration. More...
 
void GenerateDOFFromLinkConf (TLinkConf *def, double *dof, Tlink *l)
 Sets the dof entries corresponding to a link configuration. More...
 
unsigned int NumLinkDOF (Tlink *l)
 Gets the number of configuration parameters for a given link. More...
 
TintervalGetLinkDOFRange (unsigned int i, Tlink *l)
 Gets a given DOF range. More...
 
void GetLinkDOFLabel (unsigned int i, char **n, Tlink *l)
 Returns a label for a given configuration parameter. More...
 
boolean IsLinkAllSpheres (Tlink *l)
 Identifies links formed only by spheres. More...
 
void SetPoseVars (unsigned int r, boolean *vars, TCuikSystem *cs, Tlink *l)
 Identifies the variables giving the pose of the link. More...
 
unsigned int SetForceVars (unsigned int r, boolean *vars, TCuikSystem *cs, Tlink *l)
 Identifies the variable giving the force of the link. More...
 
unsigned int SetForceRelatedVars (unsigned int r, boolean *vars, TCuikSystem *cs, Tlink *l)
 Identifies the force-related variables of the link. More...
 
void GetLinkPoseSimpVars (Tparameters *p, boolean *sv, TCuikSystem *cs, Tlink *l)
 Identifies the simplified variables giving the rotation of the link. More...
 
void GenerateLinkRot (Tparameters *p, unsigned int lID, TCuikSystem *cs, Tlink *l)
 Generate the variables and constraints related with the rotation of the link reference frame. More...
 
void FixLinkZToZero (Tparameters *p, unsigned int lID, TCuikSystem *cs, Tlink *l)
 Fixes the Z compoment of the vector giving the pose of the link. More...
 
void ApplyLinkRot (Tparameters *pr, double sf, unsigned int sv, double *p, Tequation *eq, TCuikSystem *cs, boolean groundLink, Tlink *l)
 Transforms a vector from the local reference frame to the global one and accumulates the resulting expression into the given equations. More...
 
void ApplyLinkRotNoDeform (Tparameters *pr, double sf, unsigned int sv, double *p, Tequation *eq, TCuikSystem *cs, boolean groundLink, Tlink *l)
 Variant of ApplyLinkRot. More...
 
void ApplyLinkRotVar (Tparameters *pr, double sf, unsigned int *vID, Tequation *eq, TCuikSystem *cs, boolean groundLink, Tlink *l)
 Transforms a variable vector from the local reference frame to the global one and accumulates the resulting expression into the given equations. More...
 
void RegenerateLinkSolution (Tparameters *p, TCuikSystem *cs, double *sol, boolean groundLink, Tlink *l)
 Computes the values for the dummy variables used to represent the rotation matrices for a given link. More...
 
void RegenerateLinkBox (Tparameters *p, TCuikSystem *cs, Tbox *b, boolean groundLink, Tlink *l)
 Computes the values for the dummy variables. More...
 
void GetTransform2Link (Tparameters *p, TCuikSystem *cs, double *sol, boolean groundLink, double *trans, THTransform *t, TLinkConf *def, Tlink *l)
 Gets the homogeneous transform associated with a link for a given solution point. More...
 
void GenerateLinkSolution (Tparameters *p, THTransform *t, TLinkConf *def, TCuikSystem *cs, double *sol, boolean groundLink, Tlink *l)
 Defines the link variables from a transform. More...
 
boolean VisibleLink (Tlink *l)
 Checks if a links has some visible parts. More...
 
double GetLinkMaxCoordinate (Tlink *l)
 Returns the sum of the maximum coordinate value for all the convex polyhedrons in the link. More...
 
void LinkPrintAtoms (FILE *f, THTransform *tl, Tlink *l)
 Prints the center of the atoms in a link in gobal coordinates. More...
 
void LinkStoreAtoms (FILE *f, THTransform *tl, Tlink *l)
 Prints the center of the atoms in a link in gobal coordinates. More...
 
void PlotLink (Tplot3d *pt, double axesLength, Tlink *l)
 Adds a link to a 3d scene. More...
 
void MoveLinkFromTransform (Tplot3d *pt, THTransform *t, TLinkConf *def, Tlink *l)
 Displaces a link in a 3d scene. More...
 
void PrintLink (FILE *f, char *path, char *prefix, Tlink *l)
 Stores the link information into a file. More...
 
void DeleteLink (Tlink *l)
 Destructor. More...
 

Macro Definition Documentation

Function Documentation

void AdjustLinkForceParameters ( Tlink l)

Adjust the range of the stiffness, length, rest, and maxForce variables associated with the link. These variables are related by the equations force=stiffness*(length-rest) which can be used to crop the ranges given by the user.

Parameters
lThe link to adjust.

Definition at line 731 of file link.c.

References CopyInterval(), Error(), FALSE, Tlink::force, Tlink::forceModel, Intersection(), IntervalAdd(), IntervalScale(), IntervalSize(), IntervalSubstract(), Tlink::length, LINEAR_FORCE, Tlink::rest, Tlink::stiffness, TRUE, and ZERO.

Referenced by InitDeformXLink(), and InitPrismaticXLink().

void GetRotVarID ( unsigned int  r,
TCuikSystem cs,
unsigned int *  vID,
Tlink l 
)

Defines the csvID, vID, and nvID fields for the link. If the values are already cached nothing is done. If the cuiksystem is diferent from that for which the identified where computed before they are re-computed.

Note that in general there are not translation variables associated with a link but that translations are computed accumulating displacements on links from the ground link to the current one. In global cuiksystems, though, those accumulations are identified with given variables and they can be directly retrieved (see SetTransVars).

Parameters
rThe type of representation to use (i.e., the CT_REPRESENTATION parameter).
csThe cuiksystem from where to get the variable identifiers.
vIDBuffer where to store the variable identifiers.
lThe link.

Definition at line 1635 of file link.c.

References Tlink::csvID, Error(), GetRotVarIDAxisX(), GetRotVarIDFLinks(), GetRotVarIDLinks(), GetRotVarIDQLinks(), LINK_AxisX, LINK_DeformX, LINK_FullRot, LINK_NoRot, LINK_PrismaticX, Tlink::nvID, REP_FLINKS, REP_JOINTS, REP_LINKS, REP_QLINKS, Tlink::type, and Tlink::vID.

Referenced by ApplyLinkRotVar(), FixLinkZToZero(), GenerateLinkSolutionAxisX(), GenerateLinkSolutionFLinks(), GenerateLinkSolutionLinks(), GenerateLinkSolutionQLinks(), GenerateSolutionFromLinkConf(), GetLinkConfFromSolution(), GetLinkForceVars(), GetLinkPoseSimpVars(), GetTransform2LinkAxisX(), GetTransform2LinkFLinks(), GetTransform2LinkLinks(), GetTransform2LinkQLinks(), LinkForceField(), LinkPotentialEnergy(), RegenerateLinkBoxLinks(), RegenerateLinkBoxQLinks(), RegenerateLinkSolutionLinks(), RegenerateLinkSolutionQLinks(), SetForceRelatedVars(), SetForceVars(), and SetRotVars().

void GetRotVarIDAxisX ( TCuikSystem cs,
Tlink l 
)

This function is specific for LINK_AxisX links. For this links only one axis is represented.

It is also used for LINK_DeforX and for LINK_PrismaticX.

Don't use this function directly. Instead call always GetRotVarID.

Parameters
csThe cuiksystem from where to get the variable identifiers.
lThe link.

Definition at line 1708 of file link.c.

References Tlink::csvID, Tlink::forceModel, GetCSVariableID(), LINEAR_FORCE, LINK_LENGTH, LINK_MAX_FORCE, LINK_REST, LINK_ROT, Tlink::name, NEW, NO_FORCE, NO_UINT, Tlink::nvID, Tlink::varLength, and Tlink::vID.

Referenced by GetRotVarID().

void GetRotVarIDFLinks ( TCuikSystem cs,
Tlink l 
)

Version of GetRotVarID for REP_FLINKS representations.

Don't use this function directly. Instead call always GetRotVarID.

Parameters
csThe cuiksystem from where to get the variable identifiers.
lThe link.

Definition at line 1752 of file link.c.

References Tlink::csvID, GetCSVariableID(), LINK_ROT, Tlink::name, NEW, Tlink::nvID, and Tlink::vID.

Referenced by GetRotVarID().

void GetRotVarIDLinks ( TCuikSystem cs,
Tlink l 
)

Version of GetRotVarID for REP_LINKS representations.

Don't use this function directly. Instead call always GetRotVarID.

Parameters
csThe cuiksystem from where to get the variable identifiers.
lThe link.

Definition at line 1777 of file link.c.

References Tlink::csvID, GetCSVariableID(), LINK_ROT2, Tlink::name, NEW, Tlink::nvID, and Tlink::vID.

Referenced by GetRotVarID().

void GetRotVarIDQLinks ( TCuikSystem cs,
Tlink l 
)

Version of GetRotVarID for REP_QLINKS representations.

Don't use this function directly. Instead call always GetRotVarID.

Parameters
csThe cuiksystem from where to get the variable identifiers.
lThe link.

Definition at line 1801 of file link.c.

References Tlink::csvID, GetCSVariableID(), LINK_ROT3_E, LINK_ROT3_Q, Tlink::name, NEW, Tlink::nvID, and Tlink::vID.

Referenced by GetRotVarID().

void GenerateLinkConf ( Tparameters p,
TCuikSystem cs,
Tlink l 
)

Adds the configuration variables to the system of equations. These parameters will be later used in the equations (i.e., in the force equilibrium equations for tensegrities).

Parameters
pThe set of parameters.
csThe cuiksystem where to add the variables and equations.
lThe link from where to generate the variables and equation.

Definition at line 1981 of file link.c.

References AddCt2Monomial(), AddEquation2CS(), AddMonomial(), AddVariable2CS(), AddVariable2Monomial(), CT_REPRESENTATION, DeleteEquation(), DeleteMonomial(), DeleteVariable(), EQU, Error(), Tlink::force, Tlink::forceModel, GetCSVariableID(), GetParameter(), InitEquation(), InitMonomial(), Tlink::length, LINEAR_FORCE, LINK_LENGTH, LINK_MAX_FORCE, LINK_REST, Tlink::name, NEW, NewVariable(), NFUN, NO_FORCE, NO_UINT, REP_FLINKS, REP_LINKS, ResetMonomial(), Tlink::rest, SetEquationCmp(), SetEquationType(), SetEquationValue(), SetVariableInterval(), Tlink::stiffness, SYSTEM_EQ, SYSTEM_VAR, and Tlink::varLength.

Referenced by GenerateLinkRot().

void GenerateLinkRotAxisX ( Tparameters p,
unsigned int  lID,
TCuikSystem cs,
Tlink l 
)

Version of GenerateLinkRot for links where only the X axis is represented.

Parameters
pA set of parameters. They include, for instance the dummification level.
lIDThe identifier of the link in the mechanism. Used to generate unique names for the new variables.
csThe cuiksystem where to add the variables and equations.
lThe link from where to generate the variables and equation.

Definition at line 2073 of file link.c.

References AddEquation2CS(), AddVariable2CS(), DeleteEquation(), DeleteVariable(), GenerateNormEquation(), GetCSVariableID(), IsGroundLink, LINK_ROT, Tlink::name, NEW, NewInterval(), NewVariable(), NO_UINT, SetVariableInterval(), and SYSTEM_VAR.

Referenced by GenerateLinkRot().

void GenerateLinkRotLinks ( Tparameters p,
unsigned int  lID,
TCuikSystem cs,
Tlink l 
)

Version of GenerateLinkRot for partial matrix representation.

Parameters
pA set of parameters. They include, for instance the dummification level.
lIDThe identifier of the link in the mechanism. Used to generate unique names for the new variables.
csThe cuiksystem where to add the variables and equations.
lThe link from where to generate the variables and equation.

Definition at line 2223 of file link.c.

References AddEquation2CS(), AddVariable2CS(), Tlink::c, DeleteEquation(), DeleteVariable(), DUMMY_VAR, GenerateDotProductEquation(), GenerateNormEquation(), GenerateScaledSaddleEquation(), GetCSVariableID(), IsGroundLink, LINK_ROT, LINK_ROT2, Tlink::name, NEW, NewInterval(), NewVariable(), NO_UINT, Tlink::s, SetVariableInterval(), and SYSTEM_VAR.

Referenced by GenerateLinkRot().

void GenerateLinkRotFLinks ( Tparameters p,
unsigned int  lID,
TCuikSystem cs,
Tlink l 
)

Version of GenerateLinkRot for full matrix representation.

Parameters
pA set of parameters. They include, for instance the dummification level.
lIDThe identifier of the link in the mechanism. Used to generate unique names for the new variables.
csThe cuiksystem where to add the variables and equations.
lThe link from where to generate the variables and equation.

Definition at line 2109 of file link.c.

References AddEquation2CS(), AddVariable2CS(), Tlink::c, DeleteEquation(), DeleteVariable(), GenerateCrossProductEquations(), GenerateDotProductEquation(), GenerateNormEquation(), GetCSVariableID(), IsGroundLink, LINK_ROT, Tlink::name, NEW, NewInterval(), NewVariable(), NO_UINT, ROT_REDUNDANCY, Tlink::s, SetVariableInterval(), and SYSTEM_VAR.

Referenced by GenerateLinkRot().

void GenerateLinkRotQLinks ( Tparameters p,
unsigned int  lID,
TCuikSystem cs,
Tlink l 
)

Version of GenerateLinkRot for quaternion representation.

Parameters
pA set of parameters. They include, for instance the dummification level.
lIDThe identifier of the link in the mechanism. Used to generate unique names for the new variables.
csThe cuiksystem where to add the variables and equations.
lThe link from where to generate the variables and equation.

Definition at line 2303 of file link.c.

References AddEquation2CS(), AddMonomial(), AddVariable2CS(), AddVariable2Monomial(), DeleteEquation(), DeleteMonomial(), DeleteVariable(), DUMMY_VAR, EQU, GenerateSaddleEquation(), GetCSVariableID(), InitEquation(), InitMonomial(), IsGroundLink, LINK_ROT3_E, LINK_ROT3_Q, Tlink::name, NEW, NewInterval(), NewVariable(), NFUN, NO_UINT, ResetMonomial(), SetEquationCmp(), SetEquationType(), SetEquationValue(), SetVariableInterval(), SYSTEM_EQ, and SYSTEM_VAR.

Referenced by GenerateLinkRot().

void ApplyLinkRotAxisX ( double  sf,
unsigned int  sv,
double *  p,
Tequation eq,
TCuikSystem cs,
boolean  groundLink,
Tlink l 
)

Version of ApplyLinkRot for links for which only the axis X is relevant.

Parameters
sfConstant scale factor to apply to the input vector.
svVariable scale factor given as the identifier of the range in the given box whose center have to be used as scale factor. If no variable scale factor is to be used this parameter should be NO_UINT.
pThe 3D vector in the link reference frame that we want to transform to the global one and to add to trans.
eqSet of 3 equations where to add the 3 expressions resulting from this function (one for the X component of the vector in the globla frame, another for the Y expression and, finally the expression for the Z component).
csThe cuik system on which the boxes are defiend. It is used to, given the name of the variables corresponding the reference frame of the given link, retrive its numerical identifiers. The numerical identifier of the variable is used to generate a unique name for it.
groundLinkTRUE if the given link is the ground link.
lThe link to use to rotate the given input vector p.

Definition at line 2508 of file link.c.

References AddCt2Monomial(), AddMonomial(), AddVariable2Monomial(), DeleteMonomial(), Error(), GetCSVariableID(), InitMonomial(), LINK_ROT, Tlink::name, NEW, NFUN, NO_UINT, Norm(), ResetMonomial(), and ZERO.

Referenced by ApplyLinkRot(), and ApplyLinkRotNoDeform().

void ApplyLinkRotDeformX ( Tparameters pr,
double  sf,
unsigned int  sv,
double *  p,
Tequation eq,
TCuikSystem cs,
boolean  groundLink,
Tlink l 
)

Version of ApplyLinkRot for links for which only the axis X is relevant and where there is an elongation along this axis.

Parameters
prThe set of parameters.
sfConstant scale factor to apply to the input vector.
svVariable scale factor given as the identifier of the range in the given box whose center have to be used as scale factor. If no variable scale factor is to be used this parameter should be NO_UINT.
pThe 3D vector in the link reference frame that we want to transform to the global one and to add to trans.
eqSet of 3 equations where to add the 3 expressions resulting from this function (one for the X component of the vector in the globla frame, another for the Y expression and, finally the expression for the Z component).
csThe cuik system on which the boxes are defiend. It is used to, given the name of the variables corresponding the reference frame of the given link, retrive its numerical identifiers. The numerical identifier of the variable is used to generate a unique name for it.
groundLinkTRUE if the given link is the ground link.
lThe link to use to rotate the given input vector p.

Definition at line 2562 of file link.c.

References AddCt2Monomial(), AddMonomial(), AddVariable2Monomial(), DeleteMonomial(), Error(), GetCSVariableID(), InitMonomial(), LINK_LENGTH, LINK_ROT, Tlink::name, NEW, NFUN, NO_UINT, Norm(), ResetMonomial(), and ZERO.

Referenced by ApplyLinkRot().

void ApplyLinkRotLinks ( double  sf,
unsigned int  sv,
double *  p,
Tequation eq,
TCuikSystem cs,
boolean  groundLink,
Tlink l 
)

Version of ApplyLinkRot for partial matrix representation.

Parameters
sfConstant scale factor to apply to the input vector.
svVariable scale factor given as the identifier of the range in the given box whose center have to be used as scale factor. If no variable scale factor is to be used this parameter should be NO_UINT.
pThe 3D vector in the link reference frame that we want to transform to the global one and to add to trans.
eqSet of 3 equations where to add the 3 expressions resulting from this function (one for the X component of the vector in the globla frame, another for the Y expression and, finally the expression for the Z component).
csThe cuik system on which the boxes are defiend. It is used to, given the name of the variables corresponding the reference frame of the given link, retrive its numerical identifiers. The numerical identifier of the variable is used to generate a unique name for it.
groundLinkTRUE if the given link is the ground link.
lThe link to use to rotate the given input vector p.

Definition at line 2686 of file link.c.

References AddCt2Monomial(), AddMonomial(), AddVariable2Monomial(), DeleteMonomial(), Error(), GetCSVariableID(), HTransformApply(), InitMonomial(), LINK_ROT2, Tlink::name, NEW, NFUN, NO_UINT, Tlink::R, ResetMonomial(), and ZERO.

Referenced by ApplyLinkRot().

void ApplyLinkRotFLinks ( double  sf,
unsigned int  sv,
double *  p,
Tequation eq,
TCuikSystem cs,
boolean  groundLink,
Tlink l 
)

Version of ApplyLinkRot for full matrix representation.

Parameters
sfConstant scale factor to apply to the input vector.
svVariable scale factor given as the identifier of the range in the given box whose center have to be used as scale factor. If no variable scale factor is to be used this parameter should be NO_UINT.
pThe 3D vector in the link reference frame that we want to transform to the global one and to add to trans.
eqSet of 3 equations where to add the 3 expressions resulting from this function (one for the X component of the vector in the globla frame, another for the Y expression and, finally the expression for the Z component).
csThe cuik system on which the boxes are defiend. It is used to, given the name of the variables corresponding the reference frame of the given link, retrive its numerical identifiers. The numerical identifier of the variable is used to generate a unique name for it.
groundLinkTRUE if the given link is the ground link.
lThe link to use to rotate the given input vector p.

Definition at line 2620 of file link.c.

References AddCt2Monomial(), AddMonomial(), AddVariable2Monomial(), DeleteMonomial(), Error(), GetCSVariableID(), HTransformApply(), InitMonomial(), LINK_ROT, Tlink::name, NEW, NFUN, NO_UINT, Tlink::R, ResetMonomial(), and ZERO.

Referenced by ApplyLinkRot().

void ApplyLinkRotQLinks ( double  sf,
unsigned int  sv,
double *  p,
Tequation eq,
TCuikSystem cs,
boolean  groundLink,
Tlink l 
)

Version of ApplyLinkRot for quaternion representation.

Parameters
sfConstant scale factor to apply to the input vector.
svVariable scale factor given as the identifier of the range in the given box whose center have to be used as scale factor. If no variable scale factor is to be used this parameter should be NO_UINT.
pThe 3D vector in the link reference frame that we want to transform to the global one and to add to trans.
eqSet of 3 equations where to add the 3 expressions resulting from this function (one for the X component of the vector in the globla frame, another for the Y expression and, finally the expression for the Z component).
csThe cuik system on which the boxes are defiend. It is used to, given the name of the variables corresponding the reference frame of the given link, retrive its numerical identifiers. The numerical identifier of the variable is used to generate a unique name for it.
groundLinkTRUE if the given link is the ground link.
lThe link to use to rotate the given input vector p.

Definition at line 2755 of file link.c.

References AddCt2Monomial(), AddMonomial(), AddVariable2Monomial(), DeleteMonomial(), Error(), GetCSVariableID(), InitMonomial(), LINK_ROT3_E, Tlink::name, NEW, NFUN, NO_UINT, ResetMonomial(), and ZERO.

Referenced by ApplyLinkRot().

void RegenerateLinkSolutionConf ( unsigned int  r,
TCuikSystem cs,
double *  sol,
Tlink l 
)

Computes the force-related dummy variables from the system ones. Actually nothing is computed since all force variables are system variables.

This is an auxiliary function of RegenerateLinkSolution.

Parameters
rThe type of representation used (REP_JOINTS, REP_LINKS...)
csThe cuik system on which the boxes are defiend. It is used to, given the name of the variables corresponding the reference frame of the given link, retrive its numerical identifiers, i.e., the number of range of the box to use to instantiate each variable.
solThe solution point with the values for the system variables. At the end of the function, this vector also has values for the link-related dummy variables.
lThe link.

Definition at line 3018 of file link.c.

Referenced by RegenerateLinkSolution().

void RegenerateLinkSolutionLinks ( unsigned int  r,
TCuikSystem cs,
double *  sol,
boolean  groundLink,
Tlink l 
)

Version of RegenerateLinkSolution for partial matrix representation.

Parameters
rThe type of representation used (REP_JOINTS, REP_LINKS...)
csThe cuik system on which the boxes are defiend. It is used to, given the name of the variables corresponding the reference frame of the given link, retrive its numerical identifiers, i.e., the number of range of the box to use to instantiate each variable.
solThe solution point with the values for the system variables. At the end of the function, this vector also has values for the link-related dummy variables.
groundLinkTRUE if the given link is the ground link. The rotation matrix for the ground link is fixed (the identity) and, its rotation matrix generates no variables (nor system nor dummy).
lThe link.

Definition at line 3023 of file link.c.

References GetRotVarID(), MAX_ROT_VARS, and Tlink::s.

Referenced by GenerateLinkSolutionLinks(), and RegenerateLinkSolution().

void RegenerateLinkSolutionQLinks ( unsigned int  r,
TCuikSystem cs,
double *  sol,
boolean  groundLink,
Tlink l 
)

Version of RegenerateLinkSolution for quaternion representation.

Parameters
rThe type of representation used (REP_JOINTS, REP_LINKS...)
csThe cuik system on which the boxes are defiend. It is used to, given the name of the variables corresponding the reference frame of the given link, retrive its numerical identifiers, i.e., the number of range of the box to use to instantiate each variable.
solThe solution point with the values for the system variables. At the end of the function, this vector also has values for the link-related dummy variables.
groundLinkTRUE if the given link is the ground link. The rotation matrix for the ground link is fixed (the identity) and, its rotation matrix generates no variables (nor system nor dummy).
lThe link.

Definition at line 3042 of file link.c.

References GetRotVarID(), and MAX_ROT_VARS.

Referenced by GenerateLinkSolutionQLinks(), and RegenerateLinkSolution().

void RegenerateLinkBoxConf ( unsigned int  r,
TCuikSystem cs,
Tbox b,
Tlink l 
)

Computes the force-related dummy variables from the system ones. Actually nothing is computed since all force variables are system variables.

This is an auxiliary function of RegenerateLinkBox and is the same as RegenerateLinkSolutionConf but working on a box instead than on a point.

Parameters
rThe type of representation used (REP_JOINTS, REP_LINKS...)
csThe cuik system on which the boxes are defiend. It is used to, given the name of the variables corresponding the reference frame of the given link, retrive its numerical identifiers, i.e., the number of range of the box to use to instantiate each variable.
bThe solution box with the values for the system variables. At the end of the function, this box also has values for the link-related dummy variables.
lThe link.

Definition at line 3102 of file link.c.

Referenced by RegenerateLinkBox().

void RegenerateLinkBoxLinks ( unsigned int  r,
TCuikSystem cs,
Tbox b,
boolean  groundLink,
Tlink l 
)

Version of RegenerateLinkBox for partial matrix representation.

Parameters
rThe type of representation used (REP_JOINTS, REP_LINKS...)
csThe cuik system on which the boxes are defiend. It is used to, given the name of the variables corresponding the reference frame of the given link, retrive its numerical identifiers, i.e., the number of range of the box to use to instantiate each variable.
bThe solution box with the values for the system variables. At the end of the function, this box also has values for the link-related dummy variables.
groundLinkTRUE if the given link is the ground link. The rotation matrix for the ground link is fixed (the identity) and, its rotation matrix generates no variables (nor system nor dummy).
lThe link.

Definition at line 3107 of file link.c.

References GetBoxIntervals(), GetRotVarID(), IntervalProduct(), IntervalScale(), MAX_ROT_VARS, Tlink::s, and SetBoxInterval().

Referenced by RegenerateLinkBox().

void RegenerateLinkBoxQLinks ( unsigned int  r,
TCuikSystem cs,
Tbox b,
boolean  groundLink,
Tlink l 
)

Version of RegenerateLinkBox for quaternion representation.

Parameters
rThe type of representation used (REP_JOINTS, REP_LINKS...)
csThe cuik system on which the boxes are defiend. It is used to, given the name of the variables corresponding the reference frame of the given link, retrive its numerical identifiers, i.e., the number of range of the box to use to instantiate each variable.
bThe solution box with the values for the system variables. At the end of the function, this box also has values for the link-related dummy variables.
groundLinkTRUE if the given link is the ground link. The rotation matrix for the ground link is fixed (the identity) and, its rotation matrix generates no variables (nor system nor dummy).
lThe link.

Definition at line 3145 of file link.c.

References CopyInterval(), GetBoxInterval(), GetRotVarID(), IntervalProduct(), MAX_ROT_VARS, and SetBoxInterval().

Referenced by RegenerateLinkBox().

void GetTransform2LinkAxisX ( unsigned int  r,
TCuikSystem cs,
double *  sol,
boolean  groundLink,
double *  trans,
THTransform t,
Tlink l 
)

Version of GetTransform2Link for links where only the X axis is relevant.

Also used for LINK_DeformX links.

Parameters
rThe type of representation used (REP_JOINTS, REP_LINKS...)
csThe cuik system on which the boxes are defined. It is used to, given the name of the variables corresponding the reference frame of the given link, retrive its numerical identifiers, i.e., the number of range of the box to use to instantiate each variable.
solThe solution point including values for all variables (i.e., already regenerated using RegenerateLinkSolution before calling this function).
groundLinkTRUE if the given link is the ground link.
trans3d vector with the translation from the ground link to this link. The variables for these translations are removed from the cuiksystems and computed from rotations and fixed vectors. Consequently they can only be computed at the level where we have cuiksystems and links (i.e. in world.h).
tThe returned homogeneous transform.
lThe link whose reference frame we want to retrive.

Definition at line 3215 of file link.c.

References AXIS_H, AXIS_X, AXIS_Y, AXIS_Z, CrossProduct(), DefineNormalVector(), GetRotVarID(), HTransformIdentity(), HTransformSetElement(), MAX_ROT_VARS, Normalize(), and ZERO.

Referenced by GetTransform2Link().

void GetTransform2LinkLinks ( unsigned int  r,
TCuikSystem cs,
double *  sol,
boolean  groundLink,
double *  trans,
THTransform t,
Tlink l 
)

Version of GetTransform2Link for full partial representation.

Parameters
rThe type of representation used (REP_JOINTS, REP_LINKS...)
csThe cuik system on which the boxes are defined. It is used to, given the name of the variables corresponding the reference frame of the given link, retrive its numerical identifiers, i.e., the number of range of the box to use to instantiate each variable.
solThe solution point including values for all variables (i.e., already regenerated using RegenerateLinkSolution before calling this function).
groundLinkTRUE if the given link is the ground link.
trans3d vector with the translation from the ground link to this link. The variables for these translations are removed from the cuiksystems and computed from rotations and fixed vectors. Consequently they can only be computed at the level where we have cuiksystems and links (i.e. in world.h).
tThe returned homogeneous transform.
lThe link whose reference frame we want to retrive.

Definition at line 3290 of file link.c.

References AXIS_H, GetRotVarID(), HTransformIdentity(), HTransformOrthonormalize(), HTransformProduct(), HTransformSetElement(), MAX_ROT_VARS, and Tlink::R.

Referenced by GetTransform2Link().

void GetTransform2LinkFLinks ( unsigned int  r,
TCuikSystem cs,
double *  sol,
boolean  groundLink,
double *  trans,
THTransform t,
Tlink l 
)

Version of GetTransform2Link for full matrix representation.

Parameters
rThe type of representation used (REP_JOINTS, REP_LINKS...)
csThe cuik system on which the boxes are defined. It is used to, given the name of the variables corresponding the reference frame of the given link, retrive its numerical identifiers, i.e., the number of range of the box to use to instantiate each variable.
solThe solution point including values for all variables (i.e., already regenerated using RegenerateLinkSolution before calling this function).
groundLinkTRUE if the given link is the ground link.
trans3d vector with the translation from the ground link to this link. The variables for these translations are removed from the cuiksystems and computed from rotations and fixed vectors. Consequently they can only be computed at the level where we have cuiksystems and links (i.e. in world.h).
tThe returned homogeneous transform.
lThe link whose reference frame we want to retrive.

Definition at line 3251 of file link.c.

References AXIS_H, GetRotVarID(), HTransformIdentity(), HTransformOrthonormalize(), HTransformProduct(), HTransformSetElement(), MAX_ROT_VARS, and Tlink::R.

Referenced by GetTransform2Link().

void GetTransform2LinkQLinks ( unsigned int  r,
TCuikSystem cs,
double *  sol,
boolean  groundLink,
double *  trans,
THTransform t,
Tlink l 
)

Version of GetTransform2Link for quaternion representation.

Parameters
rThe type of representation used (REP_JOINTS, REP_LINKS...)
csThe cuik system on which the boxes are defined. It is used to, given the name of the variables corresponding the reference frame of the given link, retrive its numerical identifiers, i.e., the number of range of the box to use to instantiate each variable.
solThe solution point including values for all variables (i.e., already regenerated using RegenerateLinkSolution before calling this function).
groundLinkTRUE if the given link is the ground link.
trans3d vector with the translation from the ground link to this link. The variables for these translations are removed from the cuiksystems and computed from rotations and fixed vectors. Consequently they can only be computed at the level where we have cuiksystems and links (i.e. in world.h).
tThe returned homogeneous transform.
lThe link whose reference frame we want to retrive.

Definition at line 3334 of file link.c.

References GetRotVarID(), HTransformIdentity(), HTransformOrthonormalize(), HTransformSetElement(), and MAX_ROT_VARS.

Referenced by GetTransform2Link().

void GenerateLinkSolutionAxisX ( unsigned int  r,
THTransform t,
TCuikSystem cs,
double *  sol,
boolean  groundLink,
Tlink l 
)

Version of GenerateLinkSolution for links where only the axis X is relevant.

Also used for LINK_DeformX links.

Parameters
rThe type of representation used (REP_JOINTS, REP_LINKS...)
tThe transform giving the link pose.
csThe cuik system on which the variables are defined.
solThe solution point where to store the generated values.
groundLinkTRUE for the ground link.
lThe link.

Definition at line 3423 of file link.c.

References GetRotVarID(), HTransformGetElement(), and MAX_ROT_VARS.

Referenced by GenerateLinkSolution().

void GenerateLinkSolutionLinks ( unsigned int  r,
THTransform t,
TCuikSystem cs,
double *  sol,
boolean  groundLink,
Tlink l 
)

Version of GenerateLinkSolution for partial matrix representation.

Parameters
rThe type of representation used (REP_JOINTS, REP_LINKS...)
tThe transform giving the link pose.
csThe cuik system on which the variables are defined.
solThe solution point where to store the generated values.
groundLinkTRUE for the ground link.
lThe link.

Definition at line 3465 of file link.c.

References GetRotVarID(), HTransformDelete(), HTransformGetElement(), HTransformProduct(), Tlink::iR, MAX_ROT_VARS, and RegenerateLinkSolutionLinks().

Referenced by GenerateLinkSolution().

void GenerateLinkSolutionFLinks ( unsigned int  r,
THTransform t,
TCuikSystem cs,
double *  sol,
boolean  groundLink,
Tlink l 
)

Version of GenerateLinkSolution for full matrix representation.

Parameters
rThe type of representation used (REP_JOINTS, REP_LINKS...)
tThe transform giving the link pose.
csThe cuik system on which the variables are defined.
solThe solution point where to store the generated values.
groundLinkTRUE for the ground link.
lThe link.

Definition at line 3438 of file link.c.

References GetRotVarID(), HTransformDelete(), HTransformGetElement(), HTransformProduct(), Tlink::iR, and MAX_ROT_VARS.

Referenced by GenerateLinkSolution().

void GenerateLinkSolutionQLinks ( unsigned int  r,
THTransform t,
TCuikSystem cs,
double *  sol,
boolean  groundLink,
Tlink l 
)

Version of GenerateLinkSolution for quaternion representation.

Parameters
rThe type of representation used (REP_JOINTS, REP_LINKS...)
tThe transform giving the link pose.
csThe cuik system on which the variables are defined.
solThe solution point where to store the generated values.
groundLinkTRUE for the ground link.
lThe link.

Definition at line 3494 of file link.c.

References GetRotVarID(), HTransformGetElement(), MAX_ROT_VARS, and RegenerateLinkSolutionQLinks().

Referenced by GenerateLinkSolution().

void SetTransVars ( boolean vars,
TCuikSystem cs,
Tlink l 
)

Sets to TRUE the translations variables for the given link in the given array of variables. In general the tranlation variables are not in the cuiksystems since translations are computed accumulating displacements over links. The translation variables are only present in very particular cuiksystems and for links that are at the end of a open sequende of links.

Parameters
varsThe array of booleans to set.
csThe cuiksystem where the link variables are included.
lThe link.

Definition at line 1619 of file link.c.

References GetCSVariableID(), LINK_TRANS, Tlink::name, NEW, NO_UINT, and TRUE.

Referenced by SetPoseVars().

void SetRotVars ( unsigned int  r,
boolean vars,
TCuikSystem cs,
Tlink l 
)

Sets to TRUE the rotation variables for the given link in the given array of variables.

Note that the rotation variables depends on the CT_REPRESENTATION setting.

Parameters
rThe type of representation (REP_JOINTS, REP_LINKS,...)
varsThe array of booleans to set.
csThe cuiksystem where the link variables are included.
lThe link.

Definition at line 1834 of file link.c.

References Error(), GetRotVarID(), LINK_AxisX, LINK_DeformX, LINK_FullRot, LINK_NoRot, LINK_PrismaticX, MAX_ROT_VARS, NO_UINT, REP_FLINKS, REP_JOINTS, REP_LINKS, REP_QLINKS, TRUE, and Tlink::type.

Referenced by SetPoseVars().

boolean EmptyLinkConf ( TLinkConf ld)

Determines if a link internal configuration is empty, i.e., if it is a link without internal deformation degrees of freedom (it may have internal force degrees of freedom but those are not relevant ot the kinematics).

Parameters
ldThe link configuration.
Returns
TRUE if the configuration is kinematically irrelevant.

Definition at line 638 of file link.c.

References IsVariableLengthLink(), and TLinkConf::l.

Referenced by CheckCollisionSolid(), GetLinkConfTransform(), and MoveLinkFromTransform().

void GetLinkConfTransform ( unsigned int  bID,
THTransform t,
TLinkConf ld 
)

Defines a transformation that traverses the link, taking into account the possible link deformation..

Parameters
bIDThe body identifier (the transform can be different for each body)
tThe output transformation.
ldThe information about the link deformation.

Definition at line 643 of file link.c.

References EmptyLinkConf(), GetLinkType(), HTransformIdentity(), HTransformScaleX(), HTransformTx(), TLinkConf::l, LINK_DeformX, LinkNBodies(), and TLinkConf::p.

Referenced by CheckCollisionSolid(), and MoveLinkFromTransform().

void DeleteLinkConf ( TLinkConf ld)

Release memory.

Parameters
ldThe link deformation information structure to delete.

Definition at line 662 of file link.c.

References TLinkConf::p.

Referenced by DeleteLinkTransforms().

void InitNoRotLink ( char *  name,
Tlink l 
)

Initializes a link structure with no bodies. In this particular type of links the orientation of the link is not relevant. Up to now we only use this kink of links for tensegrities where the relevant information is in the connections between links and not in the links themselves.

In principle NoRot links have to be in force equilibrium, except if it is explicitly de-activated (see NoForceEquilibriumLink)

Parameters
nameThe name to give to the link.
lThe links to initialize.

Definition at line 722 of file link.c.

References Tlink::forceEquilibrium, InitLink(), LINK_NoRot, TRUE, and Tlink::type.

void InitAxisXLink ( char *  name,
unsigned int  forceModel,
Tinterval length,
Tinterval force,
Tlink l 
)

Initializes a link structure with no bodies. In this particular type of links only the X axis of the frame attached to the link is relevant for the problem. This is used, for isntance, when defining composite links (e.g. spherical-spherical) where the internal rotation of the link is not relevant.

Parameters
nameThe name to give to the link.
forceModelForce model of the link: NO_FORCE or VAR_FORCE. Can not be LINEAR_FORCE.
lengthLink length. Only relevant for struts, i.e., in tensegrities and must be constant (a range with null size).
forceThe maximum force supported by the link. Only relevant for tensegrities.
lThe links to initialize.

Definition at line 794 of file link.c.

References CopyInterval(), Error(), FALSE, Tlink::force, Tlink::forceModel, InitLink(), IntervalSize(), Tlink::length, LINEAR_FORCE, LINK_AxisX, LowerLimit(), NewInterval(), NO_FORCE, Tlink::rest, Tlink::stiffness, Tlink::type, VAR_FORCE, Tlink::varLength, ZERO, and ZeroInterval().

Referenced by AddLeg2World(), and InitPrismaticXLink().

void InitDeformXLink ( char *  name,
unsigned int  forceModel,
Tinterval length,
double  stiffness,
Tinterval rest,
Tinterval force,
Tlink l 
)

Initializes an axis X link that can elongate along the X axis (i.e., a deformable Axis X link).

Parameters
nameThe name to give to the link.
forceModelForce model of the link: NO_FORCE, VAR_FORCE, LINEAR_FORCE.
lengthLink length. Only relevant for struts, i.e., in tensegrities and must be constant (a range with null size).
stiffnessStiffness of the link. Only relevant for tensegrities.
restThe rest length. Only relevant for tensegrities.
forceThe maximum force supported by the link. Only relevant for tensegrities.
lThe links to initialize.

Definition at line 835 of file link.c.

References AdjustLinkForceParameters(), CopyInterval(), Error(), Tlink::force, Tlink::forceModel, InitLink(), IntervalSize(), Tlink::length, LINEAR_FORCE, LINK_DeformX, LowerLimit(), NewInterval(), NO_FORCE, Tlink::rest, Tlink::stiffness, TRUE, Tlink::type, UpperLimit(), VAR_FORCE, Tlink::varLength, ZERO, and ZeroInterval().

Referenced by AddLeg2World().

void InitPrismaticXLink ( char *  name,
unsigned int  forceModel,
Tinterval length,
double  stiffness,
Tinterval rest,
Tinterval force,
Tlink l 
)

Initializes an axis X link that can extend along the X axis in a prismatic way. It can be seen as the same as a LINK_DeformX but here the deformation is an extension of a prismatic element.

Parameters
nameThe name to give to the link.
forceModelForce model of the link: NO_FORCE, VAR_FORCE, LINEAR_FORCE.
lengthLink length. Only relevant for struts, i.e., in tensegrities and must be constant (a range with null size).
stiffnessStiffness of the link. Only relevant for tensegrities.
restThe rest length. Only relevant for tensegrities.
forceThe maximum force supported by the link. Only relevant for tensegrities.
lThe links to initialize.

Definition at line 893 of file link.c.

References AdjustLinkForceParameters(), CopyInterval(), Error(), Tlink::force, Tlink::forceModel, InitAxisXLink(), InitLink(), IntervalSize(), Tlink::length, LINEAR_FORCE, LINK_PrismaticX, LowerLimit(), NewInterval(), NO_FORCE, Tlink::rest, Tlink::stiffness, TRUE, Tlink::type, UpperLimit(), VAR_FORCE, Tlink::varLength, ZERO, and ZeroInterval().

Referenced by AddLeg2World().

void CopyLink ( Tlink l_dst,
Tlink l_src 
)
void AddBody2Link ( Tpolyhedron b,
Tlink l 
)

Adds a body to the link.

Parameters
bThe convex polyhedron to add to the link
lThe link where to add the new polyhedron.

Definition at line 1027 of file link.c.

References Tlink::allSpheres, Tlink::bodies, CopyPolyhedron(), DECOR_SHAPE, EmptyPolyhedron(), Error(), GetPolyhedronMaxCoordinate(), GetPolyhedronStatus(), GetPolyhedronType(), LINK_NoRot, Tlink::maxCoord, NEW, NewVectorElement(), SPHERE, and Tlink::type.

Referenced by AddBody2Mechanism(), AddLeg2World(), CopyLink(), InitWorldFromMolecule(), and main().

void AddForce2Link ( double  fx,
double  fy,
double  fz,
Tlink l 
)

Adds an external force to a link. The force on the link is initalized to zero and several exteran forces can be added. Forces must be expressed in a global reference frame.

This is only used in tensegrity structures. In other mechanisms this is not relevant at all.

Parameters
fxX component of the force to add.
fyY component of the force to add.
fzZ component of the force to add.
lThe link to modify.

Definition at line 1050 of file link.c.

References Tlink::extForce.

double GetForceOnLink ( unsigned int  dim,
Tlink l 
)

Retrives the force on a link as defined using AddForce2Link.

This is only used in tensegrity structures. In other mechanisms this is not relevant at all.

Parameters
dimThe translation dimension to query.
lThe link to query.
Returns
The force in the required dimension.

Definition at line 1057 of file link.c.

References Error(), and Tlink::extForce.

Referenced by GenerateForceEquilibriumEquations().

void NoForceEquilibriumLink ( Tlink l)

Deactivates the force equilibrium on a link. It only has effect on links of type LINK_NoRot (which have not been previously deactivated)

Parameters
lThe link to modify.

Definition at line 1064 of file link.c.

References FALSE, and Tlink::forceEquilibrium.

boolean IsForceEquilibriumLink ( Tlink l)

Identify links where forces must be in equilibrium (sum to 0, including external forces). Only some of the links in tensegrities are of this type.

Parameters
lThe link to query.
Returns
TRUE if the forces on the link must be in equilibrium.

Definition at line 1070 of file link.c.

References Tlink::forceEquilibrium.

Referenced by GenerateForceEquilibriumEquations().

void SetLinkTrans ( unsigned int  dim,
double  t,
Tlink l 
)

Fixes one of the dimension of the translation of a link.

This is only used in tensegrity structures. In other mechanisms this is not relevant at all.

Parameters
dimThe translation dimension to fix.
tValue for the dimension.
lThe link to modify.

Definition at line 1075 of file link.c.

References Error(), and Tlink::fixedDim.

double GetLinkTrans ( unsigned int  dim,
Tlink l 
)

Retives the one of the dimension of the translation of a link.

This is only used in tensegrity structures. In other mechanisms this is not relevant at all.

Parameters
dimThe translation dimension to fix.
lThe link to query.
Returns
The value assigned for the given translation dimension. INF if queried dimesion in not fixed.

Definition at line 1082 of file link.c.

References Error(), and Tlink::fixedDim.

Referenced by FixLinks().

Tinterval* GetLinkLength ( Tlink l)

The length of the link. Only defined for Axis X links.

Parameters
lThe link to query.
Returns
The link length. 0 if it is undefined.

Definition at line 1089 of file link.c.

References Tlink::length.

Referenced by PrintMechanism().

double GetLinkStiffness ( Tlink l)

Stiffness of the link. Only defined for some Axis X and Deform X links.

Parameters
lThe link to query.
Returns
The link stiffness. 0 if it is undefined.

Definition at line 1094 of file link.c.

References Error(), Tlink::forceModel, LINEAR_FORCE, and Tlink::stiffness.

Tinterval* GetLinkRest ( Tlink l)

The rest interval for a given link. It is a zero-size interval if the rest is a constant. This is only relevant for tensegrites and not used at all for mechanisms.

Parameters
lThe link to query.
Returns
A pointer to the rest interval.

Definition at line 1101 of file link.c.

References Error(), Tlink::forceModel, LINEAR_FORCE, and Tlink::rest.

Tinterval* GetLinkMaxForce ( Tlink l)

The maximum range for compression, tension forces for this link.

Parameters
lThe link to query.
Returns
A pointer to the force interval.

Definition at line 1108 of file link.c.

References Error(), Tlink::force, Tlink::forceModel, and NO_FORCE.

void ChangeLinkReferenceFrame ( unsigned int  r,
double **  p1,
double **  p2,
Tlink l 
)

In order to get the simplest possible set of solutions we can select a reference frame for the link different from that used to defined the bodies. This internal reference frame is defined from two (not necessarily orthogonal) vectors. Therefore, we store the sin and cos between the two vectors defining the internal reference frame and the rotation from the frame where bodies are defined and the internal reference frame.

This function does not change the points defining the bodies. (they remain in the original frame), but it changes the way they are interpreted changing the workings of functions GenerateLinkRot and ApplyLinkRot.

If the two given vectors are (almost) aligned, the internal reference frame is not changed.

When using a CT_REPRESENTATION based on quaternions it is not possible to change the internal link reference frame.

Parameters
rThe type of representation to use (i.e., the CT_REPRESENTATION parameter).
p1Two 3d points defining the first vector for the new internal reference frame.
p2Two 3d points defining the second vector for the new internal reference frame.
lThe link whose reference frame we want to change.

Definition at line 1115 of file link.c.

References Tlink::c, Error(), HTransformSetElement(), Tlink::iR, LINK_FullRot, Tlink::R, REP_JOINTS, REP_QLINKS, Tlink::s, and Tlink::type.

Referenced by InitWorldKinCS().

unsigned int LinkNBodies ( Tlink l)

Gets the number of convex parts of the link.

Parameters
lThe link to query.
Returns
The number of convex parts of the link.

Definition at line 1201 of file link.c.

References Tlink::bodies, and VectorSize().

Referenced by AddLink2Mechanism(), AddLink2World(), CopyLink(), DeleteLink(), GetLinkConfTransform(), InitPQPCD(), InitSolidCD(), InitVcollideCD(), LinkNAtoms(), LinkPrintAtoms(), LinkStoreAtoms(), MoveLinkFromTransform(), PlotLink(), PrintLink(), VisibleLink(), and WorldAtomJacobian().

unsigned int LinkNAtoms ( Tlink l)

Gets the number of atoms (i.e., spheres) in a link.

Parameters
lThe link to query.
Returns
The number of atoms/spheres in the link.

Definition at line 1206 of file link.c.

References GetLinkBody(), GetPolyhedronType(), LinkNBodies(), SPHERE, and VisibleLink().

Referenced by MechanismStoreRigidAtoms().

Tpolyhedron* GetLinkBody ( unsigned int  i,
Tlink l 
)

Gets one of the convex parts of the link.

Parameters
iThe identifier of the convex part to retrive. The identifier of a part is given by the order at which they are added to the link.
lThe link to query.
Returns
A pointer to the requested convex part or NULL if the link does not have any part with the given identifier.

Definition at line 1227 of file link.c.

References Tlink::bodies, and GetVectorElement().

Referenced by CopyLink(), DeleteLink(), GetMechanismDefiningPoint(), InitPQPCD(), InitSolidCD(), InitVcollideCD(), LinkNAtoms(), LinkPrintAtoms(), LinkStoreAtoms(), MoveLinkFromTransform(), PlotLink(), PrintLink(), PrintMechanism(), VisibleLink(), and WorldAtomJacobian().

unsigned int GetLinkBodyStatus ( unsigned int  i,
Tlink l 
)

Gets the status of one of the convex parts of the link.

Parameters
iThe identifier of the convex part to query. The identifier of a part is given by the order at which they are added to the link.
lThe link to query.
Returns
The status (NORMAL, HIDDEN, DECOR) of the requested part or NO_UINT if the link does not have any part with the given identifier.

Definition at line 1238 of file link.c.

References Tlink::bodies, GetPolyhedronStatus(), GetVectorElement(), and NO_UINT.

Referenced by InitPQPCD(), InitSolidCD(), and InitVcollideCD().

unsigned int GetLinkType ( Tlink l)

Gets the type of a link.

Parameters
lThe link to query.
Returns
The type of link (LINK_FullRot, LINK_AxisX, LINK_DeformX, LINK_NoRot).

Definition at line 1254 of file link.c.

References Tlink::type.

Referenced by AddLink2Mechanism(), GetLinkConfTransform(), NoCheckConnectedCollisions(), and PrintMechanism().

boolean IsVariableLengthLink ( Tlink l)

Used to determine wheter a link has variable length (up to now only Deform_X links have variable length).

Parameters
lThe link to query.
Returns
TRUE if the link has variable length.

Definition at line 1259 of file link.c.

References Tlink::varLength.

Referenced by EmptyLinkConf(), GetLinkTransformsFromDOF(), GetMechanismDOFsFromTransforms(), NewRevUpJoint(), NewSphSphUpJoint(), and WorldCoupleTensegrityVariable().

unsigned int GetLinkForceModel ( Tlink l)

Use to determine the force model of the link: NO_FORCE, VAR_FORCE, LINEAR_FORCE.

Parameters
lThe link to query.
Returns
The type of force model of the link.

Definition at line 1264 of file link.c.

References Tlink::forceModel.

Referenced by GenerateForceEquilibriumEquations(), JointForceEquation(), and WorldCoupleTensegrityVariable().

void GetLinkForceVars ( unsigned int  r,
unsigned int *  xID,
unsigned int *  yID,
unsigned int *  zID,
unsigned int *  le,
unsigned int *  re,
unsigned int *  f,
TCuikSystem cs,
Tlink l 
)

Get the identifiers of the force-related of the link, if any.

Parameters
rType of representation used (REP_JOINS, REP_LINKS,...).
xIDx component of the director vector of the tensegrity element.
yIDy component of the director vector of the tensegrity element.
zIDz component of the director vector of the tensegrity element.
leIdentifier of the link length.
reIdentifier of the rest length.
fIdentifier of the force (f=st*(le-re))
csThe CuikSystem including the variables.
lThe link to query.

Definition at line 1269 of file link.c.

References Error(), Tlink::forceModel, GetRotVarID(), LINEAR_FORCE, MAX_ROT_VARS, NO_FORCE, NO_UINT, and VAR_FORCE.

Referenced by GenerateForceEquilibriumEquations(), and WorldCoupleTensegrityVariable().

double LinkPotentialEnergy ( unsigned int  r,
TCuikSystem cs,
double *  p,
Tlink l 
)

Evaluates the potential energy stored in the link. It only works for tensegrity related links with variable length. For other links the output is 0. Thus, we capture the potential energy in the springs, cables, and prismatic legs of tensegrity structures. This energy is somehow compensated by struts (i.e., the compressive elements with constant length). but we do not model this part. We assume that the energy of the struts comes "for free" as a reaction of the energy in the active elements (mainly cables). If the energy of the struts need to be taken into account too, just model the struts as prismatic legs (with low motion raange and high stiffness). Prismatic legs have an associated force model that can be used to compute the associated energy.

In structures with struts, this energy function might not be in equilibrium (i.e., null gradient) in the valid tensegrity configurations.

Parameters
rType of representation used (REP_JOINS, REP_LINKS,...).
csThe cuiksysem on which the dof variables are defined.
pA solution point (in the original form, not in the simplified form).
lThe link to query.
Returns
The pontential energy considering the link as a spring.

Definition at line 1310 of file link.c.

References Error(), Tlink::forceModel, GetRotVarID(), LINEAR_FORCE, MAX_ROT_VARS, NO_UINT, Tlink::stiffness, and Tlink::varLength.

Referenced by WorldPotentialEnergy().

void LinkForceField ( unsigned int  r,
TCuikSystem cs,
double *  p,
double *  g,
Tlink l 
)

Evaluates the gradient of the potential energy stored in the link. It only works for tensegrity related links. For other links the output is a null vector.

IMPORTANT: see the notes in LinkPotentialEnergy

Parameters
rType of representation used (REP_JOINS, REP_LINKS,...).
csThe cuiksysem on which the dof variables are defined.
pA solution point (in the original form, not in the simplified form).
gThe gradient to define
lThe link to query.

Definition at line 1336 of file link.c.

References Error(), Tlink::forceModel, GetRotVarID(), LINEAR_FORCE, MAX_ROT_VARS, NO_UINT, Tlink::stiffness, and Tlink::varLength.

Referenced by WorldForceField().

void GetLinkTransSeq ( Tparameters p,
TCuikSystem cs,
TTransSeq ts,
Tlink l 
)

Build the sequence of transforms traversing the link.

Only has effects for deformable links since in them the shape and thus the transform tot traverse them varies with the configuration.

Note that here we accumulate homogeneous transform traversing the deformable link. This is NOT the the non-homogeneous transform used to model the link deformation.

Parameters
pThe set of parameters.
csThe cuiksysem on which the dof variables are defined.
tsThe resulting sequence of transforms.
lThe link.

Definition at line 1355 of file link.c.

References AddVarTrans2TransSeq(), Error(), GetCSVariableID(), InitTransSeq(), LINK_LENGTH, Tlink::name, NEW, NO_UINT, TX, and Tlink::varLength.

Referenced by GenerateMEquationFromBranch().

void GetLinkTransform ( double *  dof,
THTransform t,
Tlink l 
)

Builds the homogeneous transform traversing the link.

This only works for deformable links since in them the shape and thus the transform tot traverse them varies with the configuration.

This is like GetLinkTransSeq but here the transform is constant instead of symbolic.

Parameters
dofThe degrees of freedom (deformation parameters) for the link.
tThe transform to generate.
lThe link.

Definition at line 1376 of file link.c.

References HTransformIdentity(), HTransformTx(), and Tlink::varLength.

Referenced by GetLinkTransformFromConf(), and GetLinkTransformsFromDOF().

void GetLinkTransformFromConf ( TLinkConf def,
THTransform t,
Tlink l 
)

The same as GetLinkTransform but here the degrees of freedom are taken from the information stored in a link deformation structure.

Parameters
defThe link deformation information.
tThe transform to create.
lThe link to query.

Definition at line 1384 of file link.c.

References GetLinkTransform(), and TLinkConf::p.

Referenced by GetMechanismDOFsFromTransforms().

void GetLinkConfFromSolution ( unsigned int  r,
TCuikSystem cs,
double *  sol,
TLinkConf def,
Tlink l 
)

Defines a link configuration from the a solution point.

This sets the link configuration from the solution. For the reverse see GenerateSolutionFromLinkConf

Parameters
rThe type of representation used (REP_JOINTS, REP_LINKS...)
csThe cuiksystem where the variables are defined.
solThe solution point.
defThe output deformation information.
lThe link.

Definition at line 1389 of file link.c.

References Tlink::forceModel, GetRotVarID(), TLinkConf::l, LINEAR_FORCE, MAX_ROT_VARS, TLinkConf::ndp, NEW, NO_FORCE, NumLinkDOF(), TLinkConf::p, and Tlink::varLength.

Referenced by GetTransform2Link().

void GetLinkConfFromDOF ( double *  dof,
TLinkConf def,
Tlink l 
)

Defines a link configuration from an array of degrees of freedom.

This sets the link configuration from the dof. For the reverse see GenerateDOFFromLinkConf.

Parameters
dofValues for the deformation paramters of the link. Part of the global dof of the system.
defThe output deformation information.
lThe link.

Definition at line 1421 of file link.c.

References Tlink::forceModel, TLinkConf::l, LINEAR_FORCE, TLinkConf::ndp, NEW, NO_FORCE, NumLinkDOF(), TLinkConf::p, and Tlink::varLength.

Referenced by GetLinkTransformsFromDOF().

void GenerateSolutionFromLinkConf ( unsigned int  r,
TCuikSystem cs,
TLinkConf def,
double *  sol,
Tlink l 
)

Sets the solution entries corresponding to the link configuration.

This sets the solution from the link configuration. For the reverse see GetLinkConfFromSolution.

Parameters
rThe type of reperesentation used (REP_JOINT, REP_LINK...)
csThe cuiksystem where the variables are defined.
defThe output deformation information.
solThe solution point to set.
lThe link.

Definition at line 1449 of file link.c.

References Error(), Tlink::forceModel, GetRotVarID(), TLinkConf::l, LINEAR_FORCE, MAX_ROT_VARS, NO_FORCE, NumLinkDOF(), TLinkConf::p, and Tlink::varLength.

Referenced by GenerateLinkSolution().

void GenerateDOFFromLinkConf ( TLinkConf def,
double *  dof,
Tlink l 
)

Sets the dof entries corresponding to the link configuration.

This sets the dof from the link configuration. For the reverse see GetLinkConfFromDOF.

Parameters
defThe deformation information.
dofThe dof array to set.
lThe link.

Definition at line 1478 of file link.c.

References Error(), TLinkConf::l, TLinkConf::ndp, and TLinkConf::p.

Referenced by GetMechanismDOFsFromTransforms().

unsigned int NumLinkDOF ( Tlink l)
inline
Parameters
lThe link to query.
Returns
The number of configuration parameters for the link.

Definition at line 1487 of file link.c.

References Tlink::forceModel, LINEAR_FORCE, VAR_FORCE, and Tlink::varLength.

Referenced by GenerateSolutionFromLinkConf(), GetLinkConfFromDOF(), GetLinkConfFromSolution(), GetLinkDOFLabel(), GetLinkDOFRange(), GetMechanismDOFsFromTransforms(), and WorldInitDOFInfo().

Tinterval* GetLinkDOFRange ( unsigned int  i,
Tlink l 
)

Returns a given link DOF range.

Parameters
iIndex of the deformation parameter.
lThe link to query.
Returns
The DOF range.

Definition at line 1497 of file link.c.

References Error(), Tlink::force, Tlink::length, NumLinkDOF(), Tlink::rest, and Tlink::varLength.

Referenced by GetWorldRangeDOF().

void GetLinkDOFLabel ( unsigned int  i,
char **  n,
Tlink l 
)

Creates a string with a label for a configuration parameter.

This is used to create interfaces.

Parameters
iThe deformation index.
nThe string to create. NULL if actuall not created. The space for the string is allocated here and must be deallocated externally.
lThe link to query.

Definition at line 1532 of file link.c.

References Error(), NEW, NumLinkDOF(), and Tlink::varLength.

Referenced by GetWorldDOFLabel().

boolean IsLinkAllSpheres ( Tlink l)

Returns TRUE if all non-DECOR bodies in the link (i.e., bodies that are considered in the collision checking) are spheres.

This function is used when generating the collision avoidance related equations. If all involved bodies are spheres we do not use separating planes but we directly bound the squared distance between the sphere centers to be larger than the squared sum of radii.

Parameters
lThe link to query.
Returns
TRUE if all non-DECOR bodies in the link are spheres.

Definition at line 1567 of file link.c.

References Tlink::allSpheres.

Referenced by AddBody2Mechanism(), and AddLink2Mechanism().

void SetPoseVars ( unsigned int  r,
boolean vars,
TCuikSystem cs,
Tlink l 
)

Sets to TRUE the translations/rotation variables for the given link in the given array of variables.

Parameters
rThe type of representation used (REP_JOINTS, REP_LINKS,..).
varsThe array of booleans to set.
csThe cuiksystem where the link variables are included.
lThe link.

Definition at line 1572 of file link.c.

References SetRotVars(), and SetTransVars().

unsigned int SetForceVars ( unsigned int  r,
boolean vars,
TCuikSystem cs,
Tlink l 
)

Sets to TRUE the force variables for the given link in the given array of variables. Note that only the force variable is set. Not all the force related variables (like rest length, for instance).

Parameters
rThe type of representation used (REP_JOINTS, REP_LINKS,..).
varsThe array of booleans to set.
csThe cuiksystem where the link variables are included.
lThe link.
Returns
The number of force variables of the link.

Definition at line 1578 of file link.c.

References Tlink::forceModel, GetRotVarID(), MAX_ROT_VARS, NO_FORCE, and TRUE.

Referenced by WorldForceVars().

unsigned int SetForceRelatedVars ( unsigned int  r,
boolean vars,
TCuikSystem cs,
Tlink l 
)

Sets to TRUE the force and rest-length variables, i.e., the variables without a geometric impact.

It is like SetForceVars but the rest-length variable is also set, if necesary.

Parameters
rThe type of representation used (REP_JOINTS, REP_LINKS,..).
varsThe array of booleans to set.
csThe cuiksystem where the link variables are included.
lThe link.
Returns
The number of force variables of the link.

Definition at line 1596 of file link.c.

References Tlink::forceModel, GetRotVarID(), LINEAR_FORCE, MAX_ROT_VARS, NO_FORCE, and TRUE.

Referenced by WorldSimpKinematicVars().

void GetLinkPoseSimpVars ( Tparameters p,
boolean sv,
TCuikSystem cs,
Tlink l 
)

Identifies variables that give the rotation of the links that survive in the simplified cuiksystem.

Thes variables are identified in an array of booleans and their name is printed to a file (one name per row).

Parameters
pThe set of parameters.
svThe array of booleans to set to TRUE for the good variables.
csThe cuiksystem on which the variable are defined.
lThe link.

Definition at line 1883 of file link.c.

References CT_REPRESENTATION, Error(), GetCSVariableName(), GetParameter(), GetRotVarID(), IsSystemVarInSimpCS(), LINK_AxisX, LINK_DeformX, LINK_FullRot, LINK_NoRot, LINK_PrismaticX, MAX_ROT_VARS, NO_UINT, REP_FLINKS, REP_JOINTS, REP_LINKS, REP_QLINKS, TRUE, and Tlink::type.

Referenced by GetWorldSimpVariableMask().

void GenerateLinkRot ( Tparameters p,
unsigned int  lID,
TCuikSystem cs,
Tlink l 
)

Each link has a 3D reference frame formed by three vectors (in general orthonormal vectors unless ChangeLinkReferenceFrame is used). This functions add the variales representing the rotation of this reference frame with respect to the gobal reference frame. The translation from this global reference frame to the origin of the frame attached to the link is given by equations involving only rotation variables (and fixed vectors) and can only be computed at the level where we have together links (mechanisms) and cuiksystems, that is, at the world.h level.

Note that the rotation representation depends on the CT_REPRESENTATION setting.

Parameters
pA set of parameters. They include, for instance the dummification level.
lIDThe identifier of the link in the mechanism. Used to generate unique names for the new variables.
csThe cuiksystem where to add the variables and equations.
lThe link from where to generate the variables and equation.

Definition at line 1941 of file link.c.

References CT_REPRESENTATION, Error(), GenerateLinkConf(), GenerateLinkRotAxisX(), GenerateLinkRotFLinks(), GenerateLinkRotLinks(), GenerateLinkRotQLinks(), GetParameter(), LINK_AxisX, LINK_DeformX, LINK_FullRot, LINK_NoRot, LINK_PrismaticX, REP_FLINKS, REP_JOINTS, REP_LINKS, REP_QLINKS, and Tlink::type.

Referenced by InitWorldKinCS().

void FixLinkZToZero ( Tparameters p,
unsigned int  lID,
TCuikSystem cs,
Tlink l 
)

Fixes the Z compoment of the vector giving the pose of the link. This only works for links represented by a single vector (i.e., AxisX, DeforX, PrismaticX links) and when the representation is not REP_JOINTS)

Parameters
pA set of parameters.
lIDThe identifier of the link in the mechanism.
csThe cuiksystem where to add the Z=0 equations.
lThe link to process.

Definition at line 2405 of file link.c.

References AddEquation2CS(), AddMonomial(), AddVariable2Monomial(), CT_REPRESENTATION, DeleteEquation(), DeleteMonomial(), EQU, Error(), GetParameter(), GetRotVarID(), InitEquation(), InitMonomial(), IsGroundLink, LINK_AxisX, LINK_DeformX, LINK_PrismaticX, MAX_ROT_VARS, NFUN, REP_JOINTS, SetEquationCmp(), SetEquationType(), SetEquationValue(), SYSTEM_EQ, and Tlink::type.

Referenced by FixZToZero().

void ApplyLinkRot ( Tparameters pr,
double  sf,
unsigned int  sv,
double *  p,
Tequation eq,
TCuikSystem cs,
boolean  groundLink,
Tlink l 
)

Apply the changes of basis given by the link reference frame to a vector. This results in an expression that transforms the vector from the local reference frame to the global one. These expressions are added to the given equations (one expression for X, another for Y, and another for Z).

Parameters
prThe set of parameters.
sfConstant scale factor to apply to the input vector.
svVariable scale factor given as the identifier of the range in the given box whose center have to be used as scale factor. If no variable scale factor is to be used this parameter should be NO_UINT.
pThe 3D vector in the link reference frame that we want to transform to the global one and to add to trans.
eqSet of 3 equations where to add the 3 expressions resulting from this function (one for the X component of the vector in the globla frame, another for the Y expression and, finally the expression for the Z component).
csThe cuik system on which the boxes are defiend. It is used to, given the name of the variables corresponding the reference frame of the given link, retrive its numerical identifiers. The numerical identifier of the variable is used to generate a unique name for it.
groundLinkTRUE if the given link is the ground link.
lThe link to use to rotate the given input vector p.

Definition at line 2441 of file link.c.

References ApplyLinkRotAxisX(), ApplyLinkRotDeformX(), ApplyLinkRotFLinks(), ApplyLinkRotLinks(), ApplyLinkRotQLinks(), CT_REPRESENTATION, Error(), GetParameter(), LINK_AxisX, LINK_DeformX, LINK_FullRot, LINK_NoRot, LINK_PrismaticX, Norm(), REP_FLINKS, REP_JOINTS, REP_LINKS, REP_QLINKS, TRUE, Tlink::type, and ZERO.

Referenced by ApplyLinkRotNoDeform(), ApplyLinkRotVar(), GenerateJointEquations(), GenerateJointEquationsInBranch(), GenerateJointRangeEquations(), and WorldFixTensegrityAddon().

void ApplyLinkRotNoDeform ( Tparameters pr,
double  sf,
unsigned int  sv,
double *  p,
Tequation eq,
TCuikSystem cs,
boolean  groundLink,
Tlink l 
)

Version of ApplyLinkRot for deformable links where the deformation is not considered. For non-deformable links this is the same as ApplyLinkRot.

This can also be seen as a ApplyLinkRot for a deformable links with a particular deformation status (i.e., a default deformation) that is given in the 'sf' and 'sv' parameters.

Parameters
prThe set of parameters.
sfConstant scale factor to apply to the input vector.
svVariable scale factor given as the identifier of the range in the given box whose center have to be used as scale factor. If no variable scale factor is to be used this parameter should be NO_UINT.
pThe 3D vector in the link reference frame that we want to transform to the global one and to add to trans.
eqSet of 3 equations where to add the 3 expressions resulting from this function (one for the X component of the vector in the globla frame, another for the Y expression and, finally the expression for the Z component).
csThe cuik system on which the boxes are defiend. It is used to, given the name of the variables corresponding the reference frame of the given link, retrive its numerical identifiers. The numerical identifier of the variable is used to generate a unique name for it.
groundLinkTRUE if the given link is the ground link.
lThe link to use to rotate the given input vector p.

Definition at line 2498 of file link.c.

References ApplyLinkRot(), ApplyLinkRotAxisX(), and Tlink::varLength.

Referenced by JointForceEquation().

void ApplyLinkRotVar ( Tparameters pr,
double  sf,
unsigned int *  vID,
Tequation eq,
TCuikSystem cs,
boolean  groundLink,
Tlink l 
)

Apply the changes of basis given by the link reference frame to a vector of variables representing a point in local coordinates of the link.

Parameters
prThe set of parameters.
sfConstant scale factor to apply to the input vector.
vIDThe 3D vector of variables to rotate.
eqSet of 3 equations where to add the 3 expressions resulting from this function (one for the X component of the vector in the globla frame, another for the Y expression and, finally the expression for the Z component).
csThe cuik system on which the boxes are defiend. It is used to, given the name of the variables corresponding the reference frame of the given link, retrive its numerical identifiers. The numerical identifier of the variable is used to generate a unique name for it.
groundLinkTRUE if the given link is the ground link.
lThe link to use to rotate the given input vector p.

Definition at line 2881 of file link.c.

References ApplyLinkRot(), CT_REPRESENTATION, DeleteEquation(), Error(), GetParameter(), GetRotVarID(), InitEquation(), LINK_AxisX, LINK_DeformX, LINK_FullRot, LINK_NoRot, LINK_PrismaticX, MAX_ROT_VARS, NO_UINT, Tlink::R, REP_JOINTS, Tlink::type, VarAccumulateEquations(), VarScaleEquation(), and ZERO.

void RegenerateLinkSolution ( Tparameters p,
TCuikSystem cs,
double *  sol,
boolean  groundLink,
Tlink l 
)

Solution points only include values for the system (and secondary) variables. However, in some formulations, the frame of reference for each link is represented using not only system variables, but dummy or force variables too. This function computes the values for the link-related non-basic variables form the basic ones for a given link.

Parameters
pThe set of parameters.
csThe cuik system on which the boxes are defiend. It is used to, given the name of the variables corresponding the reference frame of the given link, retrive its numerical identifiers, i.e., the number of range of the box to use to instantiate each variable.
solThe solution point with the values for the system variables. At the end of the function, this vector also has values for the link-related non-basic variables.
groundLinkTRUE if the given link is the ground link. The rotation matrix for the ground link is fixed (the identity) and, its rotation matrix generates no variables (nor system nor dummy).
lThe link.

Definition at line 2985 of file link.c.

References CT_REPRESENTATION, Error(), GetParameter(), LINK_FullRot, RegenerateLinkSolutionConf(), RegenerateLinkSolutionLinks(), RegenerateLinkSolutionQLinks(), REP_FLINKS, REP_JOINTS, REP_LINKS, REP_QLINKS, and Tlink::type.

Referenced by RegenerateMechanismSolution().

void RegenerateLinkBox ( Tparameters p,
TCuikSystem cs,
Tbox b,
boolean  groundLink,
Tlink l 
)

This is the same as RegenerateLinkSolution but working on solution boxes instead of on solution points (i.e. it is interval-based instead of floating point based).

Parameters
pThe set of parameters.
csThe cuik system on which the boxes are defiend. It is used to, given the name of the variables corresponding the reference frame of the given link, retrive its numerical identifiers, i.e., the number of range of the box to use to instantiate each variable.
bThe solution box with the values for the system variables. At the end of the function, this box also has values for the link-related dummy variables.
groundLinkTRUE if the given link is the ground link. The rotation matrix for the ground link is fixed (the identity) and, its rotation matrix generates no variables (nor system nor dummy).
lThe link.

Definition at line 3067 of file link.c.

References CT_REPRESENTATION, Error(), GetParameter(), LINK_FullRot, RegenerateLinkBoxConf(), RegenerateLinkBoxLinks(), RegenerateLinkBoxQLinks(), REP_FLINKS, REP_JOINTS, REP_LINKS, REP_QLINKS, and Tlink::type.

Referenced by RegenerateMechanismBox().

void GetTransform2Link ( Tparameters p,
TCuikSystem cs,
double *  sol,
boolean  groundLink,
double *  trans,
THTransform t,
TLinkConf def,
Tlink l 
)

Returns the homogeneous transform with the position and orientation of the link for a given solution point.

Parameters
pThe set of parameters.
csThe cuik system on which the boxes are defined. It is used to, given the name of the variables corresponding the reference frame of the given link, retrive its numerical identifiers, i.e., the number of range of the box to use to instantiate each variable.
solThe solution point including values for all variables (i.e., already regenerated using RegenerateLinkSolution before calling this function).
groundLinkTRUE if the given link is the ground link.
trans3d vector with the translation from the ground link to this link. The variables for these translations are removed from the cuiksystems and computed from rotations and fixed vectors. Consequently they can only be computed at the level where we have cuiksystems and links (i.e. in world.h).
tThe returned homogeneous transform.
defConfiguration parameter. Complements 't' for visualization.
lThe link whose reference frame we want to retrive.

Definition at line 3172 of file link.c.

References CT_REPRESENTATION, Error(), GetLinkConfFromSolution(), GetParameter(), GetTransform2LinkAxisX(), GetTransform2LinkFLinks(), GetTransform2LinkLinks(), GetTransform2LinkQLinks(), HTransformTxyz(), LINK_AxisX, LINK_DeformX, LINK_FullRot, LINK_NoRot, LINK_PrismaticX, REP_FLINKS, REP_JOINTS, REP_LINKS, REP_QLINKS, and Tlink::type.

Referenced by GetLinkTransformsFromSolution(), and PrintJointAxes().

void GenerateLinkSolution ( Tparameters p,
THTransform t,
TLinkConf def,
TCuikSystem cs,
double *  sol,
boolean  groundLink,
Tlink l 
)

Generate the solution variables form an homogenous transform giving the pose of the link and the internal link configuration.

Parameters
pThe set of parameters.
tThe transform giving the link pose.
defThe internal configuration of the link.
csThe cuik system on which the variables are defined.
solThe solution point where to store the generated values.
groundLinkTRUE for the ground link.
lThe link.

Definition at line 3382 of file link.c.

References CT_REPRESENTATION, Error(), GenerateLinkSolutionAxisX(), GenerateLinkSolutionFLinks(), GenerateLinkSolutionLinks(), GenerateLinkSolutionQLinks(), GenerateSolutionFromLinkConf(), GetParameter(), LINK_AxisX, LINK_DeformX, LINK_FullRot, LINK_NoRot, LINK_PrismaticX, REP_FLINKS, REP_JOINTS, REP_LINKS, REP_QLINKS, and Tlink::type.

Referenced by WorldDOF2Sol().

boolean VisibleLink ( Tlink l)

Checks if a links has some visible parts, i.e., if not all the parts of the link are HIDDEN.

Parameters
lThe link to query.
Returns
TRUE if the link has, at least, one NORMAL of DECOR part.

Definition at line 3521 of file link.c.

References FALSE, GetLinkBody(), GetPolyhedronStatus(), HIDDEN_SHAPE, LINK_NoRot, LinkNBodies(), and Tlink::type.

Referenced by LinkNAtoms(), LinkPrintAtoms(), LinkStoreAtoms(), MoveLinkFromTransform(), and PlotLink().

double GetLinkMaxCoordinate ( Tlink l)

Returns the sum of the maximum coordinate value (either for X,Y or Z) for all the convex polyhedrons in the link. This is used in higher levels to define an over-estimate bounding-box of the world. This bounding box is used to define the ranges for some of the coordinate and separating planes variables.

Parameters
lThe link to query.
Returns
The sum of the maximum coordinate values for all bodies in the link.

Definition at line 3540 of file link.c.

References Tlink::maxCoord.

Referenced by AddBody2Mechanism(), and AddLink2Mechanism().

void LinkPrintAtoms ( FILE *  f,
THTransform tl,
Tlink l 
)

Stores the centers of the atoms in a given link in global coordinates.

This is used only whent the world represents a molecule and we want to store the atom (i.e., the sphere) positions into a file.

Parameters
fThe file where to store the atom centers.
tlThe transform to get the global coordinates of the link.
lThe link to process.

Definition at line 3545 of file link.c.

References GetLinkBody(), LinkNBodies(), PolyhedronPrintCenter(), and VisibleLink().

Referenced by MechanismPrintAtoms().

void LinkStoreAtoms ( FILE *  f,
THTransform tl,
Tlink l 
)

Stores the centers of the atoms and their radius in a given link in global coordinates.

This is an auxiliary function of MechanismStoreRigidAtoms.

Parameters
fThe file where to store the atom centers.
tlThe transform to get the global coordinates of the link.
lThe link to process.

Definition at line 3562 of file link.c.

References GetLinkBody(), LinkNBodies(), PolyhedronPrintCenterAndRadius(), and VisibleLink().

Referenced by MechanismStoreRigidAtoms().

void PlotLink ( Tplot3d pt,
double  axesLength,
Tlink l 
)

Adds a link to a 3d scene. It adds the diffent parts of the link as if they are expressed in the global frame. To displace the use MoveLinkFromTransform

Parameters
ptThe 3d geometry where to add the link.
axesLength>0 to display the link axes. The value is the length of the lines representing the axes. The reference axes for the link are represeted as red for X, green for Y and blue for Z.
lThe link to add to the scene.

Definition at line 3579 of file link.c.

References Tlink::axisID, Close3dObject(), DeleteColor(), GetLinkBody(), LINK_AxisX, LINK_DeformX, LINK_PrismaticX, LinkNBodies(), NewColor(), NO_UINT, PlotPolyhedron(), PlotVect3d(), StartNew3dObject(), Tlink::type, and VisibleLink().

Referenced by PlotMechanism().

void MoveLinkFromTransform ( Tplot3d pt,
THTransform t,
TLinkConf def,
Tlink l 
)

Displaces a link previously added to a 3d scene from the transform giving the pose of the link.

This function triggers an error (actually the error is triggered in GetTransform2Link) if applied to the groundlink. Note that the groundLink is not suposed to move.

Parameters
ptThe 3d scene where the apply the displacement.
tThe transform giving the pose of the link.
defThe configuration parameters for the link.
lThe link to move.

Definition at line 3615 of file link.c.

References Tlink::axisID, EmptyLinkConf(), GetLinkBody(), GetLinkConfTransform(), HTransformDelete(), HTransformProduct(), LinkNBodies(), Move3dObject(), MovePolyhedron(), NO_UINT, and VisibleLink().

Referenced by MoveMechanismFromTransforms().

void PrintLink ( FILE *  f,
char *  path,
char *  prefix,
Tlink l 
)

Stores the link information into a file in the format valid to be read by InitWorldFromFile.

Parameters
fThe file where to store the information.
pathThe working folder.
prefixPrefix to add to the file names for the bodies in this link, if any.
lThe link to print.

Definition at line 3652 of file link.c.

References GetLinkBody(), LINK_FullRot, LinkNBodies(), Tlink::name, NEW, PrintPolyhedron(), and Tlink::type.

Referenced by PrintMechanism().

void DeleteLink ( Tlink l)