Subject: CGAL users discussion list
List archive
- From: VSav <>
- To:
- Subject: Re: [cgal-discuss] crop infinite edges of additive weighted voronoi diagram.
- Date: Tue, 19 Jan 2021 10:47:51 -0600 (CST)
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=SoftFail ; spf=Pass
- Ironport-phdr: 9a23:u/wf9B1FIc5vasXRsmDT+DRfVm0co7zxezQtwd8ZseIVKvad9pjvdHbS+e9qxAeQG9mCurQd06GJ7+igATVGvc/e9ihaMdRlbFwssY0uhQsuAcqIWwXQDcXBSGgEJvlET0Jv5HqhMEJYS47UblzWpWCuv3ZJQk2sfQV6Kf7oFYHMks+5y/69+4HJYwVPmTGxfa5+IA+5oAnMssQam5ZuJro+xhbLrXZDZuBayX91KV6JkBvw+8W98IR//yhMvv4q6tJNX7j9c6kkV7JTES4oM3oy5M3ltBnDSRWA634BWWgIkRRGHhbI4gjiUpj+riX1uOx92DKHPcLtVrA7RS6i76ZwRxD2jioMKiM0/3vWisx0i6JbvQ6hqhliyIPafI2ZKPxzdb7bcNgHR2ROQ9xRWjRPDI28cYUBDOgOPehFoYbyu1QAogCzBRWuCe/z1jNEmmP60bM83u88EQ/GxgsgH9cWvXvbsdv6LrkSWv2ywanT1zrDcfdW1i3j6IjJaBAhvfCMUKl/ccrU00YvFgfFgk+MpoziOjOYz+IAuHWU4OR8T+ygkXInqx1vrTi1wMchkpTFi54VxF3A+yh13Jo5KNm3RUN/YtOpH4ZcuS6UOYZyXM8uX3xktSU5x7MGvZO2YTQGxYg5yxPQa/GKboeG7g7lWe2MLzl4g3dld6i+hxa06UWgzPfzWdKv31ZOsCVJiMXDtncI1xHV98OJSeN981+81TuL0w3f8O9JLEMumafYKpMt2L89m5sVvE/eBCH5gl/2g7WTdkg8+uin9eDnYrL+q5+aOIJ4kAf+Pb41lcOkBeQ3LBICUHSc+eS5zLHj/Ev5T6tWjvAuj6XUtJTXKd4Vq6O6GQNY0Ycu5wy+AjqnyNgYmGMILFNBeBKJlYjpPFTOLejjDfilnVSslC1kx+7HPr37HpXNL2POkLjkfbln6k5czBA/wsxY55JREr0BOu78WlfttNzECR80KxC7w+n9B9V5z48RRGOPArSFP6PPql+I/fkiI/KMZY8QoDbyMeIp5//ojX8jmF8SZ7Ol3ZUNaCPwIvMzKEqQZT/gg8wKDHwRlgs4Vu3jzlOYAhBJYHPnYZk1+HlvE4u4CY7dR5qxgZSO2S66GttdYWUQWQPEKmvha4jRA6REUymVOMI0ymVYB4jkcJco0FSVjCG/06Bud7OG9SgRtJal399wtbWKxEMCsAdsBsHY6FmjCmR9n2cGXTgzhfktrkl0y1PF2q990acBSI5joshRWwJ/Dqbyiux3D9erB1DHIpGPQVysRtjgCjY0HIs8
Hi
Thanks a ton for the above sugestion. I tried using the ipelets function.
My code is as follows.
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel_Exact;
typedef CGAL::Apollonius_graph_traits_2<Kernel_Exact>
AGT2_K;
typedef CGAL::Apollonius_graph_2<AGT2_K> AG2;
typedef CGAL::Apollonius_site_2<Kernel_Exact> Site_2_Apo;
typedef Site_2_Apo::Point_2
Site_2_Point_2;
typedef typename Kernel_Exact::Segment_2
Segment_2;
typedef typename Kernel_Exact::Ray_2
Ray_2;
typedef typename Kernel_Exact::Line_2
Line_2;
typedef typename Kernel_Exact::Iso_rectangle_2
Iso_rectangle_2;
struct Voronoi_from_tri{ //Class using stream to get the voronoi diagram
std::list<Ray_2> ray_list;
std::list<Line_2> line_list;
std::list<Segment_2> seg_list;
void operator<<(const Ray_2& p){ray_list.push_back(p);}
void operator<<(const Line_2& p){line_list.push_back(p);}
void operator<<(const Segment_2& p){seg_list.push_back(p);}
};
template <class T,class output_iterator>
bool
cast_into_seg(const T& obj,const Iso_rectangle_2& bbox,output_iterator
out_it) {
CGAL::Object obj_cgal = CGAL::intersection(obj,bbox);
Segment_2 s;
bool ret=CGAL::assign(s, obj_cgal);
if (ret){
*out_it++=s;
}
return ret;
}
//Convert infinite objects into drawable segments
template<class iterator,class output_iterator>
void
cast_into_seg(const iterator first,const iterator end,
const Iso_rectangle_2& bbox, output_iterator out_it)
{
for (iterator it=first;it!=end;++it)
{
cast_into_seg(*it,bbox,out_it);
}
}
void draw_dual_(Voronoi_from_tri& v_recup,const Iso_rectangle_2& bbox,bool
makegrp)
{
std::vector<Segment_2> seg_cont;
//filter degenerate segments
for(typename std::list<Segment_2>::iterator iteS =
v_recup.seg_list.begin();iteS!=v_recup.seg_list.end();){
typename std::list<Segment_2>::iterator itc=iteS++;
if (itc->is_degenerate())
v_recup.seg_list.erase(itc);
}
cast_into_seg(v_recup.ray_list.begin(),v_recup.ray_list.end(),bbox,std::back_inserter(seg_cont));//cast
rays into segments in bbox
cast_into_seg(v_recup.line_list.begin(),v_recup.line_list.end(),bbox,std::back_inserter(seg_cont));//cast
lines into segments in bbox
cast_into_seg(v_recup.seg_list.begin(),v_recup.seg_list.end(),bbox,std::back_inserter(seg_cont));//cast
lines into segments in bbox
//draw_in_ipe(seg_cont.begin(), seg_cont.end(),makegrp);
}
using namespace std;
int main(){
std::ifstream ifs("sites.cin");
assert( ifs );
AG2 ag;
Site_2_Apo site;
while ( ifs >> site )
{
ag.insert(site);
}
Voronoi_from_tri v_recup;
ag.draw_dual(v_recup);
Iso_rectangle_2 bbox(-2000,-2000,2000,2000);
draw_dual_(v_recup,bbox,true);
return 0;
}
Now I am not able to print the cropped apollonius diagram.
If i am able to print the diagram I will be able to construct the bounding
box around each cell of apollonius diagram.
How can I print the cropped diagram?
Thanks,
Virti
--
Sent from: http://cgal-discuss.949826.n4.nabble.com/
- [cgal-discuss] crop infinite edges of additive weighted voronoi diagram., VSav, 01/14/2021
- Re: [cgal-discuss] crop infinite edges of additive weighted voronoi diagram., Sebastien Loriot, 01/14/2021
- Re: [cgal-discuss] crop infinite edges of additive weighted voronoi diagram., VSav, 01/14/2021
- Re: [cgal-discuss] crop infinite edges of additive weighted voronoi diagram., VSav, 01/16/2021
- Re: [cgal-discuss] crop infinite edges of additive weighted voronoi diagram., Sebastien Loriot, 01/18/2021
- Re: [cgal-discuss] crop infinite edges of additive weighted voronoi diagram., Sebastien Loriot, 01/18/2021
- Re: [cgal-discuss] crop infinite edges of additive weighted voronoi diagram., VSav, 01/19/2021
- Re: [cgal-discuss] crop infinite edges of additive weighted voronoi diagram., VSav, 01/19/2021
- Re: [cgal-discuss] crop infinite edges of additive weighted voronoi diagram., VSav, 01/20/2021
- Re: [cgal-discuss] crop infinite edges of additive weighted voronoi diagram., Sebastien Loriot, 01/20/2021
- Re: [cgal-discuss] crop infinite edges of additive weighted voronoi diagram., VSav, 01/20/2021
- Re: [cgal-discuss] crop infinite edges of additive weighted voronoi diagram., VSav, 01/21/2021
- Re: [cgal-discuss] crop infinite edges of additive weighted voronoi diagram., Sebastien Loriot, 01/21/2021
- Re: [cgal-discuss] crop infinite edges of additive weighted voronoi diagram., VSav, 01/22/2021
- Re: [cgal-discuss] crop infinite edges of additive weighted voronoi diagram., VSav, 01/19/2021
- Re: [cgal-discuss] crop infinite edges of additive weighted voronoi diagram., Sebastien Loriot, 01/18/2021
- Re: [cgal-discuss] crop infinite edges of additive weighted voronoi diagram., Sebastien Loriot, 01/18/2021
- Re: [cgal-discuss] crop infinite edges of additive weighted voronoi diagram., VSav, 01/16/2021
- Re: [cgal-discuss] crop infinite edges of additive weighted voronoi diagram., VSav, 01/14/2021
- Re: [cgal-discuss] crop infinite edges of additive weighted voronoi diagram., Sebastien Loriot, 01/14/2021
Archive powered by MHonArc 2.6.19+.