UtilitiesSignedAngularDistanceToTarget Method |
Determines the signed angle to move from the specified angle to as
close to the specified target as possible whilst satisfying the
limits.
Namespace: Demo3D.Visuals.KJEAssembly: Demo3D.Core (in Demo3D.Core.dll) Version: 19.00.00
Syntaxpublic static double SignedAngularDistanceToTarget(
double angle,
double target,
double upper,
double lower,
int directionHint
)
Parameters
- angle Double
- The current angle in radians (does not need to be normalized).
- target Double
- The target angle in radians (does not need to be normalized).
- upper Double
- The upper limit in radians (does not need to be normalized).
- lower Double
- The lower limit in radians (does not need to be normalized).
- directionHint Int32
- Hint as to the direction of the motor (used if the target is invalid).
Return Value
DoubleThe signed distance to move from the angle to as close to the target as possible whilst avoiding limits.
Remarks
If the limits are invalid (infinite or NaN) then no limits is imposed and the distance
is the shortest distance between the angle and the target.
If the angle provided violates the limits then the distance is the distance between the
angle and the target (or the closest limit to the target if the target violates the
limits) by moving in the direction of the closest limit to the current angle.
If the angle provided satisfies the limits then the distance is the distance between the
angle and the target (or the closest limit to the target if the target violates the
limits) in the direction that avoids violating the limits.
A positive distance returned indicates that the movement should be in the anti-clockwise
direction. A negative distance indicates that the movement should be in the clockwise
direction.
See Also