Subject: CGAL users discussion list
List archive
- From: Max Harris <>
- To:
- Subject: Re: [cgal-discuss] Offset Plane
- Date: Thu, 26 May 2011 15:57:10 -0500
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:mime-version:content-type:subject:date:in-reply-to:to :references:message-id:x-mailer; b=D7aWiIdoOfDENmAqAttBnuPLdBk70nhQvA7c0I2B+Psfelg1rLh1LFSf0Y0fQrlZym hU6s7i8sOTtPlhsaXROu26T9EhtC+txT9pTt9FpfqGBo+Rq6Hua5BWrl6qEm833ahGaf AI73a5pB66p6vRxVTD6TGsgsnvX2PxNzBjax8=
polyhedron_cut_plane_3() breaks when I try running the code below. What am I doing wrong? Here's the output: Plane: -0 -1 -0 -0 Normal: -0 -1 -0 Scaled normal: -0 0.1 -0 Transformed plane: -0 -1 -0 0.1 terminate called after throwing an instance of 'CGAL::Precondition_exception' what(): CGAL ERROR: precondition violation! Expr: pred( h->vertex()) File: /usr/local/include/CGAL/polyhedron_cut_plane_3.h Line: 120 Root::Root() { Polyhedron P; make_cube_3(P); Facet_iterator f = P.facets_begin(); Plane pl2 = f->plane(); // plane equation of the facet cout << "Plane: " << pl2 << endl; CGAL::Vector_3<Kernel> normal = pl2.orthogonal_vector(); cout << "\nNormal: " << normal << endl; Vector sn = normal.transform(Transformation(CGAL::SCALING, -0.1)); cout << "\nScaled normal: " << sn << endl; Plane pl3 = pl2.transform(Transformation(CGAL::TRANSLATION, sn)); cout << "\nTransformed plane: " << pl3 << endl; Polyhedron result; Halfedge_handle he = make_cube_3(result); CGAL::polyhedron_cut_plane_3(result, he, pl3); } template <class Poly> typename Poly::Halfedge_handle Root::make_cube_3(Poly& P) { // appends a cube of size [0,1]^3 to the polyhedron P. CGAL_precondition( P.is_valid()); typedef typename Poly::Point_3 Point; typedef typename Poly::Plane_3 Plane; typedef typename Poly::Halfedge_handle Halfedge_handle; Halfedge_handle h = P.make_tetrahedron(Point( 1, 0, 0), Point( 0, 0, 1), Point( 0, 0, 0), Point( 0, 1, 0)); Halfedge_handle g = h->next()->opposite()->next(); P.split_edge( h->next()); P.split_edge( g->next()); P.split_edge( g); h->next()->vertex()->point() = Point( 1, 0, 1); g->next()->vertex()->point() = Point( 0, 1, 1); g->opposite()->vertex()->point() = Point( 1, 1, 0); Halfedge_handle f = P.split_facet( g->next(), g->next()->next()->next()); Halfedge_handle e = P.split_edge( f); e->vertex()->point() = Point( 1, 1, 1); P.split_facet( e, f->next()->next()); CGAL_postcondition( P.is_valid()); g = h; g->facet()->plane() = Plane( g->vertex()->point(), g->next()->vertex()->point(), g->next()->next()->vertex()->point()); g = h->opposite(); g->facet()->plane() = Plane( g->vertex()->point(), g->next()->vertex()->point(), g->next()->next()->vertex()->point()); g = h->next()->opposite(); g->facet()->plane() = Plane( g->vertex()->point(), g->next()->vertex()->point(), g->next()->next()->vertex()->point()); g = h->next()->next()->opposite(); g->facet()->plane() = Plane( g->vertex()->point(), g->next()->vertex()->point(), g->next()->next()->vertex()->point()); g = h->next()->next()->next()->opposite(); g->facet()->plane() = Plane( g->vertex()->point(), g->next()->vertex()->point(), g->next()->next()->vertex()->point()); g = g->next()->next()->opposite(); g->facet()->plane() = Plane( g->vertex()->point(), g->next()->vertex()->point(), g->next()->next()->vertex()->point()); return h; } On May 25, 2011, at 12:47 AM, Marc Glisse wrote:
|
- [cgal-discuss] Offset Plane, harris . max, 05/25/2011
- Re: [cgal-discuss] Offset Plane, Marc Glisse, 05/25/2011
- Re: [cgal-discuss] Offset Plane, Max Harris, 05/26/2011
- Re: [cgal-discuss] Offset Plane, Sebastien Loriot (GeometryFactory), 05/27/2011
- Re: [cgal-discuss] Offset Plane, Max Harris, 05/28/2011
- Re: [cgal-discuss] Offset Plane, Sebastien Loriot (GeometryFactory), 05/30/2011
- Re: [cgal-discuss] Offset Plane, Max Harris, 05/28/2011
- Re: [cgal-discuss] Offset Plane, Sebastien Loriot (GeometryFactory), 05/27/2011
- Re: [cgal-discuss] Offset Plane, Max Harris, 05/26/2011
- Re: [cgal-discuss] Offset Plane, Marc Glisse, 05/25/2011
Archive powered by MHonArc 2.6.16.