CFx SDK Documentation
2020SP3
SDK
CFx
dd_inc
Ge
GeEllipArc.h
Go to the documentation of this file.
1
// Copyright (C) 2002-2017, Open Design Alliance (the "Alliance").
3
// All rights reserved.
4
//
5
// This software and its documentation and related materials are owned by
6
// the Alliance. The software may only be incorporated into application
7
// programs owned by members of the Alliance, subject to a signed
8
// Membership Agreement and Supplemental Software License Agreement with the
9
// Alliance. The structure and organization of this software are the valuable
10
// trade secrets of the Alliance and its suppliers. The software is also
11
// protected by copyright law and international treaty provisions. Application
12
// programs incorporating this software must include the following statement
13
// with their copyright notices:
14
//
15
// This application incorporates Teigha(R) software pursuant to a license
16
// agreement with Open Design Alliance.
17
// Teigha(R) Copyright (C) 2002-2017 by Open Design Alliance.
18
// All rights reserved.
19
//
20
// By use of this software, its documentation or related materials, you
21
// acknowledge and accept the above terms.
23
24
25
#ifndef __OD_GE_ELLIP_ARC__
26
#define __OD_GE_ELLIP_ARC__
27
28
#include "
OdRound.h
"
29
35
namespace
OdGeEllipArc
36
{
42
inline
double
calibrateAngle
(
double
val,
double
input)
43
{
44
if
(input > val)
45
{
46
if
( (input - val) <
OdaPI
)
47
return
val;
48
else
49
return
val +
OdRound
((input - val)/
Oda2PI
)*
Oda2PI
;
50
}
51
else
52
{
53
if
( (val - input) <
OdaPI
)
54
return
val;
55
else
56
return
val -
OdRound
((val - input)/
Oda2PI
)*
Oda2PI
;
57
}
58
}
59
74
inline
double
angleFromParam
(
75
double
param,
76
double
radiusRatio)
77
{
78
if
(
OdZero
(param))
79
return
0;
80
if
(
OdZero
(param -
Oda2PI
))
81
return
Oda2PI
;
82
83
return
calibrateAngle
(
OD_ATAN2
(radiusRatio*sin(param), cos(param)), param);
84
}
85
101
inline
double
paramFromAngle
(
102
double
angle,
103
double
radiusRatio)
104
{
105
if
(
OdZero
(angle))
106
return
0;
107
if
(
OdZero
(angle -
Oda2PI
))
108
return
Oda2PI
;
109
110
return
calibrateAngle
(
OD_ATAN2
(sin(angle), radiusRatio*cos(angle)), angle);
111
}
112
}
113
114
#endif // __OD_GE_ELLIP_ARC__
Oda2PI
#define Oda2PI
Definition:
OdaCommon.h:57
OdaPI
#define OdaPI
Definition:
OdaCommon.h:51
OdGeEllipArc::angleFromParam
double angleFromParam(double param, double radiusRatio)
Definition:
GeEllipArc.h:74
OdGeEllipArc::calibrateAngle
double calibrateAngle(double val, double input)
Definition:
GeEllipArc.h:42
OD_ATAN2
#define OD_ATAN2(y, x)
Definition:
DebugStuff.h:258
OdGeEllipArc::paramFromAngle
double paramFromAngle(double angle, double radiusRatio)
Definition:
GeEllipArc.h:101
OdGeEllipArc
Definition:
GeEllipArc.h:36
OdRound.h
OdZero
bool OdZero(double x, double tol=1.e-10)
Definition:
OdaDefs.h:513
OdRound
double OdRound(double a)
Definition:
OdRound.h:33
Generated on Mon Oct 12 2020 11:49:33