Implementation of the functions operating on Tinterval.
- See Also
- Tinterval, interval.h.
Definition in file interval.c.
|
double | NormalizeAngle (double a) |
| Normalizes a angular value so that it is included in [0,2Pi]. More...
|
|
void | NewInterval (double lower, double upper, Tinterval *i) |
| Constructor. More...
|
|
void | CopyInterval (Tinterval *i_dst, Tinterval *i_org) |
| Copy constructor. More...
|
|
boolean | CmpIntervals (Tinterval *i1, Tinterval *i2) |
| Compares two intervals. More...
|
|
double | LowerLimit (Tinterval *i) |
| Gets the lower limit. More...
|
|
double | UpperLimit (Tinterval *i) |
| Gets the uppser limit. More...
|
|
double | IntervalSize (Tinterval *i) |
| Gets the uppser limit. More...
|
|
double | DistanceToInterval (double p, Tinterval *i) |
| Distance to an interval. More...
|
|
double | IntervalCenter (Tinterval *i) |
| Gets the interval center. More...
|
|
double | PointInInterval (double r, Tinterval *i) |
| Gets a point inside the interval. More...
|
|
void | SetLowerLimit (double v, Tinterval *i) |
| Sets a new lower limit. More...
|
|
void | SetUpperLimit (double v, Tinterval *i) |
| Sets a new upper limit. More...
|
|
void | EnlargeInterval (double lo, double uo, Tinterval *i) |
| Symmetrically increases the size of an interval. More...
|
|
void | ExpandInterval (double v, Tinterval *i) |
| Changes the interval limits to include a given point. More...
|
|
void | UpdateLowerLimit (double v, Tinterval *i) |
| Updates the lower limit. More...
|
|
void | UpdateUpperLimit (double v, Tinterval *i) |
| Updates the upper limit. More...
|
|
boolean | IntervalInclusion (Tinterval *i1, Tinterval *i2) |
| Checks is a given interval is fully included into another interval. More...
|
|
boolean | Intersect (Tinterval *i1, Tinterval *i2) |
| Checks is a two intervals intersect. More...
|
|
boolean | Intersection (Tinterval *i1, Tinterval *i2, Tinterval *i_out) |
| Computes the intersection of two intervals. More...
|
|
boolean | Union (Tinterval *i1, Tinterval *i2, Tinterval *i_out) |
| Computes the union of two intervals. More...
|
|
boolean | EmptyInterval (Tinterval *i) |
| Checks if a given interval is empty. More...
|
|
boolean | IsInside (double p, double tol, Tinterval *i) |
| Checks if a value is inside an interval. More...
|
|
void | IntervalScale (Tinterval *i1, double e, Tinterval *i_out) |
| Scales an interval. More...
|
|
void | IntervalProduct (Tinterval *i1, Tinterval *i2, Tinterval *i_out) |
| Product of two intervals. More...
|
|
void | IntervalAdd (Tinterval *i1, Tinterval *i2, Tinterval *i_out) |
| Addition of two intervals. More...
|
|
void | IntervalSubstract (Tinterval *i1, Tinterval *i2, Tinterval *i_out) |
| Substraction of two intervals. More...
|
|
void | IntervalInvert (Tinterval *i, Tinterval *i_out) |
| Change of sign of a given interval. More...
|
|
void | IntervalExp (Tinterval *i, Tinterval *i_out) |
| Exponentional of an interval. More...
|
|
void | IntervalPow (Tinterval *i, unsigned int p, Tinterval *i_out) |
| Power of a given interval by a integer power factor. More...
|
|
boolean | IntervalSqrt (Tinterval *i, Tinterval *i_out) |
| Interval square root. More...
|
|
void | IntervalDivision (Tinterval *i1, Tinterval *i2, Tinterval *i_out) |
| Interval division. More...
|
|
void | IntervalOffset (Tinterval *i, double offset, Tinterval *i_out) |
| Interval offset. More...
|
|
void | IntervalSine (Tinterval *i, Tinterval *i_out) |
| Interval sine. More...
|
|
void | IntervalCosine (Tinterval *i, Tinterval *i_out) |
| Interval cosine. More...
|
|
void | IntervalTangent (Tinterval *i, Tinterval *i_out) |
| Interval tangent. More...
|
|
void | IntervalSecant2 (Tinterval *i, Tinterval *i_out) |
| Interval squared secant. More...
|
|
void | IntervalSecant2Tangent (Tinterval *i, Tinterval *i_out) |
| Interval squared secant per tangent. More...
|
|
void | IntervalAtan2 (Tinterval *is, Tinterval *ic, Tinterval *i_out) |
| Interval atan2. More...
|
|
void | PrintSymbolInterval (FILE *f, Tinterval *i) |
| Prints an angular interval. More...
|
|
void | PrintInterval (FILE *f, Tinterval *i) |
| Prints an interval. More...
|
|
void | DeleteInterval (Tinterval *i) |
| Destructor. More...
|
|
double NormalizeAngle |
( |
double |
a | ) |
|
void NewInterval |
( |
double |
lower, |
|
|
double |
upper, |
|
|
Tinterval * |
i |
|
) |
| |
Defines a new interval with the given limits.
- Parameters
-
lower | The lower limit for the new interval. |
upper | The upper limit for the new interval. |
i | The interval to define. |
Definition at line 47 of file interval.c.
References INF_CUT, Tinterval::lower_limit, and Tinterval::upper_limit.
Referenced by AddJacobianEquationsInt(), AddMargin2Box(), AdjustBioWorldGeometry(), BoxSaddleClipping(), BoxSphereClipping(), Buffer2Box(), CleanInfEquation(), ComputeBoundingBox(), ComputeBoundingBox3d(), CropEquation(), CropLinearConstraint(), CuikNewtonInBox(), DefinePolytope(), ErrorDueToVariable(), EvaluateEquationInt(), EvaluateLinearConstraintInt(), EvaluateMonomialInt(), EvaluateVarSetInt(), GenerateEquationsFromBranch(), GenerateJointEquations(), GenerateJointRangeEquations(), GenerateJointRangeSingularityEquations(), GenerateLinkRotFLinks(), GenerateLinkRotLinks(), GenerateLinkRotQLinks(), GenerateWorldSingularityEquations(), GetEquationBounds(), GetFirstOrderApproximationToEquation(), GetJointRangeN(), GetSCpSystem(), IncrementalSampleCuikSystemInBox(), InitBox(), InitBoxFromPoint(), InitJoint(), IntervalCosine(), IntervalSecant2(), IntervalSecant2Tangent(), IntervalSine(), IntervalTangent(), IntervalVectDotProduct(), IntervalVectFromVector(), LoadLinearConstraint(), main(), NewCP(), NewInPatchJoint(), NewSphericalJoint(), NewVariable(), RandomPointInPolytope(), ReadBox(), RectangleCircleClipping(), RectangleParabolaClipping(), RegenerateSolution(), ResetLinearConstraint(), SampleCuikSystemInBox(), SegmentCircleIntersection(), SegmentSphereIntersection(), SetEquationInfo(), SimplexAddNewConstraint(), SimplexExpandBounds(), SimplexGetColBounds(), SimplexGetOptimalValue(), SimplexGetRowBounds(), SimplifyLinearConstraint(), and SplitBox().
Defines a new interval from another interval.
- Parameters
-
i_dst | The interval to create. |
i_org | The interval from where to copy. |
Definition at line 59 of file interval.c.
References Tinterval::lower_limit, and Tinterval::upper_limit.
Referenced by BoxSaddleClipping(), CleanLinearConstraint(), CopyBoxSubset(), CopyJoint(), CopyLinearConstraint(), CopyVariable(), CropEquation(), CropLinearConstraint(), EvaluateVarSetInt(), GetJointRangeN(), GetLinearConstraintError(), NewPrismaticJoint(), NewRevoluteJoint(), NewSphPrsSphJoint(), NewUniversalJoint(), ReduceRange(), RegenerateLinkBoxQLinks(), SetBoxInterval(), SetBoxSubset(), SetLinearConstraintError(), SetVariableInterval(), and SimpleFromOriginal().
Gets the lower limit of an interval
- Parameters
-
- Returns
- The lower limit defining the interval.
Definition at line 79 of file interval.c.
References Tinterval::lower_limit.
Referenced by AddEquation2Simplex(), AddMargin2Box(), BoundedLinearConstraint(), Box2Buffer(), CleanInfEquation(), CropEquation(), CSRemoveVarsWithCtRange(), EquationFromLinearConstraint(), EvaluateVarSetInt(), GenerateJointRangeSingularityEquations(), GetFirstOrderApproximationToEquation(), InitBTree(), InitRRT(), IsSimplificable(), LinearizeBilinealMonomialEquation(), LinearizeCircleEquation(), LinearizeParabolaEquation(), LinearizeSaddleEquation(), LinearizeSphereEquation(), LoadRRT(), main(), NewSphPrsSphJoint(), OutOfBoxTopology(), PlotJoint(), PointInBoxTopology(), randomInInterval(), ReduceRange(), SaveLinearConstraint(), SimplexAddNewConstraintRaw(), SimplexExpandBounds(), SimplexGetOptimalValue(), SimplexSetColBounds(), SimplexSetRowBounds(), SplitBox(), SquaredDistancePointToBoxTopology(), and SquaredDistanceToBoxDimensionTopology().
Gets the upper limit of an interval.
- Parameters
-
- Returns
- The upper limit defining the interval.
Definition at line 87 of file interval.c.
References Tinterval::upper_limit.
Referenced by AddEquation2Simplex(), AddMargin2Box(), BoundedLinearConstraint(), Box2Buffer(), CleanInfEquation(), CropEquation(), EquationFromLinearConstraint(), EvaluateVarSetInt(), GenerateJointRangeSingularityEquations(), InitBTree(), InitRRT(), IsSimplificable(), LinearizeBilinealMonomialEquation(), LinearizeCircleEquation(), LinearizeParabolaEquation(), LinearizeSaddleEquation(), LinearizeSphereEquation(), LoadRRT(), main(), OutOfBoxTopology(), PointInBoxTopology(), randomInInterval(), ReduceRange(), SaveLinearConstraint(), SimplexAddNewConstraintRaw(), SimplexExpandBounds(), SimplexGetOptimalValue(), SimplexSetColBounds(), SimplexSetRowBounds(), SplitBox(), SquaredDistancePointToBoxTopology(), and SquaredDistanceToBoxDimensionTopology().
Gets the upper limit of an interval.
- Parameters
-
- Returns
- The upper limit defining the interval.
Definition at line 96 of file interval.c.
References INF, IS_INF, Tinterval::lower_limit, ROUNDNEAR, ROUNDUP, and Tinterval::upper_limit.
Referenced by AddEquation2Simplex(), CleanInfEquation(), CleanLinearConstraint(), ComputeSplitDimInt(), CropEquation(), CropLinearConstraint(), CSRemoveLCVars(), CSRemoveVarsWithCtRange(), CuikNewtonInBox(), EquationFromLinearConstraint(), EquationFromLinearConstraintProduct(), ErrorDueToVariable(), GenerateJointRangeEquations(), GetBoxDiagonal(), GetBoxMaxDim(), GetBoxMaxSizeVarSet(), GetBoxMinSizeVarSet(), GetBoxSize(), GetBoxSumSide(), GetBoxVolume(), GetLinearConstraintErrorSize(), GetVariableTopology(), IncrementalSampleCuikSystemInBox(), IntervalAtan2(), IntervalCosine(), IntervalSecant2Tangent(), IntervalSine(), IntervalTangent(), IsPunctualBox(), NewPrismaticJoint(), NewRevoluteJoint(), NewSphericalJoint(), NewSphPrsSphJoint(), NewUniversalJoint(), PlotJoint(), PrintLinearConstraint(), ReduceBox(), ReduceBoxEquationWise(), ReduceRange(), ReplaceVariableInEquation(), SetSimplexBounds(), SimplexAddNewConstraint(), and SimplexSetRowBounds().
double DistanceToInterval |
( |
double |
p, |
|
|
Tinterval * |
i |
|
) |
| |
Computes the interval center, i.e., the average between the upper and the lower limit.
- Parameters
-
- Returns
- The interval center.
Definition at line 129 of file interval.c.
References IS_INF, Tinterval::lower_limit, and Tinterval::upper_limit.
Referenced by CropEquation(), CSRemoveLCVars(), CuikNewtonInBox(), DistanceToSubBoxCenter(), EquationFromLinearConstraint(), EquationFromLinearConstraintProduct(), ErrorInInequalities(), ErrorInSolution(), EvaluateEqMin(), GenerateJointRangeEquations(), GetBoxCenter(), GetBoxCenterDistance(), IncrementalSampleCuikSystemInBox(), InitSampleFromBox(), LinearizeCircleEquation(), LinearizeGeneralEquation(), LinearizeParabolaEquation(), LinearizeSphereEquation(), main(), MoveWorld(), NewCP(), NewRevoluteJoint(), NewUniversalJoint(), PointFromVariables(), PrintLinearConstraint(), PrintWorldAxes(), RegenerateSolutionPoint(), ReplaceVariableInEquation(), SampleCuikSystemInBox(), SegmentCircleIntersection(), SegmentSphereIntersection(), SimplexAddNewConstraint(), SimplifyCuikSystem(), UpdateOriginalPointFromSimple(), and UpdateSplitWeight().
double PointInInterval |
( |
double |
r, |
|
|
Tinterval * |
i |
|
) |
| |
Computes a point inside the interval by linear interpolation between the extremes.
If the interval is [-INF,INF] the output is 0, irrespectively of r.
If one of the extremes of the interval is +/-INF, the returned point is one plus/less than the other extreme of the interval.
- Parameters
-
r | The interpoltion factor (must be in [0,1], otherwise the given value is cropped to this range). |
i | The interval. |
- Returns
- The point in the interval.
Definition at line 164 of file interval.c.
References IS_INF, Tinterval::lower_limit, and Tinterval::upper_limit.
Referenced by SplitBox().
void SetLowerLimit |
( |
double |
c, |
|
|
Tinterval * |
i |
|
) |
| |
void SetUpperLimit |
( |
double |
c, |
|
|
Tinterval * |
i |
|
) |
| |
void EnlargeInterval |
( |
double |
lo, |
|
|
double |
uo, |
|
|
Tinterval * |
i |
|
) |
| |
void ExpandInterval |
( |
double |
v, |
|
|
Tinterval * |
i |
|
) |
| |
void UpdateLowerLimit |
( |
double |
c, |
|
|
Tinterval * |
i |
|
) |
| |
Changes the lower limit for an interval only in the new value is upper than the current lower limit.
- Parameters
-
c | The temptative new lower limit. |
i | The interval. |
Definition at line 247 of file interval.c.
References INF_CUT, and Tinterval::lower_limit.
Referenced by ReduceRange().
void UpdateUpperLimit |
( |
double |
c, |
|
|
Tinterval * |
i |
|
) |
| |
Changes the upper limit for an interval only in the new value is lower than the current upper limit.
- Parameters
-
c | The new temptative upper limit. |
i | The interval. |
Definition at line 253 of file interval.c.
References INF_CUT, and Tinterval::upper_limit.
Referenced by ReduceRange().
Checks two given intervals have a non-empty intersection.
- Parameters
-
i1 | The first interval. |
i2 | The second interval. |
- Returns
- TRUE if i1 and i2 intersect.
Definition at line 272 of file interval.c.
References Intersection().
Referenced by CropEquation().
Computes the intersection of two intervals.
- Parameters
-
i1 | The first interval. |
i2 | The second interval. |
i_out | The output intersection interval, possibly empty. |
- Returns
- TRUE if i_out is not empty.
Definition at line 285 of file interval.c.
References Tinterval::lower_limit, and Tinterval::upper_limit.
Referenced by BoxesIntersection(), BoxSaddleClipping(), BoxSphereClipping(), CropLinearConstraint(), Intersect(), RectangleCircleClipping(), RectangleParabolaClipping(), SegmentCircleIntersection(), SegmentSphereIntersection(), SimplifyLinearConstraint(), and UpdateOriginalFromSimple().
Checks if a value is inside an interval.
- Parameters
-
p | The value |
tol | Tolerance in the comparison. |
i | The interval. |
- Returns
- TRUE if the point is inside the interval.
Definition at line 343 of file interval.c.
References INF_CUT, Tinterval::lower_limit, and Tinterval::upper_limit.
Referenced by AddEquation2Simplex(), BoxSaddleClipping(), IntervalDivision(), IntervalPow(), PointInBox(), PointInBoxTopology(), PointInSubBox(), PointInSystemBox(), SegmentCircleIntersection(), and SegmentSphereIntersection().
Product of an interval and a constant.
- Parameters
-
i1 | The input interval. |
e | The scale factor. |
i_out | The resulting interval. |
Definition at line 355 of file interval.c.
References INF_CUT, INF_SCALE, Tinterval::lower_limit, ROUNDDOWN, ROUNDNEAR, ROUNDUP, and Tinterval::upper_limit.
Referenced by BoxSaddleClipping(), CleanLinearConstraint(), ErrorDueToVariable(), EvaluateVarSetInt(), GetFirstOrderApproximationToEquation(), IntervalVectSumVectorScale(), NewInPatchJoint(), RectangleParabolaClipping(), RegenerateLinkBoxLinks(), ScaleBox(), ScaleLinearConstraint(), SegmentCircleIntersection(), and SegmentSphereIntersection().
Product of two intervals.
- Parameters
-
i1 | The first interval. |
i2 | The second interval. |
i_out | The resulting interval. |
Definition at line 384 of file interval.c.
References FALSE, INF_CUT, INF_PROD, Tinterval::lower_limit, ROUNDDOWN, ROUNDNEAR, ROUNDUP, TRUE, and Tinterval::upper_limit.
Referenced by BoxSaddleClipping(), CropLinearConstraint(), DummifyAndAddEquation(), ErrorDueToVariable(), EvaluateLinearConstraintInt(), EvaluateMonomialInt(), EvaluateVarSetInt(), GetFirstOrderApproximationToEquation(), IntervalVectDotProduct(), RectangleParabolaClipping(), RegenerateJointBox(), RegenerateLinkBoxLinks(), RegenerateLinkBoxQLinks(), SegmentCircleIntersection(), SegmentSphereIntersection(), SimplexGetOptimalValue(), and SimplifyLinearConstraint().
Sum of two intervals.
- Parameters
-
i1 | The first interval. |
i2 | The second interval. |
i_out | The resulting interval. |
Definition at line 418 of file interval.c.
References FALSE, INF_ADD, INF_CUT, Tinterval::lower_limit, ROUNDDOWN, ROUNDNEAR, ROUNDUP, TRUE, and Tinterval::upper_limit.
Referenced by AddLinearConstraints(), BoxSphereClipping(), CleanLinearConstraint(), CropLinearConstraint(), ErrorDueToVariable(), EvaluateEquationInt(), EvaluateLinearConstraintInt(), GetFirstOrderApproximationToEquation(), IntervalVectDotProduct(), IntervalVectSumVectorScale(), NewInPatchJoint(), RectangleCircleClipping(), SegmentCircleIntersection(), SegmentSphereIntersection(), SimplexGetOptimalValue(), and UpdateOriginalFromSimple().
Substraction of two intervals.
- Parameters
-
i1 | The first interval. |
i2 | The second interval. |
i_out | The resulting interval. |
Definition at line 437 of file interval.c.
References FALSE, INF_CUT, INF_SUBS, Tinterval::lower_limit, ROUNDDOWN, ROUNDNEAR, ROUNDUP, TRUE, and Tinterval::upper_limit.
Referenced by CleanInfEquation(), SegmentCircleIntersection(), and SegmentSphereIntersection().
Change of sign of a given interval. Equivalen to scale the interval with -1.
- Parameters
-
i | The input interval. |
i_out | The resulting interval. |
Definition at line 456 of file interval.c.
References Tinterval::lower_limit, and Tinterval::upper_limit.
Referenced by BoxSaddleClipping(), BoxSphereClipping(), GetFirstOrderApproximationToEquation(), InvertLinearConstraint(), PrintLinearConstraint(), RectangleCircleClipping(), RectangleParabolaClipping(), SegmentCircleIntersection(), SegmentSphereIntersection(), and UpdateOriginalFromSimple().
Computes
i_out=i_in^p.
- Parameters
-
i | The input interval. |
p | The power. |
i_out | The resulting interval. |
Definition at line 489 of file interval.c.
References INF_CUT, INF_POW, IsInside(), Tinterval::lower_limit, ROUNDDOWN, ROUNDNEAR, ROUNDUP, and Tinterval::upper_limit.
Referenced by BoxSphereClipping(), DummifyAndAddEquation(), ErrorDueToVariable(), EvaluateVarSetInt(), GetFirstOrderApproximationToEquation(), IntervalSecant2(), RectangleCircleClipping(), RectangleParabolaClipping(), SegmentCircleIntersection(), and SegmentSphereIntersection().
Computes the square root of an interval. Negative parts of the interval are not taken into account. If the whole input interval is negative the result is an empty interval.
- Parameters
-
i | The input interval. |
i_out | The resulting interval. |
- Returns
- TRUE if the output interval is NULL.
Definition at line 525 of file interval.c.
References FALSE, INF_CUT, INF_SQRT, Tinterval::lower_limit, ROUNDDOWN, ROUNDNEAR, ROUNDUP, TRUE, and Tinterval::upper_limit.
Referenced by BoxSphereClipping(), NewInPatchJoint(), RectangleCircleClipping(), RectangleParabolaClipping(), SegmentCircleIntersection(), and SegmentSphereIntersection().
Divides one interval by another. If the denominator includes the zero, this function triggers an error.
- Parameters
-
num | The interval numerator. |
den | The interval denominator. |
i_out | The resulting interval. |
Definition at line 551 of file interval.c.
References INF, INF_CUT, IsInside(), Tinterval::lower_limit, ROUNDDOWN, ROUNDNEAR, ROUNDUP, and Tinterval::upper_limit.
Referenced by BoxSaddleClipping(), CropLinearConstraint(), IntervalSecant2(), SegmentCircleIntersection(), SegmentSphereIntersection(), and SimplifyLinearConstraint().
Displaces an interval by a constant value.
- Parameters
-
i | The input interval. |
offset | The quantity to add to the interval limits. |
i_out | The resulting interval. |
Definition at line 622 of file interval.c.
References FALSE, INF_ADD, INF_CUT, Tinterval::lower_limit, ROUNDDOWN, ROUNDNEAR, ROUNDUP, TRUE, and Tinterval::upper_limit.
Referenced by AddCt2LinearConstraint(), AddEquation2Simplex(), BoxSaddleClipping(), CleanInfEquation(), ErrorDueToVariable(), EvaluateEqMin(), EvaluateEqVectorInt(), GetFirstOrderApproximationToEquation(), GetJointRangeN(), NewRevoluteJoint(), NewUniversalJoint(), RectangleParabolaClipping(), SegmentCircleIntersection(), and SegmentSphereIntersection().
Computes the bound of the cosinus on a given interval.
- Parameters
-
i | The input interval. |
i_out | The resulting interval. |
Definition at line 697 of file interval.c.
References IntervalSize(), Tinterval::lower_limit, M_2PI, M_PI, NewInterval(), NormalizeAngle(), and Tinterval::upper_limit.
Referenced by EvaluateVarSetInt(), GenerateJointRangeEquations(), IntCosVector(), IntervalSecant2(), and IntSinVector().
Computes the bound of the atan2 on a given sin/cos intervals.
The current implementation is tailored to post-process solution files and in only works for small intervals.
The output in in the range except for the case where is and ic include (-1,0). In this case the output interval is in the range .
- Parameters
-
is | The sinus interval. |
ic | The cosinus interval. |
i_out | The resulting interval. |
Definition at line 952 of file interval.c.
References Error(), IntervalSize(), Tinterval::lower_limit, M_2PI, M_PI, and Tinterval::upper_limit.
Referenced by main().
void PrintSymbolInterval |
( |
FILE * |
f, |
|
|
Tinterval * |
i |
|
) |
| |
void PrintInterval |
( |
FILE * |
f, |
|
|
Tinterval * |
i |
|
) |
| |
Writes an interval to a stream that can be stdout.
- Parameters
-
f | The strem. |
i | The interval to write. |
Definition at line 1001 of file interval.c.
References EmptyInterval(), INF_PRINT, Tinterval::lower_limit, and Tinterval::upper_limit.
Referenced by AddEquation2Simplex(), CleanInfEquation(), CropEquation(), CropLinearConstraint(), PrintBox(), PrintBoxSubset(), PrintJoint(), PrintLinearConstraint(), PrintVariable(), ReduceRange(), SetSimplexBounds(), and SimplexAddNewConstraintRaw().
|
Follow us!