link.c File Reference

Introduction

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

boolean TrivialInertiaMatrix (double **m)
 Identifies trivial inertia matrices. More...
 
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...
 
double GetLinkConfExtension (TLinkConf *ld)
 Extension of the link. 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, double mass, double **iMatrix, THTransform *iFrame, Tlink *l)
 Constructor. More...
 
void InitNoRotLink (char *name, Tlink *l)
 Constructor. More...
 
void InitAxisXLink (char *name, unsigned int forceModel, Tinterval *length, Tinterval *force, double mass, double **iMatrix, THTransform *iFrame, Tlink *l)
 Constructor. More...
 
void InitDeformXLink (char *name, unsigned int forceModel, Tinterval *length, double stiffness, Tinterval *rest, Tinterval *force, double mass, double **iMatrix, THTransform *iFrame, Tlink *l)
 Constructor. More...
 
void InitPrismaticXLink (char *name, unsigned int forceModel, Tinterval *length, double stiffness, Tinterval *rest, Tinterval *force, double mass, double **iMatrix, THTransform *iFrame, Tlink *l)
 Constructor. More...
 
void InitConnectLink (char *name, unsigned int type, unsigned int l1, unsigned int l2, double *p1, double *p2, double r, Tcolor *c, unsigned int gr, unsigned int bs, Tinterval *rest, double stiffness, Tlink *l)
 Constructor. More...
 
void CopyLink (Tlink *l_dst, Tlink *l_src)
 Copy constructor. More...
 
void SetLinkMass (double mass, Tlink *l)
 Defines the mass of the link. More...
 
void SetLinkInertiaMatrix (double **m, Tlink *l)
 Defines the inertia matrix of the link. More...
 
void SetLinkInertialFrame (THTransform *t, Tlink *l)
 Defines the inertial frame of the link. More...
 
double GetLinkMass (Tlink *l)
 Gives the mass of the link. More...
 
double ** GetLinkInertiaMatrix (Tlink *l)
 Gives the inertia matrix of the link. More...
 
THTransformGetLinkInertialFrame (Tlink *l)
 Gives the inertial frame of the link. 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 GetTransform2ConnectionLink (THTransform *tl, THTransform *t, TLinkConf *def, Tlink *l)
 Transform to a connnection link. More...
 
void GetConnectionLinkWrench (THTransform *tl, double *wr1, double *wr2, Tlink *l)
 Wrench exerced by a spring on the connected links. More...
 
double GetConnectionLinkPotentialEnergy (THTransform *tl, Tlink *l)
 Potential energy of a link. 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 IsConnectionCable (Tlink *l)
 Identifies connection cables. More...
 
boolean IsConnectionSpring (Tlink *l)
 Identifies connection springs. More...
 
boolean IsConnectionLeg (Tlink *l)
 Identifies connection legs. More...
 
unsigned int GetConnectLinkFrom (Tlink *l)
 First link connected by a connection link. More...
 
unsigned int GetConnectLinkTo (Tlink *l)
 Second link connected by a connection link. More...
 
void GetConnectLinkPointFrom (double *p, Tlink *l)
 Point on the first link connected by a connection link. More...
 
void GetConnectLinkPointTo (double *p, Tlink *l)
 Point on the second link connected by a connection link. 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, char *l1, char *l2, Tlink *l)
 Stores the link information into a file. More...
 
void DeleteLink (Tlink *l)
 Destructor. More...
 

Macro Definition Documentation

◆ MAX_ROT_VARS

#define MAX_ROT_VARS   14

Maximum number of variables used to represent a link rotation. Used to allocate space for the GetRotVarID functions.

Definition at line 26 of file link.c.

Function Documentation

◆ TrivialInertiaMatrix()

boolean TrivialInertiaMatrix ( double **  m)

Identifies trivial (i.e., null) inertia matrices.

Parameters
mThe inertia matrix to check.
Returns
TRUE if the matrix is the identity.

Definition at line 691 of file link.c.

References ZERO.

Referenced by PrintLink().

◆ AdjustLinkForceParameters()

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 790 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().

◆ GetRotVarID()

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 1862 of file link.c.

References Tlink::csvID, Error(), GetRotVarIDAxisX(), GetRotVarIDFLinks(), GetRotVarIDLinks(), GetRotVarIDQLinks(), LINK_AxisX, LINK_Connect, 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().

◆ GetRotVarIDAxisX()

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 1938 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().

◆ GetRotVarIDFLinks()

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 1982 of file link.c.

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

Referenced by GetRotVarID().

◆ GetRotVarIDLinks()

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 2007 of file link.c.

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

Referenced by GetRotVarID().

◆ GetRotVarIDQLinks()

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 2031 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().

◆ GenerateLinkConf()

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 2215 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().

◆ GenerateLinkRotAxisX()

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 2307 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().

◆ GenerateLinkRotLinks()

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 2457 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().

◆ GenerateLinkRotFLinks()

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 2343 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().

◆ GenerateLinkRotQLinks()

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 2537 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().

◆ ApplyLinkRotAxisX()

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 2748 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().

◆ ApplyLinkRotDeformX()

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 2802 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().

◆ ApplyLinkRotLinks()

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 2926 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().

◆ ApplyLinkRotFLinks()

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 2860 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().

◆ ApplyLinkRotQLinks()

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 2995 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().

◆ RegenerateLinkSolutionConf()

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 3261 of file link.c.

Referenced by RegenerateLinkSolution().

◆ RegenerateLinkSolutionLinks()

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 3266 of file link.c.

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

Referenced by GenerateLinkSolutionLinks(), and RegenerateLinkSolution().

◆ RegenerateLinkSolutionQLinks()

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 3285 of file link.c.

References GetRotVarID(), and MAX_ROT_VARS.

Referenced by GenerateLinkSolutionQLinks(), and RegenerateLinkSolution().

◆ RegenerateLinkBoxConf()

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 3345 of file link.c.

Referenced by RegenerateLinkBox().

◆ RegenerateLinkBoxLinks()

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 3350 of file link.c.

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

Referenced by RegenerateLinkBox().

◆ RegenerateLinkBoxQLinks()

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 3388 of file link.c.

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

Referenced by RegenerateLinkBox().

◆ GetTransform2LinkAxisX()

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 3576 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().

◆ GetTransform2LinkLinks()

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 3651 of file link.c.

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

Referenced by GetTransform2Link().

◆ GetTransform2LinkFLinks()

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 3612 of file link.c.

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

Referenced by GetTransform2Link().

◆ GetTransform2LinkQLinks()

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 3695 of file link.c.

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

Referenced by GetTransform2Link().

◆ GenerateLinkSolutionAxisX()

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 3785 of file link.c.

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

Referenced by GenerateLinkSolution().

◆ GenerateLinkSolutionLinks()

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 3827 of file link.c.

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

Referenced by GenerateLinkSolution().

◆ GenerateLinkSolutionFLinks()

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 3800 of file link.c.

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

Referenced by GenerateLinkSolution().

◆ GenerateLinkSolutionQLinks()

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 3856 of file link.c.

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

Referenced by GenerateLinkSolution().

◆ SetTransVars()

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 sequence of links.

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

Definition at line 1843 of file link.c.

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

Referenced by SetPoseVars().

◆ SetRotVars()

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 2064 of file link.c.

References Error(), GetRotVarID(), LINK_AxisX, LINK_Connect, 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().

◆ EmptyLinkConf()

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 649 of file link.c.

References IsVariableLengthLink(), and TLinkConf::l.

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

◆ GetLinkConfExtension()

double GetLinkConfExtension ( TLinkConf ld)

Extension of the link. Only defined for prismatic links. For other links it triggers an error.

Parameters
ldThe link configuration to query.
Returns
The link extension.

Definition at line 654 of file link.c.

References EmptyLinkConf(), Error(), GetLinkType(), TLinkConf::l, LINK_PrismaticX, and TLinkConf::p.

Referenced by main().

◆ GetLinkConfTransform()

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 665 of file link.c.

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

Referenced by CheckCollisionSolid(), and MoveLinkFromTransform().

◆ DeleteLinkConf()

void DeleteLinkConf ( TLinkConf ld)

Release memory.

Parameters
ldThe link deformation information structure to delete.

Definition at line 684 of file link.c.

References TLinkConf::p.

Referenced by DeleteLinkTransforms().

◆ InitLink()

void InitLink ( char *  name,
double  mass,
double **  iMatrix,
THTransform iFrame,
Tlink l 
)

Initializes a link structure with no bodies.

Parameters
nameThe name to give to the link.
massThe mass of the link. If 0, the link has no dinyamic information.
iMatrixInertia matrix. If null a zero matrix is set.
iFrameInertial frame. If null the identity is used.
lThe links to initialize.

Definition at line 701 of file link.c.

References Tlink::allSpheres, Tlink::axisID, Tlink::bodies, Tlink::c, CopyVoidPtr(), Tlink::csvID, DeleteVoidPtr(), Error(), Tlink::extForce, FALSE, Tlink::fixedDim, Tlink::force, Tlink::forceEquilibrium, Tlink::forceModel, HTransformCopy(), HTransformIdentity(), Tlink::iFrame, Tlink::iMatrix, INF, INIT_NUM_SHAPES, InitVector(), Tlink::iR, Tlink::l1, Tlink::l2, Tlink::length, LINK_FullRot, Tlink::mass, Tlink::maxCoord, Tlink::name, NEW, NewInterval(), NO_FORCE, NO_UINT, Tlink::nvID, Tlink::p1, Tlink::p2, Tlink::R, Tlink::rest, Tlink::s, Tlink::stiffness, TRUE, Tlink::type, Tlink::varLength, and Tlink::vID.

Referenced by InitAxisXLink(), InitConnectLink(), InitDeformXLink(), InitNoRotLink(), InitPrismaticXLink(), InitWorldFromMolecule(), and main().

◆ InitNoRotLink()

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 781 of file link.c.

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

◆ InitAxisXLink()

void InitAxisXLink ( char *  name,
unsigned int  forceModel,
Tinterval length,
Tinterval force,
double  mass,
double **  iMatrix,
THTransform iFrame,
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 instance, 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.
massThe mass of the link. If 0, the link has no dinyamic information.
iMatrixInertia matrix. If null a zero matrix is set.
iFrameInertial frame. If null the identity is used.
lThe links to initialize.

Definition at line 853 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().

◆ InitDeformXLink()

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

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

Todo:
Adjust the dynamic parameters according to the deformation.
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.
massThe mass of the link. If 0, the link has no dinyamic information.
iMatrixInertia matrix. If null a zero matrix is set.
iFrameInertial frame. If null the identity is used.
lThe links to initialize.

Definition at line 895 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().

◆ InitPrismaticXLink()

void InitPrismaticXLink ( char *  name,
unsigned int  forceModel,
Tinterval length,
double  stiffness,
Tinterval rest,
Tinterval force,
double  mass,
double **  iMatrix,
THTransform iFrame,
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.

Todo:
Adjust the dynamic parameters according to the extension of the prismatic 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.
massThe mass of the link. If 0, the link has no dinyamic information.
iMatrixInertia matrix. If null a zero matrix is set.
iFrameInertial frame. If null the identity is used.
lThe links to initialize.

Definition at line 954 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().

◆ InitConnectLink()

void InitConnectLink ( char *  name,
unsigned int  type,
unsigned int  l1,
unsigned int  l2,
double *  p1,
double *  p2,
double  r,
Tcolor c,
unsigned int  gr,
unsigned int  bs,
Tinterval rest,
double  stiffness,
Tlink l 
)

Initializes a connection link: a cable, spring or leg connecting two different links.

Parameters
nameThe name to give to the link.
typeType of connection: C_CABLE, C_SPRING, C_LEG.
l1The identifier of the first link to connect.
l2The identifier of the second link to connect.
p1The point in the first link.
p2The point in the second link.
rThe radious of the link.
cThe color of the link.
grThe granularity of the link.
bsStatus of the body: NORMAL, HIDDEN, DECOR.
restRest length. Only used for springs.
stiffnessStiffness constant. Only used for springs.
lThe links to initialize.

Definition at line 1026 of file link.c.

References AddBody2Link(), C_CABLE, C_LEG, C_SPRING, CopyInterval(), DECOR_SHAPE, DeletePolyhedron(), Error(), HIDDEN_SHAPE, InitLink(), Tlink::l1, Tlink::l2, LINK_Connect, NewCylinder(), NewSphere(), NewSpring(), Tlink::p1, Tlink::p2, Tlink::rest, Tlink::stiffness, and Tlink::type.

◆ CopyLink()

◆ SetLinkMass()

void SetLinkMass ( double  mass,
Tlink l 
)

Sets the mass of the link. If set to 0, the dynamic information is reseted.

Parameters
massThe new mass.
lThe link to modify.

Definition at line 1196 of file link.c.

References Error(), Tlink::mass, SetLinkInertialFrame(), and SetLinkInertiaMatrix().

◆ SetLinkInertiaMatrix()

void SetLinkInertiaMatrix ( double **  m,
Tlink l 
)

Sets the inertia matrix of the link.

Parameters
mThe new inertia matrix (a 3x3 symmetric matrix).
lThe link to modify.

Definition at line 1209 of file link.c.

References Tlink::iMatrix.

Referenced by SetLinkMass().

◆ SetLinkInertialFrame()

void SetLinkInertialFrame ( THTransform t,
Tlink l 
)

Sets the inertial frame of the link, i.e., the transfrom from the link reference frame to the inertial reference frame. The inertial reference frame is centered at the center of mass of the link.

Parameters
tThe new transfrom to the inertial frame.
lThe link to modify.

Definition at line 1223 of file link.c.

References HTransformCopy(), HTransformIdentity(), and Tlink::iFrame.

Referenced by SetLinkMass().

◆ GetLinkMass()

double GetLinkMass ( Tlink l)
inline

Gives the mass of the link (0 if not set explicitly).

Parameters
lThe link to query.
Returns
The link mass.

Definition at line 1231 of file link.c.

References Tlink::mass.

Referenced by InitHandC(), and main().

◆ GetLinkInertiaMatrix()

double** GetLinkInertiaMatrix ( Tlink l)

Gives the (symmetric) inertia matrix of the link.

Parameters
lThe link to query.
Returns
Pointer to the inertia matrix.

Definition at line 1236 of file link.c.

References Tlink::iMatrix.

Referenced by InitHandC(), and main().

◆ GetLinkInertialFrame()

THTransform* GetLinkInertialFrame ( Tlink l)

Gives the inertial frame of the link with respect to the link frame. This is the identity if not set explicity.

Parameters
lThe link to query.
Returns
The link inertial frame (w.r.t. the link frame).

Definition at line 1241 of file link.c.

References Tlink::iFrame.

Referenced by InitHandC(), and main().

◆ AddBody2Link()

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 1246 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(), InitConnectLink(), InitWorldFromMolecule(), and main().

◆ AddForce2Link()

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 1269 of file link.c.

References Tlink::extForce.

◆ GetForceOnLink()

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 1276 of file link.c.

References Error(), and Tlink::extForce.

Referenced by GenerateForceEquilibriumEquations().

◆ NoForceEquilibriumLink()

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 1283 of file link.c.

References FALSE, and Tlink::forceEquilibrium.

◆ IsForceEquilibriumLink()

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 1289 of file link.c.

References Tlink::forceEquilibrium.

Referenced by GenerateForceEquilibriumEquations().

◆ SetLinkTrans()

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 1294 of file link.c.

References Error(), and Tlink::fixedDim.

◆ GetLinkTrans()

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 1301 of file link.c.

References Error(), and Tlink::fixedDim.

Referenced by FixLinks().

◆ GetLinkLength()

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 1308 of file link.c.

References Tlink::length.

Referenced by PrintMechanism().

◆ GetLinkStiffness()

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 1313 of file link.c.

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

◆ GetLinkRest()

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 1321 of file link.c.

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

◆ GetLinkMaxForce()

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 1329 of file link.c.

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

◆ ChangeLinkReferenceFrame()

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 1336 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().

◆ LinkNBodies()

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 1422 of file link.c.

References Tlink::bodies, and VectorSize().

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

◆ LinkNAtoms()

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 1427 of file link.c.

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

Referenced by MechanismStoreRigidAtoms().

◆ GetLinkBody()

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 1448 of file link.c.

References Tlink::bodies, and GetVectorElement().

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

◆ GetLinkBodyStatus()

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 1459 of file link.c.

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

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

◆ GetLinkName()

◆ GetLinkType()

◆ IsVariableLengthLink()

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 1480 of file link.c.

References Tlink::varLength.

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

◆ GetLinkForceModel()

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 1485 of file link.c.

References Tlink::forceModel.

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

◆ GetLinkForceVars()

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 1490 of file link.c.

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

Referenced by GenerateForceEquilibriumEquations(), and WorldCoupleTensegrityVariable().

◆ LinkPotentialEnergy()

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 1534 of file link.c.

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

Referenced by WorldPotentialEnergy().

◆ LinkForceField()

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 1560 of file link.c.

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

Referenced by WorldForceField().

◆ GetLinkTransSeq()

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 1579 of file link.c.

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

Referenced by GenerateMEquationFromBranch().

◆ GetLinkTransform()

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 1600 of file link.c.

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

Referenced by GetLinkTransformFromConf(), and GetLinkTransformsFromDOF().

◆ GetLinkTransformFromConf()

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 1608 of file link.c.

References GetLinkTransform(), and TLinkConf::p.

Referenced by GetMechanismDOFsFromTransforms().

◆ GetLinkConfFromSolution()

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 1613 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().

◆ GetLinkConfFromDOF()

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 1645 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().

◆ GenerateSolutionFromLinkConf()

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 1673 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().

◆ GenerateDOFFromLinkConf()

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 1702 of file link.c.

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

Referenced by GetMechanismDOFsFromTransforms().

◆ NumLinkDOF()

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

Definition at line 1711 of file link.c.

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

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

◆ GetLinkDOFRange()

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 1721 of file link.c.

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

Referenced by GetWorldRangeDOF().

◆ GetLinkDOFLabel()

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 1756 of file link.c.

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

Referenced by GetWorldDOFLabel().

◆ IsLinkAllSpheres()

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 1791 of file link.c.

References Tlink::allSpheres.

Referenced by AddBody2Mechanism(), and AddLink2Mechanism().

◆ SetPoseVars()

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 1796 of file link.c.

References SetRotVars(), and SetTransVars().

◆ SetForceVars()

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 1802 of file link.c.

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

Referenced by WorldForceVars().

◆ SetForceRelatedVars()

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 1820 of file link.c.

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

Referenced by WorldSimpKinematicVars().

◆ GetLinkPoseSimpVars()

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 2114 of file link.c.

References CT_REPRESENTATION, Error(), GetCSVariableName(), GetParameter(), GetRotVarID(), IsSystemVarInSimpCS(), LINK_AxisX, LINK_Connect, 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().

◆ GenerateLinkRot()

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 2173 of file link.c.

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

Referenced by InitWorldKinCS().

◆ FixLinkZToZero()

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 2639 of file link.c.

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

Referenced by FixZToZero().

◆ ApplyLinkRot()

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 2678 of file link.c.

References ApplyLinkRotAxisX(), ApplyLinkRotDeformX(), ApplyLinkRotFLinks(), ApplyLinkRotLinks(), ApplyLinkRotQLinks(), CT_REPRESENTATION, Error(), GetParameter(), LINK_AxisX, LINK_Connect, 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().

◆ ApplyLinkRotNoDeform()

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 2738 of file link.c.

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

Referenced by JointForceEquation().

◆ ApplyLinkRotVar()

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 3121 of file link.c.

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

◆ RegenerateLinkSolution()

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 3228 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().

◆ RegenerateLinkBox()

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 3310 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().

◆ GetTransform2Link()

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 3415 of file link.c.

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

Referenced by GetLinkTransformsFromSolution(), and PrintJointAxes().

◆ GetTransform2ConnectionLink()

void GetTransform2ConnectionLink ( THTransform tl,
THTransform t,
TLinkConf def,
Tlink l 
)

Computes the transform to a connectin link given the transforms to the normal links.

Parameters
tlThe transforms to the different normal links.
tThe transform to compute.
defThe link configuration.
lThe link.

Definition at line 3461 of file link.c.

References AXIS_H, AXIS_X, AXIS_Y, AXIS_Z, CrossProduct(), DefineNormalVector(), DifferenceVector(), Error(), HTransformApply(), HTransformIdentity(), HTransformSetElement(), TLinkConf::l, Tlink::l1, Tlink::l2, LINK_Connect, TLinkConf::ndp, Norm(), Normalize(), TLinkConf::p, Tlink::p1, Tlink::p2, and Tlink::type.

Referenced by GetLinkTransformsFromDOF(), and GetLinkTransformsFromSolution().

◆ GetConnectionLinkWrench()

void GetConnectionLinkWrench ( THTransform tl,
double *  wr1,
double *  wr2,
Tlink l 
)

Computes the wrench exerced by a spring on the connected links. For connection links that are not springs, the output wrenches are zero.

Parameters
tlThe transforms to the different normal links.
wr1The wrench on the first link in global coordinates.
wr2The wrench on the second link in global coordinates.
lThe connection link.

Definition at line 3497 of file link.c.

References CrossProduct(), DifferenceVector(), Error(), HTransformApply(), IntervalCenter(), IsConnectionSpring(), Tlink::l1, Tlink::l2, LINK_Connect, Norm(), Tlink::p1, Tlink::p2, Tlink::rest, ScaleVector(), Tlink::stiffness, and Tlink::type.

Referenced by ApplyExternalForces().

◆ GetConnectionLinkPotentialEnergy()

double GetConnectionLinkPotentialEnergy ( THTransform tl,
Tlink l 
)

This is a generalization of LinkPotentialEnergy which works in general (not only for tensegrity structures).

It is used when computing the potential (mechanical) energy of a dynamical system.

Parameters
tlThe transforms to the different normal links.
lThe connection link.
Returns
The potential energy stored in the link (spring).

Definition at line 3548 of file link.c.

References DifferenceVector(), HTransformApply(), IntervalCenter(), IsConnectionSpring(), Tlink::l1, Tlink::l2, LINK_Connect, Norm(), Tlink::p1, Tlink::p2, Tlink::rest, Tlink::stiffness, and Tlink::type.

Referenced by MechEnergy().

◆ GenerateLinkSolution()

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 3743 of file link.c.

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

Referenced by WorldDOF2Sol().

◆ IsConnectionCable()

boolean IsConnectionCable ( Tlink l)

Identifies connection cables.

Parameters
lThe link to query.
Returns
TRUE for connection cables.

Definition at line 3883 of file link.c.

References CYLINDER, GetLinkBody(), GetPolyhedronType(), LINK_Connect, LinkNBodies(), and Tlink::type.

Referenced by PrintLink().

◆ IsConnectionSpring()

boolean IsConnectionSpring ( Tlink l)

Identifies connection springs.

Parameters
lThe link to query.
Returns
TRUE for connection springs.

Definition at line 3890 of file link.c.

References GetLinkBody(), GetPolyhedronType(), LINK_Connect, LinkNBodies(), SEGMENTS, and Tlink::type.

Referenced by ApplyExternalForces(), GetConnectionLinkPotentialEnergy(), GetConnectionLinkWrench(), GetLinkRest(), GetLinkStiffness(), InitHandC(), MechEnergy(), and PrintLink().

◆ IsConnectionLeg()

boolean IsConnectionLeg ( Tlink l)

Identifies connection legs.

Parameters
lThe link to query.
Returns
TRUE for connection legs.

Definition at line 3897 of file link.c.

References CYLINDER, GetLinkBody(), GetPolyhedronType(), LINK_Connect, LinkNBodies(), SPHERE, and Tlink::type.

Referenced by PrintLink().

◆ GetConnectLinkFrom()

unsigned int GetConnectLinkFrom ( Tlink l)

Returns the first link connected by a connection link.

Parameters
lThe connection link.
Returns
The first connected link.

Definition at line 3906 of file link.c.

References Error(), Tlink::l1, LINK_Connect, and Tlink::type.

Referenced by ApplyExternalForces(), and PrintMechanism().

◆ GetConnectLinkTo()

unsigned int GetConnectLinkTo ( Tlink l)

Returns the second link connected by a connection link.

Parameters
lThe connection link.
Returns
The second connected link.

Definition at line 3914 of file link.c.

References Error(), Tlink::l2, LINK_Connect, and Tlink::type.

Referenced by ApplyExternalForces(), and PrintMechanism().

◆ GetConnectLinkPointFrom()

void GetConnectLinkPointFrom ( double *  p,
Tlink l 
)

Returns the point on the first link connected by a connection link.

Parameters
pThe returned point.
lThe connection link.

Definition at line 3922 of file link.c.

References Error(), LINK_Connect, Tlink::p1, and Tlink::type.

◆ GetConnectLinkPointTo()

void GetConnectLinkPointTo ( double *  p,
Tlink l 
)

Returns the point on the second link connected by a connection link.

Parameters
pThe returned point.
lThe connection link.

Definition at line 3933 of file link.c.

References Error(), LINK_Connect, Tlink::p2, and Tlink::type.

◆ VisibleLink()

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 3944 of file link.c.

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

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

◆ GetLinkMaxCoordinate()

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 3963 of file link.c.

References Tlink::maxCoord.

Referenced by AddBody2Mechanism(), and AddLink2Mechanism().

◆ LinkPrintAtoms()

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 3968 of file link.c.

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

Referenced by MechanismPrintAtoms().

◆ LinkStoreAtoms()

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 3985 of file link.c.

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

Referenced by MechanismStoreRigidAtoms().

◆ PlotLink()

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 4002 of file link.c.

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

Referenced by PlotMechanism().

◆ MoveLinkFromTransform()

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 4038 of file link.c.

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

Referenced by MoveMechanismFromTransforms().

◆ PrintLink()

void PrintLink ( FILE *  f,
char *  path,
char *  prefix,
char *  l1,
char *  l2,
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.
l1Name of the first connected link. Only used in connector links.
l2Name of the second connected link. Only used in connector links.
lThe link to print.

Definition at line 4075 of file link.c.

References DECOR_SHAPE, Error(), FALSE, GetBlue(), GetGreen(), GetLinkBody(), GetPolyhedronGranularity(), GetPolyhedronRadius(), GetPolyhedronStatus(), GetRed(), HIDDEN_SHAPE, HTransformIsIdentity(), HTransformPrettyPrint(), Tlink::iFrame, Tlink::iMatrix, IntervalCenter(), IsConnectionCable(), IsConnectionLeg(), IsConnectionSpring(), LINK_Connect, LINK_FullRot, LinkNBodies(), Tlink::mass, Tlink::name, NEW, NORMAL_SHAPE, Tlink::p1, Tlink::p2, PrintPolyhedron(), Tlink::rest, SetPolyhedronColor(), Tlink::stiffness, TrivialInertiaMatrix(), TRUE, and Tlink::type.

Referenced by PrintMechanism().

◆ DeleteLink()

void DeleteLink ( Tlink l)