Subject: CGAL users discussion list
List archive
- From: "S. Gerace" <>
- To:
- Subject: [cgal-discuss] CGAL::Null_tag to non-scalar type CGAL::Object
- Date: Tue, 12 Apr 2011 10:48:00 -0700 (PDT)
Greetings,
Sorry if this is a double post, I tried to send this earlier before
subscribing to the mailing this and although I could see it in Nabble, the
mailing this seemed to reject my post.
I'm having a problem with the newest version of CGAL and trying to utilize
some of the template functions within the geometric kernels. Basically, I
have a few classes that inherit from CGAL objects (Segment_2, Vector_2,
etc.) that add convenience functions to these classes for my particular
application. Previously (CGAL 3.5.1) this was not an issue and everything
compiled fine; yesterday I compiled CGAL 3.7 and I got a bunch of compiler
errors yelling about a "conversion from CGAL::Null_tag to non-scalar type
CGAL::Object". I've been able to isolate the issue in the following simple
example:
// This class just inherits from CGAL Segment_2
class Segment_2D : public CGAL::Segment_2
{
public:
// Constructs a new Segment2D with a given start and end coordinates
inline Segment_2D(const CGAL::Point_2 &p,
const CGAL::Point_2 &q)
: CGAL::Segment_2(p, q) { }
};
void CgalInheritanceTest()
{
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
// Using CGAL classes with CGAL::intersection works fine
CGAL::Segment_2 s1(CGAL::Point_2(0,0), CGAL::Point_2(1,1));
CGAL::Segment_2 s2(CGAL::Point_2(0,0.5), CGAL::Point_2(1,0.5));
bool doesIntersect = CGAL::do_intersect(s1, s2);
CGAL::Object result = CGAL::intersection(s1, s2);
std::cout << "Did intersect: " << doesIntersect << std::endl;
std::cout << "Found intersection: " << !(result.is_empty()) <<
std::endl << std::endl;
// Using child classes of CGAL classes with CGAL::intersection does not
work
Segment_2D sg1(CGAL::Point_2(0,0), CGAL::Point_2(1,1));
Segment_2D sg2(CGAL::Point_2(0,0.5), CGAL::Point_2(1,0.5));
bool doesIntersect2 = CGAL::do_intersect(sg1, sg2); // This call works
fine
CGAL::Object result2 = CGAL::intersection(sg1, sg2); // Compile error:
conversion from CGAL::Null_tag to non-scalar type CGAL::Object with CGAL 3.7
std::cout << "Did intersect: " << doesIntersect2 << std::endl;
std::cout << "Found intersection: " << !(result2.is_empty()) <<
std::endl;
}
This code compiles and runs without issues with CGAL 3.5.1, but has an issue
with CGAL 3.7...both were compiled on Windows 7 using MinGW/GCC 4.4.0. Any
help would be greatly appreciated.
Thanks,
Sal
--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/CGAL-Null-tag-to-non-scalar-type-CGAL-Object-tp3445266p3445266.html
Sent from the cgal-discuss mailing list archive at Nabble.com.
- [cgal-discuss] CGAL::Null_tag to non-scalar type CGAL::Object, S. Gerace, 04/12/2011
- Re: [cgal-discuss] CGAL::Null_tag to non-scalar type CGAL::Object, Sebastien Loriot (GeometryFactory), 04/13/2011
- [cgal-discuss] Re: CGAL::Null_tag to non-scalar type CGAL::Object, S. Gerace, 04/13/2011
- Re: [cgal-discuss] CGAL::Null_tag to non-scalar type CGAL::Object, Sebastien Loriot (GeometryFactory), 04/13/2011
Archive powered by MHonArc 2.6.16.