\( \newcommand{\E}{\mathrm{E}} \) \( \newcommand{\A}{\mathrm{A}} \) \( \newcommand{\R}{\mathrm{R}} \) \( \newcommand{\N}{\mathrm{N}} \) \( \newcommand{\Q}{\mathrm{Q}} \) \( \newcommand{\Z}{\mathrm{Z}} \) \( \def\ccSum #1#2#3{ \sum_{#1}^{#2}{#3} } \def\ccProd #1#2#3{ \sum_{#1}^{#2}{#3} }\)
CGAL 4.4 - 2D and 3D Linear Geometry Kernel
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
CGAL::rational_rotation_approximation()

Functions

template<RingNumberType >
void CGAL::rational_rotation_approximation (const RingNumberType &dirx, const RingNumberType &diry, RingNumberType &sin_num, RingNumberType &cos_num, RingNumberType &denom, const RingNumberType &eps_num, const RingNumberType &eps_den)
 computes integers sin_num, cos_num and denom, such that sin_num/denom approximates the sine of direction \( (\)dirx,diry \( )\). More...
 

Function Documentation

template<RingNumberType >
void CGAL::rational_rotation_approximation ( const RingNumberType dirx,
const RingNumberType diry,
RingNumberType sin_num,
RingNumberType cos_num,
RingNumberType denom,
const RingNumberType eps_num,
const RingNumberType eps_den 
)

computes integers sin_num, cos_num and denom, such that sin_num/denom approximates the sine of direction \( (\)dirx,diry \( )\).

The difference between the sine and the approximating rational is bounded by eps_num/eps_den.

Precondition
eps_num \( \neq0\).

Implementation

The approximation is based on Farey sequences as described in the rational rotation method presented by Canny and Ressler at the 8th SoCG 1992. We use a slower version which needs no division operation in the approximation.

See Also
CGAL::Aff_transformation_2<Kernel>

#include <CGAL/rational_rotation.h>