51 #ifndef CGAL_RATIONAL_ROTATION_H
52 #define CGAL_RATIONAL_ROTATION_H
68 #ifndef CGAL_CFG_NO_NAMESPACE
70 #endif // CGAL_CFG_NO_NAMESPACE
74 const NT
NT0 = NT(0) ;
75 const NT
NT1 = NT(1) ;
96 if (dy * dy * d * d < sq_hypotenuse * n * n)
126 common_part = (sin*sin*d*d + n*n*den*
den)*sq_hypotenuse;
128 rhs = dy*dy*d*d*den*
den;
130 upper_ok = (common_part - diff_part <
rhs);
131 lower_ok = (common_part + diff_part >
rhs);
133 if ( lower_ok && upper_ok )
151 if ( dy*dy*den*den < sin*sin*sq_hypotenuse )
168 if (dy > dx ) {
swap (sin,cos); }
170 if (dx < NT0) { cos = -
cos; }
172 if (dy < NT0) { sin = -
sin; }
180 template <
class NT >
189 #ifndef CGAL_CFG_NO_NAMESPACE
191 #endif // CGAL_CFG_NO_NAMESPACE
195 const NT NT0 = NT(0) ;
196 const NT NT1 = NT(1) ;
202 double dsin =
sin(angle);
203 double dcos =
cos(angle);
206 double eps = dn / dd;
214 bool swapped =
false;
252 upper_ok = (common_part - diff_part < os);
253 lower_ok = (os < common_part +
diff_part);
255 if ( lower_ok && upper_ok )
287 if ( swapped ) {
swap (isin,icos); }
291 if (dcos < 0.0) { icos = - icos; }
292 if (dsin < 0.0) { isin = - isin; }
303 #endif // CGAL_RATIONAL_ROTATION_H
void swap(int &a, int &b)
CGAL_BEGIN_NAMESPACE double to_double(double d)
CGAL_BEGIN_NAMESPACE void const NT NT NT & cos_num
double angle(Vector_3< double > v1, Vector_3< double > v2)
Compute the angle between two vectors.
void rational_rotation_approximation(const double &angle, NT &sin_num, NT &cos_num, NT &denom, const NT &eps_num, const NT &eps_den)
CGAL_BEGIN_NAMESPACE void const NT NT NT NT const NT const NT & eps_den
CGAL_BEGIN_NAMESPACE void const NT NT & sin_num
#define CGAL_BEGIN_NAMESPACE
CGAL_BEGIN_NAMESPACE void const NT & diry
CGAL_BEGIN_NAMESPACE void const NT NT NT NT & denom
#define CGAL_END_NAMESPACE
#define CGAL_kernel_precondition(EX)
CGAL_BEGIN_NAMESPACE void const NT NT NT NT const NT & eps_num