tesseract  3.04.00
fpoint.cpp File Reference
#include "const.h"
#include "fpoint.h"
#include <stdio.h>
#include <math.h>

Go to the source code of this file.

Functions

FLOAT32 DistanceBetween (FPOINT A, FPOINT B)
 
FLOAT32 NormalizedAngleFrom (FPOINT *Point1, FPOINT *Point2, FLOAT32 FullScale)
 

Function Documentation

FLOAT32 DistanceBetween ( FPOINT  A,
FPOINT  B 
)

Include Files and Type Defines

Public Code

Definition at line 31 of file fpoint.cpp.

31  {
32  double xd = XDelta(A, B);
33  double yd = YDelta(A, B);
34  return sqrt(static_cast<double>(xd * xd + yd * yd));
35 }
#define YDelta(A, B)
Definition: fpoint.h:40
#define XDelta(A, B)
Definition: fpoint.h:39
FLOAT32 NormalizedAngleFrom ( FPOINT Point1,
FPOINT Point2,
FLOAT32  FullScale 
)

Definition at line 39 of file fpoint.cpp.

41  {
42 /*
43  ** Parameters:
44  ** Point1, Point2 points to compute angle between
45  ** FullScale value to associate with 2*pi
46  ** Globals: none
47  ** Operation: Return the angle from Point1 to Point2 normalized to
48  ** lie in the range 0 to FullScale (where FullScale corresponds
49  ** to 2*pi or 360 degrees).
50  ** Return: none
51  ** Exceptions: none
52  ** History: Wed Mar 28 14:27:25 1990, DSJ, Created.
53  */
54  FLOAT32 Angle;
55  FLOAT32 NumRadsInCircle = 2.0 * PI;
56 
57  Angle = AngleFrom (*Point1, *Point2);
58  if (Angle < 0.0)
59  Angle += NumRadsInCircle;
60  Angle *= FullScale / NumRadsInCircle;
61  if (Angle < 0.0 || Angle >= FullScale)
62  Angle = 0.0;
63  return (Angle);
64 
65 } /* NormalizedAngleFrom */
#define PI
Definition: const.h:19
#define AngleFrom(A, B)
Definition: fpoint.h:42
float FLOAT32
Definition: host.h:111