All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
fpoint.cpp
Go to the documentation of this file.
1 /******************************************************************************
2  ** Filename: fpoint.c
3  ** Purpose: Abstract data type for a 2D point (floating point coords)
4  ** Author: Dan Johnson
5  ** History: Thu Apr 12 10:44:15 1990, DSJ, Created.
6  **
7  ** (c) Copyright Hewlett-Packard Company, 1988.
8  ** Licensed under the Apache License, Version 2.0 (the "License");
9  ** you may not use this file except in compliance with the License.
10  ** You may obtain a copy of the License at
11  ** http://www.apache.org/licenses/LICENSE-2.0
12  ** Unless required by applicable law or agreed to in writing, software
13  ** distributed under the License is distributed on an "AS IS" BASIS,
14  ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  ** See the License for the specific language governing permissions and
16  ** limitations under the License.
17  ******************************************************************************/
18 /*----------------------------------------------------------------------------
19  Include Files and Type Defines
20 ----------------------------------------------------------------------------*/
21 #include "const.h"
22 #include "fpoint.h"
23 #include <stdio.h>
24 #include <math.h>
25 
26 /*----------------------------------------------------------------------------
27  Public Code
28 ----------------------------------------------------------------------------*/
29 
31  double xd = XDelta(A, B);
32  double yd = YDelta(A, B);
33  return sqrt(static_cast<double>(xd * xd + yd * yd));
34 }
35 
49  FPOINT *Point2,
50  FLOAT32 FullScale) {
51  FLOAT32 Angle;
52  FLOAT32 NumRadsInCircle = 2.0 * PI;
53 
54  Angle = AngleFrom (*Point1, *Point2);
55  if (Angle < 0.0)
56  Angle += NumRadsInCircle;
57  Angle *= FullScale / NumRadsInCircle;
58  if (Angle < 0.0 || Angle >= FullScale)
59  Angle = 0.0;
60  return (Angle);
61 
62 }
#define YDelta(A, B)
Definition: fpoint.h:40
float FLOAT32
Definition: host.h:111
FLOAT32 NormalizedAngleFrom(FPOINT *Point1, FPOINT *Point2, FLOAT32 FullScale)
Definition: fpoint.cpp:48
Definition: fpoint.h:29
#define AngleFrom(A, B)
Definition: fpoint.h:42
FLOAT32 DistanceBetween(FPOINT A, FPOINT B)
Definition: fpoint.cpp:30
#define PI
Definition: const.h:19
#define XDelta(A, B)
Definition: fpoint.h:39