Institut de Robòtica i Informàtica Industrial
KRD Group

The CuikSuite Project

world.c File Reference

Implementaton of the function operating on Tworld. More...

#include "world.h"
#include "defines.h"
#include "error.h"
#include "varnames.h"
#include "random.h"
#include "list.h"
#include <math.h>
#include <string.h>
#include <unistd.h>

Go to the source code of this file.

Data Structures

struct  TBranchStep
 A step in a kinematic branch. More...
struct  Tbranch
 A kinematic branch. More...
struct  TKinTreeNode
 Information stored in each node of a kinematic tree. More...

Functions

void CreateBranch (Tbranch *b)
 Constructor.
void CopyBranch (Tbranch *b_dst, Tbranch *b_src)
 Copy constructor.
void AddStepToBranch (double s, Tjoint *joint, Tbranch *b)
 Adds a step to a kinematic chain.
unsigned int nStepsBranch (Tbranch *b)
 Gets the number of steps in a kinematic chain.
void GetBranchStep (unsigned int i, double *s, Tjoint **joint, Tbranch *b)
 Retrives a particular step form a kinematic chain.
unsigned int GetBranchOrigin (Tbranch *b)
 Returns the identifier of the link where the kinematic chain starts.
unsigned int GetBranchDestination (Tbranch *b)
 Returns the identifier of the link where the kinematic chain ends.
void MergeBranches (Tbranch *b1, Tbranch *b2, Tbranch *b)
 Merge two kinematic branches.
void DeleteBranch (Tbranch *b)
 Destructor.
void InitKinTreeNode (unsigned int lID, TKinTreeNode *p, TKinTreeNode *n)
 Constructor.
unsigned int GetKinTreeNodeLink (TKinTreeNode *n)
 Gets the identifier of the link reached in a kinematic tree node.
TbranchGetKinTreeNodeBranch (TKinTreeNode *n)
 Gets the kinematic branch stored in a kinematic tree node.
void DeleteKinTreeNode (TKinTreeNode *n)
 Destructor.
void Branch2Link (unsigned int f, unsigned int t, Tbranch *b, Tworld *w)
 Determines a kinematic branch from a link to another.
void GenerateKinTree (Tvector *bOut, Tworld *w)
 Builds a kinematic tree departing from the ground link.
void GenerateTransEquationsFromBranch (unsigned int eq_type, Tequation *eqs, Tbranch *b, Tworld *w)
 Generate equations from a branch.
void GenerateEquationsFromBranch (Tparameters *p, unsigned int eq_type, TCuikSystem *cs, Tbranch *b, Tworld *w)
 Generate equations from a branch.
boolean IsRevoluteBinaryLink (unsigned int nl, double ***p, Tworld *w)
 Identifies links articulated with only two revolute joints.
void InitWorldKinCS (Tparameters *p, Tworld *w)
 Initializes the kinematic sub-problem of a Tworld structure.
void InitWorldCS (Tworld *w)
 Initializes the cuiksystems in a Tworld structure.
void DeleteWorldCS (Tworld *w)
 Deletes the cuiksystems stored in a Tworld structure.
void InitWorld (Tworld *w)
 Constructor.
unsigned int AddLink2World (Tlink *l, Tworld *w)
 Adds a link to the mechanism in the world.
unsigned int AddJoint2World (Tjoint *j, Tworld *w)
 Adds a joint to the mechanism in the world.
unsigned int GetWorldDOF (Tworld *w)
 Returns the number of degrees of freedom of the mechanism in the world.
unsigned int GetWorldLinkID (char *linkName, Tworld *w)
 Gets the identifier of a link from its name.
TlinkGetWorldLink (unsigned int linkID, Tworld *w)
 Gets a link from its identifier.
unsigned int GetWorldNLinks (Tworld *w)
 Gets the number of links in the mechanism included in the world.
unsigned int GetWorldNJoints (Tworld *w)
 Gets the number of joints in the mechanism included in the world.
unsigned int GetWorldNConvexBodiesInLinks (Tworld *w)
 Gets the number of convex polyhedrons that define the mechanism included in the world.
unsigned int GetWorldSystemVars (boolean **sv, Tworld *w)
 Gets the system vars of the global cuiksystem.
void GenerateWorldEquationSystems (Tparameters *p, Tworld *w)
 Generates all the cuiksystems derived from the world information.
void GetGlobalInitialBox (Tbox *b, Tworld *w)
 Gets the search space for a given problem.
unsigned int MaxKinematicReduction (Tparameters *p, Tbox *b, double *reduction, Tworld *w)
 Reduces the system variables as much as possible using the kinematic constraints.
unsigned int SplitGlobalBox (Tparameters *p, Tbox *b, Tbox **b1, Tbox **b2, Tworld *w)
 Split a box into two sub-boxes.
void PlotWorld (Tplot3d *pt, double axesLength, Tworld *w)
 Adds a world (environment plus mechanism) in a 3D scene.
void MoveWorld (Tplot3d *pt, Tbox *b, Tworld *w)
 Moves the mechanisms defined in a world information to a given configuration.
void AnimateWorld (char *pname, double axesLength, double frameDelay, Tlist *p, Tworld *w)
 Produces an animation along a path.
void PrintWorldCS (Tparameters *p, Tfilename *fname, Tworld *w)
 Prints the cuiksystems derived from a world.
void DeleteWorld (Tworld *w)
 Destructor.

Detailed Description

Implementaton of the function operating on Tworld.

See also:
Tworld, world.h.

Definition in file world.c.


Function Documentation

void CreateBranch ( Tbranch b  ) 

Defines an empty kinematic chain.

Parameters:
b The kinematic chain to initialize.

Definition at line 160 of file world.c.

References CopyVoidPtr(), DeleteVoidPtr(), INIT_NUM_JOINTS, InitVector(), and Tbranch::steps.

Referenced by Branch2Link(), CopyBranch(), InitKinTreeNode(), and MergeBranches().

Here is the call graph for this function:

Here is the caller graph for this function:

void CopyBranch ( Tbranch b_dst,
Tbranch b_src 
)

Defines a kinematic chain from another chain.

Parameters:
b_dst The kinematic chain to initialize.
b_src The kinematic chain from where to copy the data.

Definition at line 165 of file world.c.

References AddStepToBranch(), CreateBranch(), GetBranchStep(), and nStepsBranch().

Referenced by Branch2Link(), GenerateKinTree(), and InitKinTreeNode().

Here is the call graph for this function:

Here is the caller graph for this function:

void AddStepToBranch ( double  s,
Tjoint joint,
Tbranch b 
)

Adds a step to a kinematic chain.

Parameters:
s The sign of the step (1 if the given joint has to be used as given or -1 if it has to be used reversed).
joint The joint to use to extend the kinematic branch.
b The kinematic chain from where to copy the data.

Definition at line 180 of file world.c.

References TBranchStep::joint, NEW, NewVectorElement(), TBranchStep::sign, and Tbranch::steps.

Referenced by Branch2Link(), CopyBranch(), GenerateKinTree(), and MergeBranches().

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int nStepsBranch ( Tbranch b  ) 

Gets the number of steps in a kinematic chain.

Parameters:
b The kinematic branch to query.
Returns:
The number of steps in a kinematic chain.

Definition at line 192 of file world.c.

References Tbranch::steps, and VectorSize().

Referenced by CopyBranch(), DeleteBranch(), GenerateEquationsFromBranch(), GenerateKinTree(), GenerateTransEquationsFromBranch(), GetBranchDestination(), and MergeBranches().

Here is the call graph for this function:

Here is the caller graph for this function:

void GetBranchStep ( unsigned int  i,
double *  s,
Tjoint **  joint,
Tbranch b 
)

Retrives a particular step form a kinematic chain.

If there is no step with the given number in the kinematic chain, this funtion triggers an error.

Parameters:
i The number of step to get.
s Output with the sign of the requested step.
joint Output with the joint used in the requested step.
b The kinematic branch to query.

Definition at line 197 of file world.c.

References Error(), GetVectorElement(), and Tbranch::steps.

Referenced by CopyBranch(), GenerateTransEquationsFromBranch(), GetBranchDestination(), GetBranchOrigin(), and MergeBranches().

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int GetBranchOrigin ( Tbranch b  ) 

Returns the identifier of the link where the kinematic chain starts.

Parameters:
b The kinematic branch to query.
Returns:
The identifier of the link where the kinematic chain starts.

Definition at line 211 of file world.c.

References GetBranchStep(), JointFromID(), and JointToID().

Referenced by GenerateEquationsFromBranch().

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int GetBranchDestination ( Tbranch b  ) 

Returns the identifier of the link where the kinematic chain ends.

Parameters:
b The kinematic branch to query.
Returns:
The identifier of the link where the kinematic chain ends.

Definition at line 226 of file world.c.

References GetBranchStep(), JointFromID(), JointToID(), and nStepsBranch().

Referenced by GenerateEquationsFromBranch().

Here is the call graph for this function:

Here is the caller graph for this function:

void MergeBranches ( Tbranch b1,
Tbranch b2,
Tbranch b 
)

We get two branches, b1,b2, representing two paths from, typically, the groundLink to the same link. The output, b, will be the closed branch resulting from eliminating from b1 and b2 the initial common path from the groudnLink to the point where the paths diverge.

Parameters:
b1 The first kinematic branch to merge.
b2 The second kinematic branch to merge.
b The resulting kinematic branch.

Definition at line 241 of file world.c.

References AddStepToBranch(), CreateBranch(), FALSE, GetBranchStep(), and nStepsBranch().

Referenced by GenerateKinTree().

Here is the call graph for this function:

Here is the caller graph for this function:

void DeleteBranch ( Tbranch b  ) 

Deletes the information stored in a kinematic branch and frees the allocated memory.

Parameters:
b The branch to delete.

Definition at line 284 of file world.c.

References DeleteVector(), GetVectorElement(), nStepsBranch(), and Tbranch::steps.

Referenced by Branch2Link(), DeleteKinTreeNode(), GenerateKinTree(), and InitWorldKinCS().

Here is the call graph for this function:

Here is the caller graph for this function:

void InitKinTreeNode ( unsigned int  lID,
TKinTreeNode p,
TKinTreeNode n 
)

Initializes a node in a kinematic tree.

Parameters:
lID Identifier of the link reached by the new branch.
p Node with a path that reaches the given link.
n The node to initialize.

Definition at line 355 of file world.c.

References TKinTreeNode::b, CopyBranch(), CreateBranch(), and TKinTreeNode::lID.

Referenced by GenerateKinTree().

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int GetKinTreeNodeLink ( TKinTreeNode n  ) 

Gets the identifier of the link reached in a kinematic tree node.

Parameters:
n The kinematic tree node to query.
Returns:
The identifier of the link reached in a kinematic tree node.

Definition at line 364 of file world.c.

References TKinTreeNode::lID.

Tbranch * GetKinTreeNodeBranch ( TKinTreeNode n  ) 

Gets the kinematic branch stored in a kinematic tree node.

Parameters:
n The kinematic tree node to query.
Returns:
The branch stored in a kinematic tree node.

Definition at line 369 of file world.c.

References TKinTreeNode::b.

Referenced by GenerateKinTree().

Here is the caller graph for this function:

void DeleteKinTreeNode ( TKinTreeNode n  ) 

Deletes the information stored in a kinematic tree node and frees the allocated memory.

Parameters:
n The kinemtic tree node to delete.

Definition at line 374 of file world.c.

References TKinTreeNode::b, and DeleteBranch().

Referenced by GenerateKinTree().

Here is the call graph for this function:

Here is the caller graph for this function:

void Branch2Link ( unsigned int  f,
unsigned int  t,
Tbranch b,
Tworld w 
)

Considering the mechanisms as a graph where the vertices are the links and the edges are defined by the joints, this function determines the shortest from link f to link t, in the form of a kinematic branch.

If there is no path from link from link f to link t, we return an empty branch.

Parameters:
f The identifier of the initial link for the branch to generate.
t The identifiero of the final link for the branch to generate.
b The output branch.
w The world to query.

Definition at line 532 of file world.c.

References AddStepToBranch(), CopyBranch(), CreateBranch(), DeleteBranch(), FALSE, GetMechanismJoint(), JointFromID(), JointToID(), Tworld::m, NEW, Tworld::nl, and TRUE.

Referenced by GenerateKinTree(), and GenerateWorldEquationSystems().

Here is the call graph for this function:

Here is the caller graph for this function:

void GenerateKinTree ( Tvector bOut,
Tworld w 
)

Builds a kinematic tree departing from the ground link. From the kinematic tree we extract two types of branches

  • Closed loops: Branches created when, at a given point, links appear from leaves of the tree to internal three nodes. Closed branches are then build using MergeBranches.
  • Open branches: Branches that connect the ground link to links with open branches, i.e., without loops. These are the kind of loops that appear in tree like mechanisms.

A mechanism can have the two types of branches.

Before building the kinematic tree, we ensure the mechanism to be fully connected: Parts of the mechanism disconnected from the ground link are connected to it using free-joints.

Parameters:
bOut Vector with the open and closed branches extracted from the kinematic tree.
w The world to query.

Definition at line 601 of file world.c.

References AddJoint2Mechanism(), AddStepToBranch(), Branch2Link(), CopyBranch(), CopyVoidPtr(), DeleteBranch(), DeleteJoint(), DeleteKinTreeNode(), DeleteVoidPtr(), FALSE, GetKinTreeNodeBranch(), GetMechanismJoint(), GetMechanismLink(), GetMechanismNJoints(), InitKinTreeNode(), InitVector(), JointFromID(), JointToID(), Tworld::m, MergeBranches(), NEW, NewFreeJoint(), NewVectorElement(), Tworld::nj, Tworld::nl, nStepsBranch(), and TRUE.

Referenced by InitWorldKinCS().

Here is the call graph for this function:

Here is the caller graph for this function:

void GenerateTransEquationsFromBranch ( unsigned int  eq_type,
Tequation eqs,
Tbranch b,
Tworld w 
)

Generate equations from a branch considering the branch merely as a sum of vectors.

The difference with GenerateEquationsFromBranch is that for open branches we do not add to the resulting equations the variables representing the position of the link reached by this open branch. Thus, the output equations here only involve system equations.

Moreove, the resulting equations are not added to a cuiksystem but returned to the caller.

Parameters:
eq_type Type for the equations to generete (SYSTEM_EQS, COORD_EQS).
eqs Space for 3 equations where to store the result.
b The branch from where to generate the equations.
w The world on which we have to operate.

Definition at line 754 of file world.c.

References EQU, GenerateJointEquationsInBranch(), GetBranchStep(), InitEquation(), Tworld::kinCS, nStepsBranch(), SetEquationCmp(), and SetEquationType().

Referenced by GenerateEquationsFromBranch(), and GenerateWorldEquationSystems().

Here is the call graph for this function:

Here is the caller graph for this function:

void GenerateEquationsFromBranch ( Tparameters p,
unsigned int  eq_type,
TCuikSystem cs,
Tbranch b,
Tworld w 
)

Generate equations from a branch.

If the branch is closed, we generate 3 loop equations (X, Y and Z) that are added to the given cuiksystem.

If the branch is open we generate equations that give the 3D position in the global frame of reference of the origin of the frame of reference of the last link in the branch.

This function uses GenerateTransEquationsFromBranch and then completes equations for open branches and add the results to the given cuiksystem.

Parameters:
p The set of parameters used when generating the equations (DUMMIFY_LEVEL,...).
eq_type Type for the equations to generete (SYSTEM_EQS, COORD_EQS).
cs The cuiksystem where to add the equations.
b The branch from where to generate the equations.
w The world on which we have to operate.

Definition at line 782 of file world.c.

References AddCt2Monomial(), AddEquation2CS(), AddMonomial(), AddVariable2CS(), AddVariable2Monomial(), DeleteEquation(), DeleteInterval(), DeleteMonomial(), DeleteVariable(), FALSE, GenerateTransEquationsFromBranch(), GetBranchDestination(), GetBranchOrigin(), GetLinkName(), GetMechanismLink(), InitMonomial(), LINK_TRANS, Tworld::m, Tworld::maxCoord, NEW, NewInterval(), NewVariable(), nStepsBranch(), ResetMonomial(), SECONDARY_VAR, and SetVariableInterval().

Referenced by InitWorldKinCS().

Here is the call graph for this function:

Here is the caller graph for this function:

boolean IsRevoluteBinaryLink ( unsigned int  nl,
double ***  p,
Tworld w 
)

Identifies links articulated with only two revolute joints. For those links it is possible to re-define the reference frame so that simpler equations will be obtained.

Parameters:
nl The identifier of the link to be checked.
p Space to store four points defining the rotation axis for the first revolute axis.
The indexing is p[i][j][k] where i is the number of axis (0,1) j the number of point in the axis (0,1) and k the component (0,1,2 for x, y, z).
w The world with the information of links and joints.
Returns:
TRUE if the link with the given identifier is a revolute, binary link.
See also:
ChangeLinkReferenceFrame

Definition at line 845 of file world.c.

References GetJointPoint(), GetJointType(), GetMechanismJoint(), JointFromID(), JointToID(), Tworld::m, and REV_JOINT.

Referenced by InitWorldKinCS().

Here is the call graph for this function:

Here is the caller graph for this function:

void InitWorldKinCS ( Tparameters p,
Tworld w 
)

Initializes the kinematic sub-problem of a Tworld structure.

Parameters:
p A set of parametersused when generating the equations (DUMMIFY_LEVEL,...).
w The world on which we have to operate.

Definition at line 880 of file world.c.

References ChangeLinkReferenceFrame(), DeleteBranch(), DeleteVector(), Error(), GenerateEquationsFromBranch(), GenerateJointEquations(), GenerateJointRangeEquations(), GenerateKinTree(), GenerateLinkRot(), GetMechanismJoint(), GetMechanismLink(), GetVectorElement(), IsRevoluteBinaryLink(), Tworld::kinCS, Tworld::m, Tworld::maxCoord, NEW, Tworld::nj, Tworld::nl, SYSTEM_EQ, and VectorSize().

Referenced by GenerateWorldEquationSystems().

Here is the call graph for this function:

Here is the caller graph for this function:

void InitWorldCS ( Tworld w  ) 

Initializes the cuiksystems in a Tworld structure. The Tworld::kinCS is initialized as an empty cuiksystem. Tworld::globalCS is not initialized since it is directly copied from the kinCS in GenerateWorldEquationSystems.

The rest of cuiksystems (Tworld::obsCS) are set to NULL pointers.

Parameters:
w The world structure to initialzie.

Definition at line 948 of file world.c.

References InitCuikSystem(), and Tworld::kinCS.

Referenced by GenerateWorldEquationSystems().

Here is the call graph for this function:

Here is the caller graph for this function:

void DeleteWorldCS ( Tworld w  ) 

Deletes the cuiksystems stored in a Tworld structure: Tworld::kinCS, Tworld::globalCS and all the Tworld::obsCS cuiksystems.

Parameters:
w The world structure to be clean.

Definition at line 953 of file world.c.

References DeleteCuikSystem(), and Tworld::kinCS.

Referenced by DeleteWorld().

Here is the call graph for this function:

Here is the caller graph for this function:

void InitWorld ( Tworld w  ) 

Initializes an empty world.

Parameters:
w The world to initialize.

Definition at line 964 of file world.c.

References EMPTY_WORLD, InitMechanism(), Tworld::m, Tworld::nb, Tworld::nj, Tworld::nl, Tworld::refEqs, Tworld::stage, and Tworld::systemVars.

Here is the call graph for this function:

unsigned int AddLink2World ( Tlink l,
Tworld w 
)

Adds a link to the mechanism in the world.

Parameters:
l The link to add.
w The world to update.
Returns:
The identifier assigned to the new link.

Definition at line 978 of file world.c.

References AddLink2Mechanism(), LinkNBodies(), Tworld::m, Tworld::nb, and Tworld::nl.

Here is the call graph for this function:

unsigned int AddJoint2World ( Tjoint j,
Tworld w 
)

Adds a joint to the mechanism in the world.

Parameters:
j The joint to add.
w The world to update.
Returns:
The identifier assigned to the new joint.

Definition at line 989 of file world.c.

References AddJoint2Mechanism(), Tworld::m, and Tworld::nj.

Here is the call graph for this function:

unsigned int GetWorldDOF ( Tworld w  ) 

Returns the number of degrees of freedom of the mechanism in the world.

Parameters:
w The world to query.
Returns:
The number of degrees of freedom of the mechanism in the world.
See also:
GetMechanismDOF.

Definition at line 996 of file world.c.

References GetMechanismDOF(), and Tworld::m.

Here is the call graph for this function:

unsigned int GetWorldLinkID ( char *  linkName,
Tworld w 
)

Gets the identifier of a link from its name (NO_UINT if there is no link with the given name).

Parameters:
linkName The name of the link.
w The world to query.
Returns:
The identifier assigned to the new link.

Definition at line 1001 of file world.c.

References GetLinkID(), and Tworld::m.

Here is the call graph for this function:

Tlink* GetWorldLink ( unsigned int  linkID,
Tworld w 
)

Gets a pointer to a link in the mechanism included in the world from its identifier (NULL if there is no link with the given identifier).

Parameters:
linkID The identifier of the link to retrive.
w The world to query.
Returns:
The pointer to the requested link, if any.

Definition at line 1006 of file world.c.

References GetMechanismLink(), and Tworld::m.

Here is the call graph for this function:

unsigned int GetWorldNLinks ( Tworld w  ) 

Gets the number of links in the mechanism included in the world.

Parameters:
w The world to query.
Returns:
The number of links in the mechanism included in the world.

Definition at line 1011 of file world.c.

References Tworld::nl.

unsigned int GetWorldNJoints ( Tworld w  ) 

Gets the number of joints in the mechanism included in the world.

Parameters:
w The world to query.
Returns:
The number of joints in the mechanism included in the world.

Definition at line 1016 of file world.c.

References Tworld::nj.

unsigned int GetWorldNConvexBodiesInLinks ( Tworld w  ) 

Each link can include more than one convex polyhedron. This function returns the sum of the number of convex polyhedrons defined over all links

Parameters:
w The world to query.
Returns:
The number of convex bodies in the mechanism included in the world.

Definition at line 1021 of file world.c.

References Tworld::nb.

unsigned int GetWorldSystemVars ( boolean **  sv,
Tworld w 
)

Gets the system vars of the global cuiksystem in the form of an array of booleans, one for each variable in the kinCS where only entries corresponding to system variables are set to TRUE.

Parameters:
sv Space where to store the output array of booleans.
w The world to query.

Definition at line 1026 of file world.c.

References Error(), GetCSSystemVars(), Tworld::kinCS, Tworld::stage, and WORLD_WITH_EQUATIONS.

Here is the call graph for this function:

void GenerateWorldEquationSystems ( Tparameters p,
Tworld w 
)

From the information stored in a .world file, we generate the environment and mechanisms structures. From this information we have to generate systems of equations necessary to solve the problem. This is the purpose of this function. Therefore, this function should be used after reading the .world file and before start to solve the problem.

Parameters:
p A set of parameters (used, for instance, to find out the dummification level).
w The world structure with the information from where to generate the cuiksystems.

Definition at line 1034 of file world.c.

References Branch2Link(), COORD_EQ, Error(), GenerateTransEquationsFromBranch(), GetCSSystemVars(), GetMechanismMaxCoordinate(), InitWorldCS(), InitWorldKinCS(), Tworld::kinCS, Tworld::m, Tworld::maxCoord, NEW, Tworld::nl, Tworld::refEqs, Tworld::stage, Tworld::systemVars, WORLD_WITH_EQUATIONS, and WORLD_WITH_GEOMETRY.

Here is the call graph for this function:

void GetGlobalInitialBox ( Tbox b,
Tworld w 
)

Gets the search space for a given problem. The search space is deduced from the ranges of the variables involved in the problem.

This can be seen as a box from world constructor.

Parameters:
b The output box with the search space.
w The world to query.

Definition at line 1077 of file world.c.

References Error(), GenerateInitialBox(), Tworld::kinCS, Tworld::stage, and WORLD_WITH_EQUATIONS.

Here is the call graph for this function:

unsigned int MaxKinematicReduction ( Tparameters p,
Tbox b,
double *  reduction,
Tworld w 
)

Reduces the system variables as much as possible taking into account only the system equations (i.e., using only the Tworld::kinCS).

Parameters:
p The set of parameters to use when solving the cuiksystems (RHO, SIGMA,...).
b The box with the ranges to reduce.
reduction The reduction ratio (size of the output box / size of the input box).
w The world to use in the reduction.
Returns:
The box status after the reduction: EMPTY_BOX, REDUCED_BOX, REDUCED_BOX_WITH_SOLUTION ERROR_IN_PROCESS.

Definition at line 1085 of file world.c.

References EMPTY_BOX, Error(), GetBoxLevel(), GetBoxSize(), Tworld::kinCS, MaxReduction(), Tworld::stage, SYSTEM_VAR, Tworld::systemVars, and WORLD_WITH_EQUATIONS.

Here is the call graph for this function:

unsigned int SplitGlobalBox ( Tparameters p,
Tbox box,
Tbox **  b1,
Tbox **  b2,
Tworld w 
)
Parameters:
p Parameters to take into account in the split (ERROR_SPLIT,...)
box The box to split.
b1 The first sub-box resulting from the split.
b2 The second sub-box resulting from the split.
w The world to which the boxes are referred.
Returns:
The dimension along which the split took place.

Definition at line 1130 of file world.c.

References ComputeSplitDim(), CUT_POINT, Error(), Tworld::kinCS, NEW, SplitBox(), Tworld::stage, and WORLD_WITH_EQUATIONS.

Here is the call graph for this function:

void PlotWorld ( Tplot3d pt,
double  axesLength,
Tworld w 
)

Adds a world (environment plus mechanism) in a 3D scene. Note that the the mechanism is not set in any valid configuration but all links are plotted with its local frame overlapped with the global one. To actually display the mechanism in a correct configuration you should use MoveWorld.

Parameters:
pt The 3d scene where we add the geometry.
axesLength Length for the axes for each link. 0 not to display them.
w The wold to plot.

Definition at line 1152 of file world.c.

References Error(), Tworld::m, PlotMechanism(), Tworld::stage, and WORLD_WITH_GEOMETRY.

Referenced by AnimateWorld(), and main().

Here is the call graph for this function:

Here is the caller graph for this function:

void MoveWorld ( Tplot3d pt,
Tbox b,
Tworld w 
)

Moves the mechanisms defined in a world information to a given configuration.

Note that the box should only include ranges for the system variables. Therefore, the box given as a parameter is a sub-box of the box associated with Tworld::kinCS.

Parameters:
pt The 3d scene where the world has been previously added (see PlotWorld).
b The box from where to get the configuration. The configuration used to plot the mechanism is defined from the center of the interval for the system variables. Note that by taking the center it is not warranteed the configuration to be valid but if boxes are small enough the committed error will be small too.
w The world with the mechanism to move.

Definition at line 1160 of file world.c.

References Error(), EvaluateEquation(), GetBoxInterval(), GetCSNumVariables(), GetEquationValue(), IntervalCenter(), Tworld::kinCS, Tworld::m, MoveMechanism(), NEW, Tworld::nl, Tworld::refEqs, RegenerateMechanismSolution(), Tworld::stage, Tworld::systemVars, and WORLD_WITH_EQUATIONS.

Referenced by AnimateWorld(), and main().

Here is the call graph for this function:

Here is the caller graph for this function:

void AnimateWorld ( char *  pname,
double  axesLength,
double  frameDelay,
Tlist p,
Tworld w 
)

Produces an animation along a path. An animation is a 3d geometry that can be browsed with geomview.

Note that the boxes in the list should only include ranges for the system variables. Therefore, the box given as a parameter is a sub-box of the box associated with Tworld::kinCS. Lists printed while solving a problem are already in this form (i.e., including only system variables)

Parameters:
pname Name for the file with the geometry to generate.
axesLength Length for the axes for each link. 0 not to display them.
frameDelay Extra time (in seconds) added in between frames. In the default mode animations show 10 frames per second (i.e., the frame delay is 0.1). This parameter can be used to slow down animations. This is very useful when animating sets of isolated solutions: we can freeze each frame time enough to inspect each solution separately.
p The list of boxes with the frames of the animation.
w The world.

Definition at line 1211 of file world.c.

References Advance(), Close3dBlock(), ClosePlot3d(), Delay3dObject(), EndOfList(), Error(), FALSE, FINAL_FRAME_DELAY, First(), FRAME_RATE, GetBoxNIntervals(), GetCSNumNonDummyVariables(), GetCurrent(), INITIAL_FRAME_DELAY, InitIterator(), InitPlot3d(), Tworld::kinCS, MoveWorld(), PlotWorld(), Tworld::stage, Start3dBlock(), TRUE, and WORLD_WITH_EQUATIONS.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

void PrintWorldCS ( Tparameters p,
Tfilename fname,
Tworld w 
)

Generate a file with the cuiksystems generated from the world information.

Parameters:
p A set of parameters.
fname The base name for the file names to create
w The world with the cuiksystems to print.

Definition at line 1254 of file world.c.

References CreateFileName(), CUIK_EXT, DeleteFileName(), Error(), GetFileFullName(), GetFileName(), GetFilePath(), Tworld::kinCS, PARAM_EXT, PrintCuikSystem(), Tworld::stage, and WORLD_WITH_EQUATIONS.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

void DeleteWorld ( Tworld w  ) 

Deletes the information stored in a world and frees the allocated memory.

Parameters:
w The world to delete.

Definition at line 1286 of file world.c.

References DeleteEquation(), DeleteMechanism(), DeleteWorldCS(), Tworld::m, Tworld::nl, Tworld::refEqs, Tworld::stage, Tworld::systemVars, WORLD_WITH_EQUATIONS, and WORLD_WITH_GEOMETRY.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function: