variable.h File Reference

Detailed Description

Definition of the Tvariable type and the associated functions.

See Also
Tvariable, variable.c.

Definition in file variable.h.

Data Structures

struct  Tvariable
 Data associated with each variable in the problem. More...
 

Macros

#define SYSTEM_VAR   1
 One of the possible type of variables. More...
 
#define SECONDARY_VAR   2
 One of the possible type of variables. More...
 
#define DUMMY_VAR   4
 One of the possible type of variables. More...
 
#define CARTESIAN_VAR   8
 One of the possible type of variables. More...
 
#define ANY_TYPE_VAR   (SYSTEM_VAR|SECONDARY_VAR|DUMMY_VAR|CARTESIAN_VAR)
 Union of variables of any type. More...
 
#define NOTYPE_VAR   16
 One of the possible type of variables. More...
 

Functions

void NewVariable (unsigned int type, char *name, Tvariable *v)
 Constructor. More...
 
void CopyVariable (Tvariable *v_dst, Tvariable *v_src)
 Copy constructor. More...
 
void SetVariableTopology (unsigned int t, Tvariable *v)
 Sets the topology of the variable. More...
 
unsigned int GetVariableTopology (Tvariable *v)
 Gets the topology of the variable. More...
 
unsigned int GetVariableType (Tvariable *v)
 Gets the variable type. More...
 
char * GetVariableName (Tvariable *v)
 Gets the variable name. More...
 
void SetVariableInterval (Tinterval *i, Tvariable *v)
 Sets the new range for the variable. More...
 
TintervalGetVariableInterval (Tvariable *v)
 Gets the range of valid values for the variable. More...
 
void PrintVariable (FILE *f, Tvariable *v)
 Prints a variable. More...
 
void DeleteVariable (Tvariable *v)
 Destructor. More...
 

Macro Definition Documentation

#define SECONDARY_VAR   2

One of the possible type of variables. Secondary vars are system variables that are not necessary to completely determine the configuration of the mechanisms. For instance, the variables for sph-sph joints (i.e, the director vector for the cylinder defined in the joint) can be determined from the pose of the connected links. The variables associated with ranges (vectors, cosinus,...) are also secondary variables.

In practice, secondary vars are not used for bisection and are not taken into account when computing the size/volume for a given box.

See Also
TCuikSystem

Definition at line 44 of file variable.h.

Referenced by AddVariable(), GenerateJointEquations(), GenerateJointRangeEquations(), IsSecondaryVariable(), PrintVariables(), and RemoveVariable().

#define CARTESIAN_VAR   8

One of the possible type of variables. Cartesian variables are those given coordinates for points in the mechanism structure.

See Also
TCuikSystem, COORD_EQ

Definition at line 62 of file variable.h.

Referenced by AddVariable(), GenerateWorldSingularityEquations(), IsCartesianVariable(), PrintVariables(), RegenerateSolution(), and RemoveVariable().

#define ANY_TYPE_VAR   (SYSTEM_VAR|SECONDARY_VAR|DUMMY_VAR|CARTESIAN_VAR)

Auxiliary definition to jointly refer to variables of any type.

Definition at line 68 of file variable.h.

Referenced by AddEquation2Simplex(), CSRemoveLCVars(), and ReduceBoxEquationWise().

#define NOTYPE_VAR   16

Used for equations with non-assigned role yet.

Definition at line 74 of file variable.h.

Function Documentation

void NewVariable ( unsigned int  type,
char *  name,
Tvariable v 
)
void CopyVariable ( Tvariable v_dst,
Tvariable v_src 
)

Creates a new variable from another one.

Parameters
v_dstThe variable to create.
v_srcThe variable from where to copy.

Definition at line 33 of file variable.c.

References CopyInterval(), Tvariable::is, Tvariable::name, NEW, Tvariable::topology, and Tvariable::type.

Referenced by AddVariable(), CopyVariables(), and GetCSVariable().

void SetVariableTopology ( unsigned int  t,
Tvariable v 
)

Changes the topology of the variable. The default value for the topology is TOPOLOGY_R.

Parameters
tThe new topology.
vThe variable to modify.

Definition at line 44 of file variable.c.

References Error(), Tvariable::topology, TOPOLOGY_R, and TOPOLOGY_S.

Referenced by GenerateJointEquations().

unsigned int GetVariableTopology ( Tvariable v)

Returns the topology of the variable. Note that even if a variable has TOPOLOGY_S, it is set to TOPOLOGY_R if its associated range is smaller than 2*pi. Only variables with ranges larger than 2*pi have to routes to connect any two given points.

Parameters
vThe variable to query.
Returns
The variable's topology.

Definition at line 52 of file variable.c.

References IntervalSize(), Tvariable::is, M_2PI, Tvariable::topology, TOPOLOGY_R, TOPOLOGY_S, and ZERO.

Referenced by GetCSVarTopology(), and GetVariablesTopology().

unsigned int GetVariableType ( Tvariable v)

Gets the variable type.

Parameters
vThe variable to query.
Returns
The variable type.

Definition at line 60 of file variable.c.

References Tvariable::type.

Referenced by AddVariable(), GetVariableTypeN(), IsCartesianVariable(), IsDummyVariable(), IsSecondaryVariable(), IsSystemVariable(), PrintVariables(), and RemoveVariable().

char* GetVariableName ( Tvariable v)

Gets the variable name.

Parameters
vThe variable to query.
Returns
The a pointer to the variable name.

Definition at line 65 of file variable.c.

References Tvariable::name.

Referenced by AddVariable(), AddVariable2CS(), CSRemoveLCVars(), CSRemoveVarsWithCtRange(), DummifyAndAddEquation(), GetVariableID(), GetVariableNames(), InitMapping(), IsInSimple(), SimplifyCuikSystem(), and VariableName().

Tinterval* GetVariableInterval ( Tvariable v)

Gets the range of valid values for the variable.

Parameters
vThe variable to query.
Returns
A pointer to the range of valid values for the variable.

Definition at line 75 of file variable.c.

References Tvariable::is.

Referenced by BoxFromVariables(), CSRemoveLCVars(), DummifyAndAddEquation(), and PointFromVariables().

void PrintVariable ( FILE *  f,
Tvariable v 
)

Prints a variable (name plus valid range) to a stream that can be stdout.

Parameters
fThe file where to print.
vThe variable to print.

Definition at line 80 of file variable.c.

References Tvariable::is, Tvariable::name, PRINT_VARIABLE_NAME, PrintInterval(), PrintSymbolInterval(), Tvariable::topology, and TOPOLOGY_S.

Referenced by PrintVariables().