#include <cmath>
#include <cstdio>
Go to the source code of this file.
|
#define | XDelta(A, B) ((B).x - (A).x) |
|
#define | YDelta(A, B) ((B).y - (A).y) |
|
#define | SlopeFrom(A, B) (YDelta(A, B) / XDelta(A, B)) |
|
#define | AngleFrom(A, B) (atan2((double)YDelta(A, B), (double)XDelta(A, B))) |
|
#define | XIntersectionOf(A, B, X) (SlopeFrom(A, B) * ((X)-A.x) + A.y) |
|
◆ AngleFrom
#define AngleFrom |
( |
|
A, |
|
|
|
B |
|
) |
| (atan2((double)YDelta(A, B), (double)XDelta(A, B))) |
◆ SlopeFrom
◆ XDelta
#define XDelta |
( |
|
A, |
|
|
|
B |
|
) |
| ((B).x - (A).x) |
◆ XIntersectionOf
#define XIntersectionOf |
( |
|
A, |
|
|
|
B, |
|
|
|
X |
|
) |
| (SlopeFrom(A, B) * ((X)-A.x) + A.y) |
◆ YDelta
#define YDelta |
( |
|
A, |
|
|
|
B |
|
) |
| ((B).y - (A).y) |
◆ FVECTOR
◆ DistanceBetween()
Definition at line 28 of file fpoint.cpp.
30 const double xd =
XDelta(A, B);
31 const double yd =
YDelta(A, B);
32 return sqrt(static_cast<double>(xd * xd + yd * yd));
◆ NormalizedAngleFrom()
float NormalizedAngleFrom |
( |
FPOINT * |
Point1, |
|
|
FPOINT * |
Point2, |
|
|
float |
FullScale |
|
) |
| |
Return the angle from Point1 to Point2 normalized to lie in the range 0 to FullScale (where FullScale corresponds to 2*pi or 360 degrees).
- Parameters
-
Point1 | points to compute angle between |
Point2 | points to compute angle between |
FullScale | value to associate with 2*pi |
- Returns
- angle
Definition at line 43 of file fpoint.cpp.
45 float NumRadsInCircle = 2.0 * M_PI;
47 float Angle =
AngleFrom (*Point1, *Point2);
49 Angle += NumRadsInCircle;
50 Angle *= FullScale / NumRadsInCircle;
51 if (Angle < 0.0 || Angle >= FullScale)