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.KJE
Assembly:
Demo3D.Core (in Demo3D.Core.dll) Version: 15.0.2.11458
Syntaxpublic static double SignedAngularDistanceToTarget(
double angle,
double target,
double upper,
double lower,
int directionHint
)
Parameters
- angle
- Type: SystemDouble
The current angle in radians (does not need to be normalized). - target
- Type: SystemDouble
The target angle in radians (does not need to be normalized). - upper
- Type: SystemDouble
The upper limit in radians (does not need to be normalized). - lower
- Type: SystemDouble
The lower limit in radians (does not need to be normalized). - directionHint
- Type: SystemInt32
Hint as to the direction of the motor (used if the target is invalid).
Return Value
Type:
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