tesseract 3.04.01

classify/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 
)

Definition at line 30 of file fpoint.cpp.

                                            {
  double xd = XDelta(A, B);
  double yd = YDelta(A, B);
  return sqrt(static_cast<double>(xd * xd + yd * yd));
}
FLOAT32 NormalizedAngleFrom ( FPOINT Point1,
FPOINT Point2,
FLOAT32  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:
Point1points to compute angle between
Point2points to compute angle between
FullScalevalue to associate with 2*pi
Returns:
none
Note:
Globals: none
Exceptions: none
History: Wed Mar 28 14:27:25 1990, DSJ, Created.

Definition at line 48 of file fpoint.cpp.

                                               {
  FLOAT32 Angle;
  FLOAT32 NumRadsInCircle = 2.0 * PI;

  Angle = AngleFrom (*Point1, *Point2);
  if (Angle < 0.0)
    Angle += NumRadsInCircle;
  Angle *= FullScale / NumRadsInCircle;
  if (Angle < 0.0 || Angle >= FullScale)
    Angle = 0.0;
  return (Angle);

}
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines