fix bug: matrix should not be modified but was

This commit is contained in:
Samuel Hornus 2011-05-09 20:20:22 +00:00
parent 00da4e19fd
commit b1836a362f
8 changed files with 46 additions and 38 deletions

View File

@ -26,21 +26,21 @@ struct Filtered_kernel_d : public Cartesian_d<typename Kernel::FT>
// the corresponding exact kernel
//typedef Linear_algebraCd< Exact_nt, boost::pool_allocator<Exact_nt> > Exact_linalg;
typedef Linear_algebraCd< Exact_nt > Exact_linalg;
typedef Cartesian_d<Exact_nt, Exact_linalg> EK;
typedef Cartesian_d<Exact_nt, Exact_linalg> Exact_kernel;
// the kernel used for filtered predicates
typedef Interval_nt<false> IA;
//typedef Linear_algebraCd<IA, boost::pool_allocator<IA> > Interval_linalg;
typedef Linear_algebraCd<IA > Interval_linalg;
typedef Cartesian_d<IA, Interval_linalg > FK;
typedef Linear_algebraCd<IA> Interval_linalg;
typedef Cartesian_d<IA, Interval_linalg > Approximate_kernel;
// the converter
typedef Cartesian_converter_d<Base, EK> C2E;
typedef Cartesian_converter_d<Base, FK> C2F;
typedef Cartesian_converter_d<Base, Exact_kernel> C2E;
typedef Cartesian_converter_d<Base, Approximate_kernel> C2F;
// we change the predicates.
#define CGAL_Kernel_pred(P, Pf) \
typedef Filtered_predicate<typename EK::P, typename FK::P, C2E, C2F> P; \
typedef Filtered_predicate<typename Exact_kernel::P, typename Approximate_kernel::P, C2E, C2F> P; \
P Pf() const { return P(); }
// we don't touch the constructions.

View File

@ -44,18 +44,18 @@
namespace CGAL {
// Guess which compiler needs this work around ?
namespace CGALi {
namespace internal {
template < typename K1, typename K2 >
struct Default_converter_d {
typedef typename K1::FT FT1;
typedef typename K2::FT FT2;
typedef ::CGAL::NT_converter<FT1, FT2> Type;
};
} // namespace CGALi
} // namespace internal
template < class K1, class K2,
//class Converter = NT_converter<typename K1::FT, typename K2::FT> >
class Converter = typename CGALi::Default_converter_d<K1, K2>::Type >
class Converter = typename internal::Default_converter_d<K1, K2>::Type >
class Cartesian_converter_d : public Enum_converter
{
typedef Enum_converter Base;

View File

@ -12,6 +12,10 @@ namespace internal
template<class Matrix>
Sign // The matrix is row major: M[i] represents row i.
/*
FIXME : the function DOES MODIFY the matrix M, but calling functions
assume M is not modified --> BUGS. (e.g. Side_of_oriented_subsphere)
*/
sign_of_determinantDxD_with_interval_arithmetic(Matrix & M)
// attempts to compute the determinant using interval arithmetic
{

View File

@ -135,7 +135,10 @@ Triangular_system_solver(const Matrix &U, const Matrix& L, const Vector &b,
CGAL_KD_TRACEN("Triangular_system_solver");CGAL_KD_TRACEV(U);CGAL_KD_TRACEV(b);
D = FT(1); int i;
for (i = rank; i < U.row_dimension(); ++i)
if ( b[i] != FT(0) ) { x = L.row(i); return false; }
if ( b[i] != FT(0) ) {
x = L.row(i);
return false;
}
x = Vector(U.column_dimension());
for (i = rank-1; i>=0; --i) {

View File

@ -74,14 +74,14 @@ PointCd(int d, InputIterator first, InputIterator last)
// else first specifies common denominator:
CGAL_assertion_msg(FT(*first)!=FT(0),
"PointCd::constructor: denominator must be nonzero.");
for (int i=0; i<d; ++i) entry(i)/=FT(*first);
for (int i=0; i<d; ++i) entry(i)=entry(i)/FT(*first);
}
template <class InputIterator>
PointCd (int d, InputIterator first, InputIterator last,
const FT& D) : Base( Tuple(d,first,last) )
{ CGAL_assertion_msg(D!=FT(0),"PointCd::constructor: D must be nonzero.");
for (int i=0; i<d; ++i) entry(i)/=D;
for (int i=0; i<d; ++i) entry(i)=entry(i)/D;
}
PointCd(int x, int y, int w = 1) : Base( Tuple((FT)x,(FT)y) )

View File

@ -401,6 +401,7 @@ class Side_of_oriented_subsphereCd
typedef typename R::Oriented_side Oriented_side;
typedef typename R::Side_of_oriented_sphere_d Side_of_oriented_sphere;
typedef typename R::Coaffine_orientation_d Coaffine_orientation;
typedef typename LA::Matrix Matrix;
typedef typename Coaffine_orientation::Axes Axes;
// DATA MEMBERS
mutable Coaffine_orientation ori_;
@ -427,7 +428,7 @@ public:
return sos(first, last, q); // perhaps slap user on the back of the head here?
}
if( M.row_dimension() < d+1 )
M = typename LA::Matrix(d+1);
M = Matrix(d+1);
if( ! ori_.state().axes_found_ )
{
// the call to ori_(...) will compute a set of axes to complement our base.

View File

@ -53,56 +53,56 @@ CGAL_Kernel_obj(Line_d)
CGAL_Kernel_pred(Affinely_independent_d,
affinely_independent_d_object)
affinely_independent_d_object)
CGAL_Kernel_pred(Affine_rank_d,
affine_rank_d_object)
affine_rank_d_object)
CGAL_Kernel_pred(Compare_lexicographically_d,
compare_lexicographically_d_object)
compare_lexicographically_d_object)
CGAL_Kernel_pred(Contained_in_affine_hull_d,
contained_in_affine_hull_d_object)
contained_in_affine_hull_d_object)
CGAL_Kernel_pred(Contained_in_linear_hull_d,
contained_in_linear_hull_d_object)
contained_in_linear_hull_d_object)
CGAL_Kernel_pred(Contained_in_simplex_d,
contained_in_simplex_d_object)
contained_in_simplex_d_object)
// TODO: create a Do_intersect_d functor
//CGAL_Kernel_pred(Do_intersect_d,
// do_intersect_d_object)
// do_intersect_d_object)
CGAL_Kernel_pred(Less_lexicographically_d,
less_lexicographically_d_object)
less_lexicographically_d_object)
CGAL_Kernel_pred(Less_or_equal_lexicographically_d,
less_or_equal_lexicographically_d_object)
less_or_equal_lexicographically_d_object)
CGAL_Kernel_pred(Linearly_independent_d,
linearly_independent_d_object)
linearly_independent_d_object)
CGAL_Kernel_pred(Linear_rank_d,
linear_rank_d_object)
linear_rank_d_object)
CGAL_Kernel_pred(Orientation_d,
orientation_d_object)
orientation_d_object)
CGAL_Kernel_pred(Coaffine_orientation_d,
coaffine_orientation_d_object)
coaffine_orientation_d_object)
CGAL_Kernel_pred(Side_of_bounded_sphere_d,
side_of_bounded_sphere_d_object)
side_of_bounded_sphere_d_object)
CGAL_Kernel_pred(Side_of_oriented_sphere_d,
side_of_oriented_sphere_d_object)
side_of_oriented_sphere_d_object)
CGAL_Kernel_pred(Side_of_oriented_subsphere_d,
side_of_oriented_subsphere_d_object)
side_of_oriented_subsphere_d_object)
CGAL_Kernel_pred(Oriented_side_d,
oriented_side_d_object)
oriented_side_d_object)
CGAL_Kernel_cons(Linear_base_d,
linear_base_d_object)
linear_base_d_object)
CGAL_Kernel_cons(Center_of_sphere_d,
center_of_sphere_d_object)
center_of_sphere_d_object)
CGAL_Kernel_cons(Intersection_d_,
intersection_d_object)
intersection_d_object)
CGAL_Kernel_cons(Lift_to_paraboloid_d,
lift_to_paraboloid_d_object)
lift_to_paraboloid_d_object)
CGAL_Kernel_cons(Midpoint_d,
midpoint_d_object)
midpoint_d_object)
CGAL_Kernel_cons(Project_along_d_axis_d,
project_along_d_axis_d_object)
project_along_d_axis_d_object)
CGAL_Kernel_cons(Squared_distance_d,
squared_distance_d_object)
squared_distance_d_object)
#undef CGAL_Kernel_pred
#undef CGAL_Kernel_cons

View File

@ -118,6 +118,6 @@ public:
} //namespace CGAL
#include <CGAL/Kernel_d/Linear_algebraCd_impl.h>
#include <CGAL/Kernel_d/Interval_linear_algebra.h>
//#include <CGAL/Kernel_d/Interval_linear_algebra.h>
#endif // CGAL_LINEAR_ALGEBRACD_H