Tesseract 3.02

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Macros | Typedefs | Functions
fpoint.h File Reference
`#include "host.h"`
`#include <stdio.h>`
`#include <math.h>`

Go to the source code of this file.

## Classes

struct | FPOINT

## Macros

#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)
#define | XIntersectionOf(A, B, X) ( SlopeFrom(A,B) * ((X) - A.x) + A.y)

## Typedefs

typedef FPOINT | FVECTOR

## Functions

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

## Macro Definition Documentation

#define AngleFrom | ( |  | A,
|  |  | B
| ) |  |

Value:
( atan2((double) YDelta(A,B), \
(double) XDelta(A,B) ) )

Definition at line 42 of file fpoint.h.

#define SlopeFrom | ( |  | A,
|  |  | B
| ) |  | ( YDelta(A,B) / XDelta(A,B) )

Definition at line 41 of file fpoint.h.

#define XDelta | ( |  | A,
|  |  | B
| ) |  | ( (B).x - (A).x )

Macros —————————————————————————-

Definition at line 39 of file fpoint.h.

#define XIntersectionOf | ( |  | A,
|  |  | B,
|  |  | X
| ) |  | ( SlopeFrom(A,B) * ((X) - A.x) + A.y)

Definition at line 45 of file fpoint.h.

#define YDelta | ( |  | A,
|  |  | B
| ) |  | ( (B).y - (A).y )

Definition at line 40 of file fpoint.h.

## Typedef Documentation

typedef FPOINT FVECTOR

Definition at line 33 of file fpoint.h.

## Function Documentation

FLOAT32 DistanceBetween | ( | FPOINT | A,
|  | FPOINT | B
| ) |  |

Include Files and Type Defines —————————————————————————- ---------------------------------------------------------------------------- Public Code —————————————————————————-

Definition at line 31 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
| ) |  |

Definition at line 39 of file fpoint.cpp.

{
/*
** Parameters:
** Point1, Point2 points to compute angle between
** FullScale value to associate with 2*pi
** Globals: none
** Operation: 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).
** Return: none
** Exceptions: none
** History: Wed Mar 28 14:27:25 1990, DSJ, Created.
*/
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);
} /* NormalizedAngleFrom */