mirror of https://github.com/CGAL/cgal
fix bug: matrix should not be modified but was
This commit is contained in:
parent
00da4e19fd
commit
b1836a362f
|
|
@ -26,21 +26,21 @@ struct Filtered_kernel_d : public Cartesian_d<typename Kernel::FT>
|
||||||
// the corresponding exact kernel
|
// the corresponding exact kernel
|
||||||
//typedef Linear_algebraCd< Exact_nt, boost::pool_allocator<Exact_nt> > Exact_linalg;
|
//typedef Linear_algebraCd< Exact_nt, boost::pool_allocator<Exact_nt> > Exact_linalg;
|
||||||
typedef Linear_algebraCd< 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
|
// the kernel used for filtered predicates
|
||||||
typedef Interval_nt<false> IA;
|
typedef Interval_nt<false> IA;
|
||||||
//typedef Linear_algebraCd<IA, boost::pool_allocator<IA> > Interval_linalg;
|
//typedef Linear_algebraCd<IA, boost::pool_allocator<IA> > Interval_linalg;
|
||||||
typedef Linear_algebraCd<IA > Interval_linalg;
|
typedef Linear_algebraCd<IA> Interval_linalg;
|
||||||
typedef Cartesian_d<IA, Interval_linalg > FK;
|
typedef Cartesian_d<IA, Interval_linalg > Approximate_kernel;
|
||||||
|
|
||||||
// the converter
|
// the converter
|
||||||
typedef Cartesian_converter_d<Base, EK> C2E;
|
typedef Cartesian_converter_d<Base, Exact_kernel> C2E;
|
||||||
typedef Cartesian_converter_d<Base, FK> C2F;
|
typedef Cartesian_converter_d<Base, Approximate_kernel> C2F;
|
||||||
|
|
||||||
// we change the predicates.
|
// we change the predicates.
|
||||||
#define CGAL_Kernel_pred(P, Pf) \
|
#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(); }
|
P Pf() const { return P(); }
|
||||||
|
|
||||||
// we don't touch the constructions.
|
// we don't touch the constructions.
|
||||||
|
|
|
||||||
|
|
@ -44,18 +44,18 @@
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
|
|
||||||
// Guess which compiler needs this work around ?
|
// Guess which compiler needs this work around ?
|
||||||
namespace CGALi {
|
namespace internal {
|
||||||
template < typename K1, typename K2 >
|
template < typename K1, typename K2 >
|
||||||
struct Default_converter_d {
|
struct Default_converter_d {
|
||||||
typedef typename K1::FT FT1;
|
typedef typename K1::FT FT1;
|
||||||
typedef typename K2::FT FT2;
|
typedef typename K2::FT FT2;
|
||||||
typedef ::CGAL::NT_converter<FT1, FT2> Type;
|
typedef ::CGAL::NT_converter<FT1, FT2> Type;
|
||||||
};
|
};
|
||||||
} // namespace CGALi
|
} // namespace internal
|
||||||
|
|
||||||
template < class K1, class K2,
|
template < class K1, class K2,
|
||||||
//class Converter = NT_converter<typename K1::FT, typename K2::FT> >
|
//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
|
class Cartesian_converter_d : public Enum_converter
|
||||||
{
|
{
|
||||||
typedef Enum_converter Base;
|
typedef Enum_converter Base;
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,10 @@ namespace internal
|
||||||
|
|
||||||
template<class Matrix>
|
template<class Matrix>
|
||||||
Sign // The matrix is row major: M[i] represents row i.
|
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)
|
sign_of_determinantDxD_with_interval_arithmetic(Matrix & M)
|
||||||
// attempts to compute the determinant using interval arithmetic
|
// attempts to compute the determinant using interval arithmetic
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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);
|
CGAL_KD_TRACEN("Triangular_system_solver");CGAL_KD_TRACEV(U);CGAL_KD_TRACEV(b);
|
||||||
D = FT(1); int i;
|
D = FT(1); int i;
|
||||||
for (i = rank; i < U.row_dimension(); ++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());
|
x = Vector(U.column_dimension());
|
||||||
for (i = rank-1; i>=0; --i) {
|
for (i = rank-1; i>=0; --i) {
|
||||||
|
|
|
||||||
|
|
@ -74,14 +74,14 @@ PointCd(int d, InputIterator first, InputIterator last)
|
||||||
// else first specifies common denominator:
|
// else first specifies common denominator:
|
||||||
CGAL_assertion_msg(FT(*first)!=FT(0),
|
CGAL_assertion_msg(FT(*first)!=FT(0),
|
||||||
"PointCd::constructor: denominator must be nonzero.");
|
"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>
|
template <class InputIterator>
|
||||||
PointCd (int d, InputIterator first, InputIterator last,
|
PointCd (int d, InputIterator first, InputIterator last,
|
||||||
const FT& D) : Base( Tuple(d,first,last) )
|
const FT& D) : Base( Tuple(d,first,last) )
|
||||||
{ CGAL_assertion_msg(D!=FT(0),"PointCd::constructor: D must be nonzero.");
|
{ 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) )
|
PointCd(int x, int y, int w = 1) : Base( Tuple((FT)x,(FT)y) )
|
||||||
|
|
|
||||||
|
|
@ -401,6 +401,7 @@ class Side_of_oriented_subsphereCd
|
||||||
typedef typename R::Oriented_side Oriented_side;
|
typedef typename R::Oriented_side Oriented_side;
|
||||||
typedef typename R::Side_of_oriented_sphere_d Side_of_oriented_sphere;
|
typedef typename R::Side_of_oriented_sphere_d Side_of_oriented_sphere;
|
||||||
typedef typename R::Coaffine_orientation_d Coaffine_orientation;
|
typedef typename R::Coaffine_orientation_d Coaffine_orientation;
|
||||||
|
typedef typename LA::Matrix Matrix;
|
||||||
typedef typename Coaffine_orientation::Axes Axes;
|
typedef typename Coaffine_orientation::Axes Axes;
|
||||||
// DATA MEMBERS
|
// DATA MEMBERS
|
||||||
mutable Coaffine_orientation ori_;
|
mutable Coaffine_orientation ori_;
|
||||||
|
|
@ -427,7 +428,7 @@ public:
|
||||||
return sos(first, last, q); // perhaps slap user on the back of the head here?
|
return sos(first, last, q); // perhaps slap user on the back of the head here?
|
||||||
}
|
}
|
||||||
if( M.row_dimension() < d+1 )
|
if( M.row_dimension() < d+1 )
|
||||||
M = typename LA::Matrix(d+1);
|
M = Matrix(d+1);
|
||||||
if( ! ori_.state().axes_found_ )
|
if( ! ori_.state().axes_found_ )
|
||||||
{
|
{
|
||||||
// the call to ori_(...) will compute a set of axes to complement our base.
|
// the call to ori_(...) will compute a set of axes to complement our base.
|
||||||
|
|
|
||||||
|
|
@ -118,6 +118,6 @@ public:
|
||||||
} //namespace CGAL
|
} //namespace CGAL
|
||||||
|
|
||||||
#include <CGAL/Kernel_d/Linear_algebraCd_impl.h>
|
#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
|
#endif // CGAL_LINEAR_ALGEBRACD_H
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue