removing NiX:: remains

This commit is contained in:
Pavel Emeliyanenko 2008-08-07 16:51:27 +00:00
parent 228f6864fa
commit d9714ea0d6
7 changed files with 62 additions and 98 deletions

View File

@ -1042,13 +1042,13 @@ public:
return oi; // bad luck
const Poly_double_2* params = param_surface();
double x0 = NiX::substitute_xy(params[0], cc.first, cc.second),
y0 = NiX::substitute_xy(params[1], cc.first, cc.second),
z0 = NiX::substitute_xy(params[2], cc.first, cc.second);
invw = 1.0 / NiX::substitute_xy(params[3], cc.first, cc.second);
*oi++ = x0*invw;
*oi++ = y0*invw;
*oi++ = z0*invw;
typename CGAL::Polynomial_traits_d< Poly_double_2 >::Substitute subst;
double *ptr = (double *)&cc;
invw = 1.0 / subst(params[3], ptr, ptr+2);
*oi++ = subst(params[0], ptr, ptr+2) * invw;
*oi++ = subst(params[1], ptr, ptr+2) * invw;
*oi++ = subst(params[2], ptr, ptr+2) * invw;
return oi;
}
#endif // CGAL_CKVA_COMPILE_RENDERER

View File

@ -528,7 +528,7 @@ void draw(const Arc_2& arc, Container< std::vector < Coord_2 > >& points,
Pixel_2 pix_1, pix_2;
Gfx_OUT("lower: " << CGAL::to_double(lower) << "; upper: " <<
CGAL::to_double(upper) << "; y_lower: " << NiX::to_double(y_lower) <<
CGAL::to_double(upper) << "; y_lower: " << CGAL::to_double(y_lower) <<
"; y_upper: " << CGAL::to_double(y_upper) << "\n");
get_pixel_coords(lower, y_lower, pix_1);
@ -637,9 +637,7 @@ void draw(const Arc_2& arc, Container< std::vector < Coord_2 > >& points,
Gfx_OUT("NO clip points\n");
mid = (lower + upper)/2;
// NiX::simplify(mid);
pt = engine.x_min_r + (pix_1.x*2+5)*engine.pixel_w_r/2;
// NiX::simplify(pt);
// segment is almost vertical - start from a middle point
//if(pt > mid)
pt = mid;
@ -708,7 +706,6 @@ void draw(const Arc_2& arc, Container< std::vector < Coord_2 > >& points,
Gfx_OUT("starting point is near the left end-point\n");
//pt = engine.x_min_r + (pix_1.x*2+5)*engine.pixel_w_r/2;
pt = (lower + l)/2;
// NiX::simplify(pt);
if(pt <= lower) {
refine_alg_point(l, r, *ppoly, lower, 1);
pt = l;
@ -727,7 +724,6 @@ void draw(const Arc_2& arc, Container< std::vector < Coord_2 > >& points,
CGAL::to_double(r) << ": pixel_w_r: " <<
CGAL::to_double(engine.pixel_w_r) << "\n");
// NiX::simplify(pt);
if(pt >= upper) {
// ensure that clip-point interval is sufficiently small
refine_alg_point(l, r, *ppoly, upper, 1);
@ -1184,8 +1180,8 @@ bool get_seed_point(const Rational& seed, Pixel_2& start, int *dir,
current_level = 0;
//Gfx_OUT("refining starting pixel: " << start << std::endl);
// Gfx_OUT("x/y seed: (" << NiX::to_double(x_seed) << "; " <<
// NiX::to_double(y_seed) << ")" << std::endl);
// Gfx_OUT("x/y seed: (" << CGAL::to_double(x_seed) << "; " <<
// CGAL::to_double(y_seed) << ")" << std::endl);
b_taken[0] = b_taken[1] = -1;
b_coincide = false;
@ -1263,23 +1259,7 @@ bool get_seed_point(const Rational& seed, Pixel_2& start, int *dir,
vx = -engine.substitute_xy(*(engine.rational_fy), x_s, y_s),
vy = engine.substitute_xy(*(engine.rational_fx), x_s, y_s);
/* typename Renderer_traits::Convert_poly convert_poly;
Poly_2 ffx, ffy;
ffx = convert_poly(*(engine.rational_fx));
ffy = convert_poly(*(engine.rational_fy));
typename CGAL::Coercion_traits<Rational, Coeff>::Cast
castr;
Coeff xx1 = castr(x_s), yy1 = castr(y_s);
Coeff vvx = NiX::substitute_xy(ffy, xx1, yy1);
Coeff vvy = NiX::substitute_xy(ffx, xx1, yy1); */
//typename CGAL::Coercion_traits<Rat_coercion_type, Coeff>::Cast
//cast;
NT vvx = rat2float(vx), vvy = rat2float(vy);
//Coeff vvx = cast(vx), vvy = cast(vy);
if(vvy < 0) {
vvx = -vvx;
}
@ -1590,7 +1570,6 @@ void horizontal_clip()
int n_roots = isolator_btm.number_of_real_roots(), i;
Rational criteria = engine.pixel_w_r/CGAL_REFINE_CLIP_POINTS;
// NiX::simplify(criteria);
for(i = 0; i < n_roots; i++) {
l = isolator_btm.left_boundary(i);

View File

@ -234,13 +234,13 @@ private:
//! modular traits for bivariate polynomial
typedef CGAL::Modular_traits<Rational_poly_2> MT_poly_2;
//! a modular image of a bivariate polynomial
typedef typename MT_poly_2::Modular_NT Modular_poly_2;
typedef typename MT_poly_2::Residue_type Modular_poly_2;
//! a modular image of a univariate polynomial
typedef typename Modular_poly_2::NT Modular_poly_1;
//! modular traits for rationals
typedef CGAL::Modular_traits<Rational> MT_rational;
//! a modular image for rationals
typedef typename MT_rational::Modular_NT Modular_rat;
typedef typename MT_rational::Residue_type Modular_rat;
//! a modular converter for rationals
typename MT_rational::Modular_image image_rat;
@ -828,9 +828,9 @@ int evaluate_generic(int var, const NT& c, const NT& key, const Poly_1& poly)
if(error_bounds_) {
//Gfx_OUT("error_bounds_\n");
sign = evaluate_modular(var, c, key);
if(sign != 0)
sign = evaluate_rational(var, c, key);
//sign = evaluate_modular(var, c, key);
//if(sign != 0)
sign = evaluate_rational(var, c, key);
} else
sign = CGAL_SGN(res);
if(not_cached)
@ -855,22 +855,24 @@ int evaluate_generic(int var, const NT& c, const NT& key, const Poly_1& poly)
int evaluate_modular(int var, const NT& c, const NT& key)
{
#if !AcX_SQRT_EXTENSION
Modular_poly_1 poly;
Rational c_r = float2rat(c), key_r = float2rat(key);
c_r = (var == CGAL_X_RANGE) ? (x_min_r + c_r*pixel_w_r) :
(y_min_r + c_r*pixel_h_r);
Modular_poly_2 *mod = modular_x;
if(var == CGAL_Y_RANGE) {
mod = modular_y;
key_r = x_min_r + key_r*pixel_w_r;
} else
c_r = y_min_r + c_r*pixel_h_r;
} else {
c_r = x_min_r + c_r*pixel_w_r;
key_r = y_min_r + key_r*pixel_h_r;
}
//!@todo: get rid of NiX::substitute_x !!!
poly = NiX::substitute_x(*mod, image_rat(key_r));
Modular_rat res = poly.evaluate(image_rat(c_r));
typename CGAL::Polynomial_traits_d< Modular_poly_2 >::Substitute subst;
Modular_rat ccs[2] = {image_rat(key_r), image_rat(c_r)};
Modular_rat res = subst(*mod, ccs, ccs+2);
return CGAL_SGN(res.x());
#else //!@todo: decide by Algebraic_structure_traits<Coeff>::Field_with_sqrt
return -1; // modular arithmetic is disabled with sqrt extension
#endif
@ -898,7 +900,7 @@ int evaluate_rational(int var, const NT& c, const NT& key)
//! precomputes polynomials and derivative coefficients
void precompute(const Polynomial_2& in) {
typedef typename Polynomial_traits_2::Inntermost_coefficient_type Coeff_src;
typedef typename Polynomial_traits_2::Innermost_coefficient_type Coeff_src;
Max_coeff<Coeff_src> max_coeff;
Coeff_src max_c = max_coeff(in);

View File

@ -109,7 +109,7 @@ struct Transform {
}
OutputPoly_2 operator()(
const typename Inntermost_coefficient_type<InputPoly_2>::Type& x, Op op)
const typename Innermost_coefficient_type<InputPoly_2>::Type& x, Op op)
const {
return static_cast<OutputPoly_2>(op(x));

View File

@ -120,7 +120,7 @@ private:
typedef CGAL::Polynomial<Poly_1> Poly_2;
//! conversion from the basic number type to doubles
typename NiX::NT_traits<NT>::To_double to_double;
typename CGAL::Real_embeddable_traits<NT>::To_double to_double;
//! conversion from the basic number type to integers
typename Renderer_traits::To_integer to_integer;
//! conversion from \c Integer type to built-in integer

View File

@ -18,7 +18,7 @@
#ifndef CGAL_CKVA_SUBDIVISION_2_H
#define CGAL_CKVA_SUBDIVISION_2_H 1
#warning "this file is considered obsolete"
#warning this file is considered obsolete
#include <vector>
#include <CGAL/Polynomial.h>
@ -82,8 +82,7 @@ public:
private:
//! \name private typedefs
//@{
//! conversion from the basic number type to doubles
typename NiX::NT_traits<NT>::To_double to_double;
//! conversion from the basic number type to integers
typename SoX::Curve_renderer_traits<NT>::To_integer to_integer;
//! conversion from \c Integer type to built-in integer
@ -262,8 +261,8 @@ void Subdivision_2<NT_, Algebraic_curve_2_>::quad_tree(const NT& x_low,
return;
if(x_high - x_low <= pixel_w&&y_high - y_low <= pixel_h) {
NT x = (x_low), y = (y_low);
int pix_x = static_cast<int>(NiX::to_double((x - x_min) / pixel_w)),
pix_y = static_cast<int>(NiX::to_double((y - y_min) / pixel_h));
int pix_x = static_cast<int>(CGAL::to_double((x - x_min) / pixel_w)),
pix_y = static_cast<int>(CGAL::to_double((y - y_min) / pixel_h));
painter->drawPoint(pix_x, res_h - pix_y);
//painter->drawEllipse(pix_x-2,res_h-pix_y-2,4,4);
}
@ -292,7 +291,7 @@ void Subdivision_2<NT_, Algebraic_curve_2_>::get_range_RT_2(
//std::cout << "range for [" << x_low << "; " << y_low << "]x[" <<
//x_high <<
//"; " << y_high << "]: (" << low << "; " << high << ")" << std::endl;
typename std::vector<Poly_2>::const_iterator der_it =
/*typename std::vector<Poly_2>::const_iterator der_it =
mixed_derivatives.begin() + index;
if((*der_it).degree()==0) {
NT c = (*der_it).lcoeff().lcoeff();
@ -364,7 +363,7 @@ void Subdivision_2<NT_, Algebraic_curve_2_>::get_range_RT_2(
get_range_RT_2(x_low, x_high, y_low, y_high, depth+2, idx+2, fyy);
res = res + ((x1*x1/2*zero1)*fxx) + ((y1*y1/2*zero2)*fyy) +
((x1*y1*one3)*fxy);
}
} */
//res.convert(lower, upper);
//std::cout << "range for depth = " << depth << " index = " << index <<

View File

@ -215,22 +215,17 @@ public:
typedef Curve_renderer_facade< typename Base::Projected_kernel_2 >
Facade;
typename Facade::Coord_2 cc;
std::pair< double, double > cc;
if(!Facade::instance().draw(this->projected_point(), cc))
return false; // bad luck
CGAL::Bbox_2 bbox;
int res_w, res_h;
Facade::instance().get_resolution(res_w, res_h);
Facade::instance().get_window(bbox);
// gotcha !!
double lx = bbox.xmax() - bbox.xmin(), ly = bbox.ymax() - bbox.ymin();
double x0 = bbox.xmin() + (double)cc.x * lx / res_w,
y0 = bbox.ymin() + (double)cc.y * ly / res_h;
double *ptr = (double *)&cc;
typename CGAL::Polynomial_traits_d< Poly_double_3 >::Substitute subst;
Poly_double_1 ppt = NiX::substitute_xy(base_poly_approx(), x0, y0);
result = Approximation_3(x0, y0, compute_z(ppt, this->sheet()));
Poly_double_1 ppt = subst(base_poly_approx(), ptr, ptr+2);
result = Approximation_3(ptr[0], ptr[1],
compute_z(ppt, this->sheet()));
return true;
}
#endif // CGAL_CKVA_COMPILE_RENDERER
@ -242,16 +237,14 @@ public:
this->curve().status_line_at_exact_x(this->x()).
algebraic_real_2(this->arcno()).to_double();
typename CGAL::Polynomial_traits_d< Poly_double_3 >::Substitute subst;
double *ptr = (double *)&xy;
Poly_double_1 ppt =
NiX::substitute_xy(
base_poly_approx(CGAL::to_double(this->surface().f())),
xy.first, xy.second
);
return Approximation_3(
xy.first,
xy.second,
compute_z(ppt, this->sheet())
);
subst(base_poly_approx(CGAL::to_double(this->surface().f())),
ptr, ptr+2);
return Approximation_3(ptr[0], ptr[1], compute_z(ppt, this->sheet()));
}
private:
@ -621,43 +614,34 @@ public:
typedef Curve_renderer_facade< typename Base::Projected_kernel_2 >
Facade;
typedef typename Facade::Coord_vec_2 Coord_vec_2;
typedef typename Facade::Coord_2 Coord_2;
typedef std::pair< double, double > Coord_2;
typedef std::vector< Coord_2 > Coord_vec_2;
std::list<Coord_vec_2> points;
std::pair<Coord_2, Coord_2> end_points;
Facade::instance().draw(this->projected_arc(), points, end_points);
Facade::instance().draw(this->projected_arc(), points);
if(points.empty())
return oi;
CGAL::Bbox_2 bbox;
int res_w, res_h;
Facade::instance().get_resolution(res_w, res_h);
Facade::instance().get_window(bbox);
double pixw = (bbox.xmax() - bbox.xmin()) / res_w,
pixh = (bbox.ymax() - bbox.ymin()) / res_h;
typename CGAL::Polynomial_traits_d< Poly_double_3 >::Substitute subst;
typename std::list<Coord_vec_2>::const_iterator lit = points.begin();
while(lit != points.end()) {
const Coord_vec_2& tmp = *lit++;
typename Coord_vec_2::const_iterator cit;
int xprev = -1, yprev = -1;
double xprev = -1, yprev = -1;
for(cit = tmp.begin(); cit != tmp.end(); cit++) {
if(xprev == cit->x && yprev == cit->y)
if(xprev == cit->first && yprev == cit->second)
continue; // don't push duplicate points
xprev = cit->x, yprev = cit->y;
double x0 = bbox.xmin() + (double)xprev * pixw,
y0 = bbox.ymin() + (double)yprev * pixh;
// std::cerr << "x = " << cit->x << "; y = " << cit->y <<
// "; x0 = " << x0 << "; y0 = " << y0 << std::endl;
//! @todo is there any way to get rid of substitute_xy ???
Poly_double_1 ppt = NiX::substitute_xy(
Quadric_point_2::base_poly_approx(), x0, y0);
*oi++ = Approximation_3(x0, y0,
xprev = cit->first, yprev = cit->second;
double *ptr = (double *)&(*cit);
Poly_double_1 ppt = subst(Quadric_point_2::base_poly_approx(),
ptr, ptr+2);
*oi++ = Approximation_3(ptr[0], ptr[1],
Quadric_point_2::compute_z(ppt, this->sheet()));
}
}