defines.h File Reference#include "error.h"
#include <stdlib.h>
#include <fenv.h>
#include <Clp/Coin_C_defines.h>
#include <float.h>
Go to the source code of this file.
Defines |
#define | ZERO 1e-11 |
| Floating point operations giving a value below this constant (in absolute value) are considered 0.
|
#define | INF COIN_DBL_MAX |
#define | M_PI 3.14159265358979323846 |
| Pi.
|
#define | M_PI_2 1.57079632679489661923 |
| Pi/2.
|
#define | M_2PI (2.0*M_PI) |
| 2*Pi.
|
#define | DEG2RAD (M_PI/180.0) |
#define | RAD2DEG (180.0/M_PI) |
#define | SGN(a) (a>=0?1:-1) |
| Returns the sign of a floating point.
|
#define | ROUNDUP fesetround(FE_UPWARD) |
#define | ROUNDDOWN fesetround(FE_DOWNWARD) |
#define | ROUNDNEAR fesetround(FE_TONEAREST) |
| Sets the floating point operations in round near mode.
|
#define | NEW(_var, _n, _type) |
| Allocates memory space.
|
#define | MEM_EXPAND(_var, _n, _type) |
| Expands a previously allocated memory space.
|
#define | MEM_DUP(_var, _n, _type) {(_n)*=2;MEM_EXPAND(_var,_n,_type);} |
| Duplicates a previously allocated memory space.
|
#define | PRINT_VARIABLE_NAME(f, name) if (name[0]=='_') fprintf(f,"%s",&(name[1])); else fprintf(f,"%s",name) |
| Prints a variable name into a file.
|
#define | NO_UINT ((unsigned int)(-1)) |
Detailed Description
Definitions of constants and macros used in several parts of the cuik library.
Definition in file defines.h.
Define Documentation
Floating point operations giving a value below this constant (in absolute value) are considered 0.
We use 1e-11 because trigonometric operations (sin/cos/...) give an error typically around 1e-12. Moreover, we print doubles with 12 decimals and, thus the last one typically varies when performing operations. Note that 1e-11 is far below the typical precission used inside the simplex algorithms (1e-6).
No to be confused with parameter EPSILON. ZERO is used as a general threshold to round towards 0 and Epsilon is used only when passing parameters to the simplex. For a super-numerically-stable simplex EPSILON and ZERO would be the same.
Definition at line 36 of file defines.h.
Referenced by AddCt2Monomial(), AddMonomial(), ApplyLinkRot(), BoxSphereClipping(), CmpLinearConstraints(), CropEquation(), CropLinearConstraint(), CSRemoveLCVars(), CtScaleEquation(), EvaluateLinearConstraintInt(), EvaluateMonomialInt(), FixVariableInMonomial(), GetFirstOrderApproximationToEquation(), NewInPatchJoint(), NewRevoluteJoint(), NewUniversalJoint(), NormalizeEquation(), PrintLinearConstraint(), PrintMonomial(), PrintMonomials(), PurgeEquation(), RectangleCircleClipping(), ReplaceVariableInEquation(), ReplaceVariableInMonomial(), SetMonomialCt(), SimplexAddNewConstraint(), and SimplifyLinearConstraint().
Infinite.
Definition at line 45 of file defines.h.
Referenced by AddEquation2Simplex(), ComputeSplitDimInt(), CropEquation(), CropLinearConstraint(), EquationFromLinearConstraint(), GenerateJointRangeEquations(), GetFirstOrderApproximationToEquation(), IntervalCenter(), IsSimplificable(), LinearizeGeneralEquation(), LinearizeGeneralEquationInt(), NewFixJoint(), NewFreeJoint(), NewPrismaticJoint(), NewRevoluteJoint(), NewSphericalJoint(), NewSphSphJoint(), NewUniversalJoint(), NewVariable(), PrintInterval(), ReduceRange(), SetSimplexBounds(), SimplexCreate(), SimplexExpandBounds(), SimplexGetColBounds(), SimplexGetOptimalValue(), SimplexGetRowBounds(), SimplexSetColBounds(), SimplexSetRowBounds(), and SplitBox().
#define M_PI 3.14159265358979323846 |
#define M_PI_2 1.57079632679489661923 |
#define DEG2RAD (M_PI/180.0) |
Constant to transform from degrees to radiants.
Definition at line 85 of file defines.h.
Referenced by main().
#define RAD2DEG (180.0/M_PI) |
Constant to transform from radiants to degrees.
Definition at line 91 of file defines.h.
#define SGN |
( |
a |
|
) |
(a>=0?1:-1) |
Returns the sign of a floating point: -1 for negative and 1 for possitive or zero.
Definition at line 99 of file defines.h.
#define ROUNDUP fesetround(FE_UPWARD) |
Sets the floating point operations in rounding up mode.
Definition at line 107 of file defines.h.
Referenced by BoxSaddleClipping(), IntervalAdd(), IntervalDivision(), IntervalOffset(), IntervalPow(), IntervalProduct(), IntervalScale(), IntervalSinus(), IntervalSize(), IntervalSqrt(), IntervalSubstract(), pointRightOfLine(), RectangleParabolaClipping(), and SimplexGetOptimalValue().
#define ROUNDDOWN fesetround(FE_DOWNWARD) |
Sets the floating point operations in rounding down mode.
Definition at line 113 of file defines.h.
Referenced by BoxSaddleClipping(), IntervalAdd(), IntervalDivision(), IntervalOffset(), IntervalPow(), IntervalProduct(), IntervalScale(), IntervalSinus(), IntervalSqrt(), IntervalSubstract(), LinearizeCircleEquation(), LinearizeSphereEquation(), pointLeftOfLine(), RectangleParabolaClipping(), and SimplexGetOptimalValue().
#define ROUNDNEAR fesetround(FE_TONEAREST) |
Sets the floating point operations in round near mode. This is the default mode.
Definition at line 119 of file defines.h.
Referenced by BoxSaddleClipping(), IntervalAdd(), IntervalDivision(), IntervalOffset(), IntervalPow(), IntervalProduct(), IntervalScale(), IntervalSinus(), IntervalSize(), IntervalSqrt(), IntervalSubstract(), LinearizeCircleEquation(), LinearizeSphereEquation(), pointLeftOfLine(), pointRightOfLine(), RectangleParabolaClipping(), and SimplexGetOptimalValue().
#define NEW |
( |
_var, |
|
|
_n, |
|
|
_type |
|
) |
|
Value:{(_var)=(_type *)malloc(sizeof(_type)*(_n)); \
if (!(_var)) Error("Memory allocation error");}
Allocates memory space for _n elements of type _type and assigns the pointer to _var. If the memory can not be allocated, triggers and error.
Definition at line 128 of file defines.h.
Referenced by AddBody2Link(), AddConstant(), AddEquation(), AddJoint2Mechanism(), AddLink2Mechanism(), AddMonomial(), AddStepToBranch(), AddVariable(), ApplyLinkRot(), Branch2Link(), ChangeParameter(), ComputeSimpCuikSystemJacobian(), ComputeSplitDimInt(), CopyBox(), CopyBoxSubset(), CopyCPolyhedron(), CopyCuikSystem(), CopyEquation(), CopyEquationInfo(), CopyEquations(), CopyLinearConstraint(), CopyLink(), CopyMapping(), CopyVariable(), CopyVariables(), CopyVarSet(), CopyVector(), CreateFileName(), CropEquation(), CSRemoveLCVars(), CSRemoveVarsWithCtRange(), DeriveEquation(), DeriveVarSet(), DummifyAndAddEquation(), ErrorDueToVariable(), ErrorInInequalities(), ErrorInSolution(), EvaluateEqMin(), GenerateCylinderOFF(), GenerateEquationsFromBranch(), GenerateJointEquations(), GenerateJointEquationsInBranch(), GenerateJointRangeEquations(), GenerateKinTree(), GenerateLinkRot(), GenerateSphereOFF(), GenerateWorldEquationSystems(), GetCSSystemVars(), GetCuikSystemJacobian(), GetFirstOrderApproximationToEquation(), GetTransform2Link(), InitBox(), InitConstants(), InitCPolyhedronFromFile(), InitEquation(), InitEquations(), InitLinearConstraint(), InitLink(), InitMapping(), InitPlot3d(), InitVariables(), InitVarSet(), InitVector(), InitWorldKinCS(), LinearizeCircleEquation(), LinearizeGeneralEquation(), LinearizeParabolaEquation(), LinearizeSaddleEquation(), LinearizeSphereEquation(), ListOfBoxesCluster(), LoadBox(), LoadLinearConstraint(), LoadMapping(), main(), MoveWorld(), MPI_SolveCuikSystem(), MPI_TreatBox(), NewVariable(), PostProcessBox(), PrintCuikSystem(), PrintCuikSystemWithSimplification(), PrintMapping(), PrivAddElement(), ReadBox(), ReadListOfBoxes(), ReadOFF(), RegenerateJointSolution(), SampleCuikSystemInBox(), SaveCSState(), SetEquationInfo(), SetVectorElement(), SimplexAddNewConstraintRaw(), SimplexColEmpty(), SimplexCreate(), SimplexGetColConstraint(), SimplexGetOptimalValue(), SimplexGetOptimizationFunction(), SimplexGetRowConstraint(), SimplexSetOptimizationFunction(), SimplifyCuikSystem(), SplitBox(), SplitGlobalBox(), UpdateCuikSystem(), and UpdateSplitWeight().
#define MEM_EXPAND |
( |
_var, |
|
|
_n, |
|
|
_type |
|
) |
|
Value:{(_var)=(_type *)realloc((void *)(_var),sizeof(_type)*(_n)); \
if (!(_var)) Error("Memory reallocation error");}
Expands a previously reserved memory space so that it can accomodate _n elements of type _type assigns the pointer to _var. The previously allocated space is pointed by _var. If the memory can not be expanded, triggers and error.
Definition at line 137 of file defines.h.
Referenced by AddTerm2LinearConstraint(), AddVariableInt(), and SetVectorElement().
#define MEM_DUP |
( |
_var, |
|
|
_n, |
|
|
_type |
|
) |
{(_n)*=2;MEM_EXPAND(_var,_n,_type);} |
#define PRINT_VARIABLE_NAME |
( |
f, |
|
|
name |
|
) |
if (name[0]=='_') fprintf(f,"%s",&(name[1])); else fprintf(f,"%s",name) |
Automatically generated variables have a name that starts with a '_'. This is done to avoid the generation of a variable with the same name of a variable defined by the user (the syntax does not allow for variables starting with a '_').
When printing the name of the variable into a file we remove the starting '_' to allow the input parser to read the output file. If this results in a duplicated variable the parser will detect it.
Definition at line 160 of file defines.h.
Referenced by PrintMapping(), PrintVariable(), and PrintVarSet().
#define NO_UINT ((unsigned int)(-1)) |
Used to denote an identifier that has not been initialized.
Definition at line 168 of file defines.h.
Referenced by AddBox2HeapOfBoxes(), AddList2Heap(), AddMonomial(), AddVariable2CS(), ApplyLinkRot(), ComputeSplitDim(), ComputeSplitDimInt(), CSRemoveLCVars(), CSRemoveVarsWithCtRange(), DummifyAndAddEquation(), FindMonomial(), FixVariableInMonomial(), GaussianElimination(), GenerateCrossProductEquations(), GenerateDotProductEquation(), GenerateJointEquations(), GenerateJointEquationsInBranch(), GenerateJointRangeEquations(), GenerateLinkRot(), GetBoxMaxDim(), GetConstantWithName(), GetHeapPosition(), GetLinearConstraintVariable(), GetLinkID(), GetPlaceinSet(), GetTransform2Link(), GetVariableID(), GetVariableWithName(), GetVarIDInOriginal(), InitCPolyhedronFromFile(), InitLink(), InitMapping(), IsSimplificable(), MoveCPolyhedron(), MoveLink(), NewCylinder(), NewFixJoint(), NewFreeJoint(), NewPrismaticJoint(), NewRevoluteJoint(), NewSphere(), NewSphericalJoint(), NewSphSphJoint(), NewUniversalJoint(), PlotLink(), ReplaceVariableInEquation(), ReplaceVariableInMonomial(), SampleCuikSystemInBox(), SimpleFromOriginal(), and VarIncluded().
|