Minkowski'sum : offsetting a polygon

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Minkowski'sum : offsetting a polygon

amit tripathi-2

 

 

Hi list.....

 

                  i am learning/using CGAL ........by examples given in library...........i have following questions ...........

 

1) how to find output of Minkowski sum of a cicle of given radius and a simple polygon.............in examples ...offsetting polygon......it is not given that how to get print of offset...................i dont know how this object is stored.....

 

 

 

2) Boolean operations supported by CGAL are regular so

 

 when I was designing test cases for polygon intersection code …………I found that code has some problem in the  execution for the cases…

1)       P int Q ={(x,y)}

2)       P int Q ={(x,y)  : y=mx+c}

3)       P int Q = null

 

 

But when I put check for the case P int Q =null …..then for the three cases I got corresponding outputs as follows……

1)       Floating point exception

2)       Do not intersect

3)       Do not intersect

 

Which is not consistent….to situation ………

 

Is there any way to get ordinary intersection that can resolve above problems...............the problem may be solved if we know how polygons are stored then check for same vertices in both the polygons.......

 

Even if i am trying to find the Minkowski sum of P and Q

(as described in Minkowski_sum_2) .............i faced problem for the above three cases..........................

 

 

plz try to help me ............my assignment submission date is near....

 

thanks for all........

 

 


AMIT TRIPATHI
09836562804
M.Tech(C.S.)
I.S.I. KOLKATA


Reply | Threaded
Open this post in threaded view
|

Re: Minkowski'sum : offsetting a polygon

efif
I have to admit that a more extensive example would help here, and we  
do consider enhancing the existing one for the next release. In the  
mean time, the offset polygon is an object of type  
Traits::General_polygon_with_holes_2, which models the concept  
GeneralPolygonWithHoles_2  
<http://www.cgal.org/Manual/3.3/doc_html/cgal_manual/Boolean_set_operations_2_ref/Concept_GeneralPolygonWithHoles_2.html#Cross_link_anchor_726>. Consult the manual for the relevant valid expressions involving a model of this concept. In short you can obtain the outer boundary of type Traits::Polygon_2, and traverse the holes to obtain objects of the same type. You can obtain the curves that comprise the boundaries of these objects using the traits function-object  
Traits::Construct_curves_2.

The regularized intersection of 2 polygons that share a vertex or an  
edge is empty. In other words they do not intersect. However you are  
not suppose to get a floating point exception under any circumstances  
(assuming you use exact arithmetic, etc). If you do, it might be a  
bug, and we would like to get a short test case that reproduces it.

Quoting "amit tripathi" <[hidden email]>:

> &nbsp;
> &nbsp;
> Hi list.....
> &nbsp;
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i am learning/using CGAL ........by examples given in library...........i have following  
> questions&nbsp;...........
> &nbsp;
> 1) how to find output of Minkowski sum of a cicle of given radius  
> and a simple polygon.............in examples ...offsetting  
> polygon......it is not given that how to get print of  
> offset...................i dont know how this object is stored.....
> &nbsp;
> &nbsp;
> &nbsp;
> 2) Boolean operations supported by CGAL are regular so
> &nbsp;
>
> &nbsp;when I was designing test cases for polygon intersection code  
> …………I found that code has some problem in the &nbsp;execution for  
> the cases…
> 1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; P int Q ={(x,y)}
> 2)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; P int Q ={(x,y)&nbsp; : y=mx+c}
> 3)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; P int Q = null
> &nbsp;
> &nbsp;
> But when I put check for the case P int Q =null …..then for the  
> three cases I got corresponding outputs as follows……
> 1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Floating point exception
> 2)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Do not intersect
> 3)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Do not intersect
> &nbsp;
> Which is not consistent….to situation ………
> &nbsp;
> Is there any way to get ordinary intersection that can resolve above  
> problems...............the problem may be solved if we know how  
> polygons are stored then check for same vertices in both the  
> polygons.......
> &nbsp;
> Even if i am trying to find the Minkowski sum of P and Q
> (as described in Minkowski_sum_2) .............i faced problem for  
> the above three cases..........................
> &nbsp;
> &nbsp;
> plz try to help me ............my assignment submission date is near....
> &nbsp;
> thanks for all........
> &nbsp;
> &nbsp;
>
> AMIT TRIPATHI
> 09836562804
> M.Tech(C.S.)
> I.S.I. KOLKATA
>
>
>       --
> 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
Reply | Threaded
Open this post in threaded view
|

Minkowski'sum : offsetting a polygon

amit tripathi-2
Hi list......

Thanks for response ...............i am sending some attachments ..........and my confusions...

1) While running     sum_by_decomposition (attached in mail )    under examples  Minkowski_sum_2 and p4.dat (attached in mail) as input file for polygons..................i got floating point exception as follows :

[root@localhost Minkowski_sum_2]# ./sum_by_decomposition p4.dat

Floating point exception


the same happens on running         sum_with_holes


[root@localhost Minkowski_sum_2]# ./sum_with_holes p4.dat

Floating point exception

[root@localhost Minkowski_sum_2]#









2)  I am attaching  the  file  approx_offset.cpp  ..................in order to print general polygon which would represent the Minkowski sum of a circle of given radius ,under given error bound,with a given polygon...........

when i try for it in example Minkowski_sum_2  under my attahed files  approx_offset.cpp  and print_utils.h ...............i got following output.........

[root@localhost Minkowski_sum_2]# ./approx_offset

 USAGE:executablename inputfilename radius errorbound
[root@localhost Minkowski_sum_2]# ./approx_offset spiked.dat 5  0.00001
CGAL error: precondition violation!
Expr: CGAL::sign (eps) == POSITIVE
File: /usr/include/CGAL/Minkowski_sum_2/Approx_offset_base_2.h
Line: 83
Explanation:
terminate called after throwing an instance of 'CGAL::Precondition_exception'
  what():  CGAL ERROR: precondition violation!
Expr: CGAL::sign (eps) == POSITIVE
File: /usr/include/CGAL/Minkowski_sum_2/Approx_offset_base_2.h
Line: 83
Aborted
[root@localhost Minkowski_sum_2]#




plz make some light to get print of general polygon which would represent the Minkowski sum of a circle of given radius ,under given error bound,with a given polygon...........

Thanks alot.........







AMIT TRIPATHI
09836562804
M.Tech(C.S.)
I.S.I. KOLKATA

--- On Tue, 6/17/08, [hidden email] <[hidden email]> wrote:
From: [hidden email] <[hidden email]>
Subject: Re: [cgal-discuss] Minkowski'sum : offsetting a polygon
To: [hidden email]
Date: Tuesday, June 17, 2008, 3:51 PM

I have to admit that a more extensive example would help here, and we  
do consider enhancing the existing one for the next release. In the
mean time, the offset polygon is an object of type
Traits::General_polygon_with_holes_2, which models the concept
GeneralPolygonWithHoles_2
<http://www.cgal.org/Manual/3.3/doc_html/cgal_manual/Boolean_set_operations_2_ref/Concept_GeneralPolygonWithHoles_2.html#Cross_link_anchor_726>.
Consult the manual for the relevant valid expressions involving a model of this
concept. In short you can obtain the outer boundary of type Traits::Polygon_2,
and traverse the holes to obtain objects of the same type. You can obtain the
curves that comprise the boundaries of these objects using the traits
function-object
Traits::Construct_curves_2.

The regularized intersection of 2 polygons that share a vertex or an
edge is empty. In other words they do not intersect. However you are
not suppose to get a floating point exception under any circumstances
(assuming you use exact arithmetic, etc). If you do, it might be a
bug, and we would like to get a short test case that reproduces it.

Quoting "amit tripathi" <[hidden email]>:

> &nbsp;
> &nbsp;
> Hi list.....
> &nbsp;
>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
i am learning/using CGAL ........by examples given in library...........i have
following

> questions&nbsp;...........
> &nbsp;
> 1) how to find output of Minkowski sum of a cicle of given radius
> and a simple polygon.............in examples ...offsetting
> polygon......it is not given that how to get print of
> offset...................i dont know how this object is stored.....
> &nbsp;
> &nbsp;
> &nbsp;
> 2) Boolean operations supported by CGAL are regular so
> &nbsp;
>
> &nbsp;when I was designing test cases for polygon intersection code
> …………I found that code has some problem in the &nbsp;execution
for
> the cases…
> 1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; P int Q
={(x,y)}
> 2)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; P int Q
={(x,y)&nbsp; : y=mx+c}
> 3)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; P int Q =
null
> &nbsp;
> &nbsp;
> But when I put check for the case P int Q =null …..then for the
> three cases I got corresponding outputs as follows……
> 1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Floating
point exception
> 2)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Do not
intersect
> 3)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Do not
intersect

> &nbsp;
> Which is not consistent….to situation ………
> &nbsp;
> Is there any way to get ordinary intersection that can resolve above
> problems...............the problem may be solved if we know how
> polygons are stored then check for same vertices in both the
> polygons.......
> &nbsp;
> Even if i am trying to find the Minkowski sum of P and Q
> (as described in Minkowski_sum_2) .............i faced problem for
> the above three cases..........................
> &nbsp;
> &nbsp;
> plz try to help me ............my assignment submission date is near....
> &nbsp;
> thanks for all........
> &nbsp;
> &nbsp;
>
> AMIT TRIPATHI
> 09836562804
> M.Tech(C.S.)
> I.S.I. KOLKATA
>
>
> --
> 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


p4.dat (76 bytes) Download Attachment
print_utils.h (2K) Download Attachment
sum_by_decomposition.cpp (2K) Download Attachment
approx_offset.cpp (2K) Download Attachment
spiked.dat (998 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Regular operations : intersection of two simple polygons

amit tripathi-2
In reply to this post by efif
hi list.............
                                                         Thanks for response....................i am attaching the test input file
p4.dat and source file simple_join_intersect.cpp     ...................when i  run it under example  Boolean_set_operations_2 .......................i  got following output...............floating point exception.........(this is the test case when two polygons are touching......)...............

 USAGE:executable inputfile
[root@localhost command_lineBoolean_set_operations_2]# ./simple_join_intersect p4.dat
Floating point exception
[root@localhost command_lineBoolean_set_operations_2]#



thanks alot.................








 

AMIT TRIPATHI
09836562804
M.Tech(C.S.)
I.S.I. KOLKATA

--- On Tue, 6/17/08, [hidden email] <[hidden email]> wrote:
From: [hidden email] <[hidden email]>
Subject: Re: [cgal-discuss] Minkowski'sum : offsetting a polygon
To: [hidden email]
Date: Tuesday, June 17, 2008, 3:51 PM

I have to admit that a more extensive example would help here, and we  
do consider enhancing the existing one for the next release. In the
mean time, the offset polygon is an object of type
Traits::General_polygon_with_holes_2, which models the concept
GeneralPolygonWithHoles_2
<http://www.cgal.org/Manual/3.3/doc_html/cgal_manual/Boolean_set_operations_2_ref/Concept_GeneralPolygonWithHoles_2.html#Cross_link_anchor_726>.
Consult the manual for the relevant valid expressions involving a model of this
concept. In short you can obtain the outer boundary of type Traits::Polygon_2,
and traverse the holes to obtain objects of the same type. You can obtain the
curves that comprise the boundaries of these objects using the traits
function-object
Traits::Construct_curves_2.

The regularized intersection of 2 polygons that share a vertex or an
edge is empty. In other words they do not intersect. However you are
not suppose to get a floating point exception under any circumstances
(assuming you use exact arithmetic, etc). If you do, it might be a
bug, and we would like to get a short test case that reproduces it.

Quoting "amit tripathi" <[hidden email]>:

> &nbsp;
> &nbsp;
> Hi list.....
> &nbsp;
>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
i am learning/using CGAL ........by examples given in library...........i have
following

> questions&nbsp;...........
> &nbsp;
> 1) how to find output of Minkowski sum of a cicle of given radius
> and a simple polygon.............in examples ...offsetting
> polygon......it is not given that how to get print of
> offset...................i dont know how this object is stored.....
> &nbsp;
> &nbsp;
> &nbsp;
> 2) Boolean operations supported by CGAL are regular so
> &nbsp;
>
> &nbsp;when I was designing test cases for polygon intersection code
> …………I found that code has some problem in the &nbsp;execution
for
> the cases…
> 1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; P int Q
={(x,y)}
> 2)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; P int Q
={(x,y)&nbsp; : y=mx+c}
> 3)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; P int Q =
null
> &nbsp;
> &nbsp;
> But when I put check for the case P int Q =null …..then for the
> three cases I got corresponding outputs as follows……
> 1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Floating
point exception
> 2)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Do not
intersect
> 3)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Do not
intersect

> &nbsp;
> Which is not consistent….to situation ………
> &nbsp;
> Is there any way to get ordinary intersection that can resolve above
> problems...............the problem may be solved if we know how
> polygons are stored then check for same vertices in both the
> polygons.......
> &nbsp;
> Even if i am trying to find the Minkowski sum of P and Q
> (as described in Minkowski_sum_2) .............i faced problem for
> the above three cases..........................
> &nbsp;
> &nbsp;
> plz try to help me ............my assignment submission date is near....
> &nbsp;
> thanks for all........
> &nbsp;
> &nbsp;
>
> AMIT TRIPATHI
> 09836562804
> M.Tech(C.S.)
> I.S.I. KOLKATA
>
>
> --
> 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


p4.dat (76 bytes) Download Attachment
simple_join_intersect.cpp (3K) Download Attachment
print_utils.h (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Regular operations : intersection of two simple

Sylvain Pion
Administrator
amit tripathi a écrit :

> hi list.............
>                                                          Thanks for
> response....................i am attaching the test input file
> p4.dat and source file simple_join_intersect.cpp    
> ...................when i  run it under example  
> Boolean_set_operations_2 .......................i  got following
> output...............floating point exception.........(this is the test
> case when two polygons are touching......)...............
>
>  USAGE:executable inputfile
> [root@localhost command_lineBoolean_set_operations_2]#
> ./simple_join_intersect p4.dat
> Floating point exception
> [root@localhost command_lineBoolean_set_operations_2]#
>
>
>
> thanks alot.................

Could you please fix the "." key of your keyboard?
This makes your messages unreadable.........

--
Sylvain Pion
INRIA Sophia-Antipolis
Geometrica Project-Team
CGAL, http://cgal.org/
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss