Subject: CGAL users discussion list
List archive
- From: Indranil Chowdhury <>
- To:
- Subject: [cgal-discuss] Using user defined field Number Type in CGAL
- Date: Fri, 4 Mar 2016 17:03:49 -0500
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=Pass ; spf=None
- Ironport-phdr: 9a23:+GNTER/Fcug9VP9uRHKM819IXTAuvvDOBiVQ1KB91u8cTK2v8tzYMVDF4r011RmSDdqdtKwP0raH+4nbGkU+or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6anHS+4HYoFwnlMkItf6KuStGU0Jr8jrzjs7ToICx2xxOFKYtoKxu3qQiD/uI3uqBFbpgL9x3Sv3FTcP5Xz247bXianhL7+9vitMU7q3cY6Lod8JtLXqz+Oqg5VrdFFy8OMmYv5cStuwOQYxGI4y49VGkMmxxJB0Du7BblUpfsqDqy4ut71DOTO8zyQ6ozXDWk46ZiYBDtgSYDcTU+9TeE2YRLkKtHrUf59FREyInObdTNOQ==
Hi,
I am new to the CGAL mailing list. I am playing with CGAL triangulation lately, and am trying to use my own double number type to pass to CGAL and want all computations that the CGAL kernel does to use this only (specially the comparison operators). Currently I am not concerned with speed, but want the kernel to interprete anything less than a threshold to be zero. Code :
#include <boost\operators.hpp>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
//a number type to overload all floating point operations
struct myDouble : boost::operators<myDouble>
{
double val;
myDouble( double f )
{val = f;}
myDouble( const myDouble &f ):
val(f.val){}
{
double val;
myDouble( double f )
{val = f;}
myDouble( const myDouble &f ):
val(f.val){}
//arithmetic operators...
//logical operators
bool operator<(const myDouble &other ) const
{
bool isEqual = (std::abs(val-other.val) < c_zero);//c_zero is a given threshold
return ( !isEqual && val<other.val );
}
bool operator==(const myDouble &other ) const
{
return ( std::abs(val-other.val) < c_zero );
}
};
{
bool isEqual = (std::abs(val-other.val) < c_zero);//c_zero is a given threshold
return ( !isEqual && val<other.val );
}
bool operator==(const myDouble &other ) const
{
return ( std::abs(val-other.val) < c_zero );
}
};
///From definition of inexact kernels
namespace CGAL
{
// A modification of inexact kernel from CGAL
class Epick_cgal2DSurf
: public Filtered_kernel_adaptor<
Type_equality_wrapper< Simple_cartesian<myDouble>::Base<Epick_cgal2DSurf>::Type, Epick_cgal2DSurf >,
#ifdef CGAL_NO_STATIC_FILTERS
false >
#else
true >
#endif
{
};
}
I get compilation error :
Error 1 error C2440: '<function-style-cast>' : cannot convert from 'const CgalDouble' to 'CGAL::Gmpq' E:\AnsysDev\3rdparty\CGAL\CGAL-4.4\include\CGAL\NT_converter.h 41
{
// A modification of inexact kernel from CGAL
class Epick_cgal2DSurf
: public Filtered_kernel_adaptor<
Type_equality_wrapper< Simple_cartesian<myDouble>::Base<Epick_cgal2DSurf>::Type, Epick_cgal2DSurf >,
#ifdef CGAL_NO_STATIC_FILTERS
false >
#else
true >
#endif
{
};
}
I get compilation error :
Error 1 error C2440: '<function-style-cast>' : cannot convert from 'const CgalDouble' to 'CGAL::Gmpq' E:\AnsysDev\3rdparty\CGAL\CGAL-4.4\include\CGAL\NT_converter.h 41
and I am not sure how to get this code to compile.
My questions are:
1. Is there any way for CGAL to accept this numberType and get it compiled?
2. Is there any other way to tell CGAL that any quantity less than specified is zero?
Thank you
Indranil
- [cgal-discuss] Using user defined field Number Type in CGAL, Indranil Chowdhury, 03/04/2016
- Re: [cgal-discuss] Using user defined field Number Type in CGAL, Marc Glisse, 03/04/2016
- Re: [cgal-discuss] Using user defined field Number Type in CGAL, Indranil Chowdhury, 03/07/2016
- Re: [cgal-discuss] Using user defined field Number Type in CGAL, Marc Glisse, 03/07/2016
- Re: [cgal-discuss] Using user defined field Number Type in CGAL, Indranil Chowdhury, 03/07/2016
- Re: [cgal-discuss] Using user defined field Number Type in CGAL, Marc Glisse, 03/04/2016
Archive powered by MHonArc 2.6.18.