1 // Copyright (c) 1995-1999 Matra Datavision
2 // Copyright (c) 1999-2012 OPEN CASCADE SAS
4 // The content of this file is subject to the Open CASCADE Technology Public
5 // License Version 6.5 (the "License"). You may not use the content of this file
6 // except in compliance with the License. Please obtain a copy of the License
7 // at http://www.opencascade.org and read it completely before using this file.
9 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
10 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12 // The Original Code and all software distributed under the License is
13 // distributed on an "AS IS" basis, without warranty of any kind, and the
14 // Initial Developer hereby disclaims all such warranties, including without
15 // limitation, any warranties of merchantability, fitness for a particular
16 // purpose or non-infringement. Please see the License for the specific terms
17 // and conditions governing the rights and limitations under the License.
20 #ifndef PRIMITIVE_PXX_INCLUDED
21 #define PRIMITIVE_PXX_INCLUDED
23 #define NEW_ANGLE(a) { \
24 int quot = (int) (a/(2. * M_PI)); \
25 if (Abs(quot) >= 1) a = a - 2. * M_PI * quot; \
28 #define REALEPSILON() (0.0001)
30 #define VALUE_OF_ANGLE(x,y,z) { \
33 if (x <= REALEPSILON ()) x = 0.; \
35 if (-x <= REALEPSILON ()) x = 0.; \
37 if (y <= REALEPSILON ()) y = 0.; \
39 if (-y <= REALEPSILON ()) y = 0.; \
41 if (y > 0.) z = M_PI / 2.; \
42 else z = - M_PI / 2.; \
48 if ((x < 0.) && (y > 0.)) { \
50 if ((a >= M_PI / 2.-REALEPSILON ()) && \
51 (a <= M_PI + REALEPSILON ())) \
56 if ((x >= 0.) && (y > 0.)) { \
59 (a <= M_PI / 2. + REALEPSILON ())) \
64 if ((x < 0.) && (y < 0.)) { \
68 if ((x > 0.) && (y < 0.)) { \
71 (a <= M_PI / 2. + REALEPSILON ())) \
78 #define XROTATE(x,y) ((x)*cosa - (y)*sina)
79 #define YROTATE(x,y) ((y)*cosa + (x)*sina)