Subject: CGAL users discussion list
List archive
- From: Kim <>
- To:
- Subject: Re: [cgal-discuss] [REPOST] Why do I get precondition violation here
- Date: Thu, 14 May 2009 23:12:38 +0200
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; b=wTe/nw/dAX0cFUaFmtWdBlKAbAkD90OEMA9VYF54zwAK5jCq9/SAaO9H7MODY1AaHS qpMwDcfLo+BGwPOYX4IPZj500ssm7wX+m086L560kpnreckrwJKVjKRJTe/hUHgw9sle dVJrvd7iL3SuiuldgYxdG5rMr6ohZYFV2zJCI=
Hi Damian ..
Ones again , thanks for your time .
Unfortunately "is_simple" is not member pgn
Error 1 error C2039: 'is_simple' : is not a member of
'CGAL::General_polygon_2<Arr_traits>'
c:\cgal\projects\likedemo\likedemo\likedemo\likedemo.cpp 117
likedemo
7 (1.74193e+006 44602.1 1.61312e+006 1) [1.74193e+006 43332 -->
1.7432e+006 44602]
(1.73489e+006 44595.5 6.90773e+007 1) [1.7432e+006 44602 -->
1.73847e+006 52099]
(1.73792e+006 50955.1 1.60508e+006 1) [1.73847e+006 52099 -->
1.73792e+006 52222]
(1.73792e+006 50951.9 1.61312e+006 1) [1.73792e+006 52222 -->
1.73665e+006 50952]
(1.73792e+006 50952 1.61415e+006 1) [1.73665e+006 50952 --> 1.73737e+006
49805]
(1.73491e+006 44606.1 3.31029e+007 -1) [1.73737e+006 49805 -->
1.74066e+006 44602]
(1.74193e+006 44602.1 1.61312e+006 1) [1.74066e+006 44602 -->
1.74193e+006 43332]
as you see, it consist of 7 segments , both start and end are the same
and the 7 arc as I sent into
as a 3 points arcs they are not intersecting .
Do anyone have maded a graphic reader for this format which could
check the view.
(Did not get the QT to work ) .
I will try to make a more simple polygon with only one arc and see how
that goes.
Best regards
Kim
On Thu, May 14, 2009 at 6:59 PM, Damian Sheehy
<>
wrote:
> Hi Kim,
>
> The documentation says;
>
> Returns the orientation of pgn. If the number of vertices
> p.size() < 3 then COLLINEAR is returned.
> Precondition: p.is simple().
>
> The precondition means the code will assert if the polygon is not simple.
> Is your polygon simple? Does it self-intersect?
>
> Check the outcome of pgn.is_simple() to see if your polygon passes the test.
>
> Damian
>
> On Thu, May 14, 2009 at 8:13 AM, Kim
> <>
> wrote:
>>
>> Hi Damian , thank for you interest in my problem .
>>
>> if it easier or more helpfull , I can attach my full project , just
>> let me know if needed
>> I had no problem until I introduced Circle arcs in my X_monotone curves.
>>
>> typeDefs comes longer down for readability
>>
>> void ReadPoly(std::istream& is,Polygon_2& pgn, std::string& nextPolyType)
>> {
>> XCurve curve;
>> std::list<XCurve> xcvs;
>> ..
>> ..
>> //some pseudo code begin
>>
>> do
>> data<<new data from file
>> readSegment(data,curve);
>> xcvs.push_back(curve);
>>
>> loop until no_more_lines.
>> //some pseudo code ends
>>
>> pgn = Polygon_2 (xcvs.begin(), xcvs.end());
>>
>> if (pgn.orientation()==CGAL::CLOCKWISE ) <<--failes -Precondition
>> violation.
>>
>> pgn.reverse_orientation();
>> }
>>
>> void readSegment(std::string s, XCurve& curve)
>> {
>> int t;
>>
>> readSegment_field(s,t);
>> switch (t)
>> {
>> case 0: { // line curvesegment
>> int sx,sy,ex,ey;
>> readSegment_line(s,sx,sy,ex,ey);
>> Point_2 ps = Point_2(sx,sy);
>> Point_2 pe = Point_2(ex,ey);
>>
>> curve = XCurve(ps,pe);
>>
>> };break;
>> case 1: { //arc curvesegment
>> int sx,sy,mx,my,ex,ey;
>> readSegment_arc(s,sx,sy,mx,my,ex,ey);
>> Point_2 ps = Point_2(sx,sy); //startpoint
>> Point_2 pm = Point_2(mx,my); //midpoint
>> Point_2 pe = Point_2(ex,ey); //endpoint
>> Curve c =Curve( ps,pm,pe);
>> curve =
>> XCurve(c.supporting_circle(),c.source(),c.target(),c.orientation(),0);
>>
>> // curve = XCurve(ps,pe); // this did work perfect if used
>> instead of above line
>> };break;
>> case 2: {
>>
>> };break;
>>
>> } //switch
>> }
>>
>> my typedefs :
>>
>> typedef CGAL::Gmpq Base_nt;
>> typedef CGAL::Lazy_exact_nt<Base_nt> Coord_type;
>>
>> struct Kernel : public CGAL::Cartesian<Coord_type> {};
>>
>> typedef Kernel::Point_2 Point_2;
>> typedef Kernel::Circle_2 Circle;
>> typedef CGAL::Gps_circle_segment_traits_2<Kernel> Traits;
>> typedef Traits::Curve_2 Curve;
>> typedef Traits::X_monotone_curve_2 XCurve;
>> typedef Traits::Point_2 Circular_point_2;
>> typedef Traits::Polygon_2 Polygon_2;
>>
>> best regards
>> kim
>>
>> On Thu, May 14, 2009 at 2:06 PM, Kim Pedersen
>> <>
>> wrote:
>> > Hi Damian , thank for you interest in my problem .
>> >
>> > if it easier or more helpfull , I can attach my full project , just
>> > let me know if needed
>> > I had no problem until I introduced Circle arcs in my X_monotone
>> > curves.
>> >
>> > typeDefs comes longer down for readability
>> >
>> > void ReadPoly(std::istream& is,Polygon_2& pgn, std::string&
>> > nextPolyType)
>> > {
>> > XCurve curve;
>> > std::list<XCurve> xcvs;
>> > ..
>> > ..
>> > do //some pseudo code
>> > data<<new data from file
>> > readSegment(data,curve);
>> > xcvs.push_back(curve);
>> >
>> > loop until no_more_lines. //some pseudo code ends
>> >
>> > pgn = Polygon_2 (xcvs.begin(), xcvs.end());
>> >
>> > if (pgn.orientation()==CGAL::CLOCKWISE ) <<--failes here Precondition
>> > violation. , se below
>> > pgn.reverse_orientation();
>> > }
>> >
>> > void readSegment(std::string s, XCurve& curve)
>> > {
>> > int t;
>> >
>> > readSegment_field(s,t);
>> > switch (t)
>> > {
>> > case 0: {
>> > int sx,sy,ex,ey;
>> > readSegment_line(s,sx,sy,ex,ey);
>> > Point_2 ps = Point_2(sx,sy);
>> > Point_2 pe = Point_2(ex,ey);
>> >
>> > curve = XCurve(ps,pe);
>> >
>> > };break;
>> > case 1: {
>> > int sx,sy,mx,my,ex,ey;
>> > readSegment_arc(s,sx,sy,mx,my,ex,ey);
>> > Point_2 ps = Point_2(sx,sy); //startpoint
>> > Point_2 pm = Point_2(mx,my); //midpoint
>> > Point_2 pe = Point_2(ex,ey); //endpoint
>> > Curve c =Curve( ps,pm,pe);
>> > curve =
>> > XCurve(c.supporting_circle(),c.source(),c.target(),c.orientation(),0);
>> >
>> > // curve = XCurve(ps,pe); // this did work perfect if used
>> > instead of above line
>> > };break;
>> > case 2: {
>> >
>> > };break;
>> >
>> > } //switch
>> > }
>> >
>> > my typedefs :
>> >
>> > typedef CGAL::Gmpq Base_nt;
>> > typedef CGAL::Lazy_exact_nt<Base_nt> Coord_type;
>> >
>> > struct Kernel : public CGAL::Cartesian<Coord_type> {};
>> >
>> > typedef Kernel::Point_2 Point_2;
>> > typedef Kernel::Circle_2 Circle;
>> > typedef CGAL::Gps_circle_segment_traits_2<Kernel> Traits;
>> > typedef Traits::Curve_2 Curve;
>> > typedef Traits::X_monotone_curve_2 XCurve;
>> > typedef Traits::Point_2 Circular_point_2;
>> > typedef Traits::Polygon_2 Polygon_2;
>> >
>> > best regards
>> > kim
>> >
>> > On Thu, May 14, 2009 at 3:26 AM, Damian Sheehy
>> > <>
>> > wrote:
>> >> Hi Kim,
>> >>
>> >> You need to provide more details. Which orientation test are you
>> >> using?
>> >> CGAL::orientation(ForwardIterator,ForwardIterator)? It takes two
>> >> arguments.
>> >>
>> >>>> if (pgn.orientation()==CGAL::CLOCKWISE )
>> >> What is png - Portable Network Graphics?
>> >> Damian
>> >> On Wed, May 13, 2009 at 5:49 PM, Kim
>> >> <>
>> >> wrote:
>> >>>
>> >>> Hi
>> >>> sorry ! this is a repost ,,, but I am really stopped.
>> >>>
>> >>> noone has any idear at all ? any clue is appreciated!
>> >>> I am sure the start and endpoint are the same ,, since if I input the
>> >>> same , just as linesegment then it works perfect.
>> >>>
>> >>> Why is the polygon below failing when
>> >>> trying to
>> >>> if (pgn.orientation()==CGAL::CLOCKWISE ) <-- fails with error , see
>> >>> below
>> >>> Precondition violation.
>> >>>
>> >>> I can not see any thing wrong !!
>> >>>
>> >>> Polygon_2(
>> >>> (Circle_2(PointC2(1.74193e+006, 44602.1),
>> >>> 1.61312e+006,counterclockwise)) [1.74193e+006 43332 --> 1.7432e+006
>> >>> 44602]
>> >>> (Circle_2(PointC2(1.73489e+006, 44595.5),
>> >>> 6.90773e+007,counterclockwise)) [1.7432e+006 44602 --> 1.73847e+006
>> >>> 52099]
>> >>> (Circle_2(PointC2(1.73792e+006, 50955.1),
>> >>> 1.60508e+006,counterclockwise)) [1.73847e+006 52099 --> 1.73792e+006
>> >>> 52222]
>> >>> (Circle_2(PointC2(1.73792e+006, 50951.9),
>> >>> 1.61312e+006,counterclockwise)) [1.73792e+006 52222 --> 1.73665e+006
>> >>> 50952]
>> >>> (Circle_2(PointC2(1.73792e+006, 50952),
>> >>> 1.61415e+006,counterclockwise)) [1.73665e+006 50952 --> 1.73737e+006
>> >>> 49805]
>> >>> (Circle_2(PointC2(1.73491e+006, 44606.1), 3.31029e+007,
>> >>> clockwise))[1.73737e+006 49805 --> 1.74066e+006 44602]
>> >>> (Circle_2(PointC2(1.74193e+006, 44602.1),
>> >>> 1.61312e+006,counterclockwise)) [1.74066e+006 44602 --> 1.74193e+006
>> >>> 43332]
>> >>> )
>> >>> CGAL error: precondition violation!
>> >>> Expression : cv1.point_position (p) == EQUAL && cv2.point_position (p)
>> >>> ==
>> >>> EQUAL
>> >>> File :
>> >>> c:\cgal\cgal-3.4\include\cgal\arr_circle_segment_traits_2.h
>> >>> Line : 249
>> >>> Explanation:
>> >>> Refer to the bug-reporting instructions at
>> >>> http://www.cgal.org/bug_report.html
>> >>>
>> >>> I did use this way to calc the the curves:
>> >>>
>> >>> Point_2 ps = Point_2(sx,sy); //start
>> >>> Point_2 pm = Point_2(mx,my); //midpoint
>> >>> Point_2 pe = Point_2(ex,ey); //endpoint
>> >>> Curve c =Curve( ps,pm,pe);
>> >>> curve =
>> >>> XCurve(c.supporting_circle(),c.source(),c.target(),c.orientation(),0);
>> >>>
>> >>> TIA
>> >>> Kim
>> >>> --
>> >>> You are currently subscribed to cgal-discuss.
>> >>> To unsubscribe or access the archives, go to
>> >>> https://lists-sop.inria.fr/wws/info/cgal-discuss
>> >>
>> >>
>> >
>> --
>> You are currently subscribed to cgal-discuss.
>> To unsubscribe or access the archives, go to
>> https://lists-sop.inria.fr/wws/info/cgal-discuss
>
>
- [cgal-discuss] Why do I get precondition violation here ?, Kim, 05/11/2009
- [cgal-discuss] [REPOST] Why do I get precondition violation here ?, Kim, 05/13/2009
- Re: [cgal-discuss] [REPOST] Why do I get precondition violation here, Damian Sheehy, 05/14/2009
- Message not available
- Re: [cgal-discuss] [REPOST] Why do I get precondition violation here, Kim, 05/14/2009
- Re: [cgal-discuss] [REPOST] Why do I get precondition violation here, Damian Sheehy, 05/14/2009
- Re: [cgal-discuss] [REPOST] Why do I get precondition violation here, Kim, 05/14/2009
- Re: [cgal-discuss] [REPOST] Why do I get precondition violation here, Damian Sheehy, 05/15/2009
- Re: [cgal-discuss] [REPOST] Why do I get precondition violation here, Kim, 05/15/2009
- Re: [cgal-discuss] [REPOST] Why do I get precondition violation here, Damian Sheehy, 05/15/2009
- Re: [cgal-discuss] [REPOST] Why do I get precondition violation here, Kim, 05/14/2009
- Re: [cgal-discuss] [REPOST] Why do I get precondition violation here, Damian Sheehy, 05/14/2009
- Re: [cgal-discuss] [REPOST] Why do I get precondition violation here, Kim, 05/14/2009
- Message not available
- Re: [cgal-discuss] [REPOST] Why do I get precondition violation here, Damian Sheehy, 05/14/2009
- [cgal-discuss] [REPOST] Why do I get precondition violation here ?, Kim, 05/13/2009
- Re: [cgal-discuss] [REPOST] Why do I get precondition violation here, Bernd Gaertner, 05/14/2009
- Re: [cgal-discuss] [REPOST] Why do I get precondition violation here, Kim, 05/14/2009
Archive powered by MHonArc 2.6.16.