Subject: CGAL users discussion list
List archive
- From: "Mastoureshgh, Sahel" <>
- To: "" <>
- Subject: RE: [cgal-discuss] polyhedron problem
- Date: Wed, 14 Apr 2010 12:29:26 -0400
- Accept-language: en-US
- Acceptlanguage: en-US
Hi
How can I create a suface with 1000 vertex then send to this progam.Can
someone write a complete program to send a surface to this program
Thansk
#include <iostream>
#include <fstream>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/IO/Polyhedron_iostream.h>
// Adaptor for Polyhedron_3
#include <CGAL/Surface_mesh_simplification/HalfedgeGraph_Polyhedron_3.h>
// Simplification function
#include <CGAL/Surface_mesh_simplification/edge_collapse.h>
// Stop-condition policy
#include
<CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h>
typedef CGAL::Simple_cartesian<double> Kernel;
typedef CGAL::Polyhedron_3<Kernel> Surface;
namespace SMS = CGAL::Surface_mesh_simplification ;
int main( int argc, char** argv )
{
Surface surface;
std::ifstream is(argv[1]) ; is >> surface ;
// This is a stop predicate (defines when the algorithm terminates).
// In this example, the simplification stops when the number of undirected
edges
// left in the surface drops below the specified number (1000)
SMS::Count_stop_predicate<Surface> stop(1000);
// This the actual call to the simplification algorithm.
// The surface and stop conditions are mandatory arguments.
// The index maps are needed because the vertices and edges
// of this surface lack an "id()" field.
int r = SMS::edge_collapse
(surface
,stop
,CGAL::vertex_index_map(boost::get(CGAL::vertex_external_index,surface))
.edge_index_map (boost::get(CGAL::edge_external_index
,surface))
);
std::cout << "\nFinished...\n" << r << " edges removed.\n"
<< (surface.size_of_halfedges()/2) << " final edges.\n" ;
std::ofstream os( argc > 2 ? argv[2] : "out.off" ) ; os << surface ;
return 0 ;
}
________________________________________
From: Sebastien Loriot (GeometryFactory)
[]
Sent: Wednesday, April 14, 2010 8:14 AM
To:
Subject: Re: [cgal-discuss] polyhedron problem
zhoufang8811 wrote:
> I find that Polyhedron_3<Traits> does not consider ther coordinates of
> the points, so I insert two triangles like this:
>
> Point_3 p( 0.0, 0.0, 0.0);
> Point_3 q( 1.0, 0.0, 0.0);
> Point_3 r( 1.0, 1.0, 0.0);
> Point_3 s( 0.0, 1.0, 0.0);
>
> s _ _ _ _ r
> |\ \ |
> | \ \ |
> | \ \ |
> | \ \ |
> |_ _ _ \ \ |
> p q
>
> Polyhedron P;
> P.make_triangle(p, q, s);
> P.make_triangle(s,q ,r);
The polyhedron is a combinatoric data structure. The fact that the
embedded triangles share an edge (q,s), does not imply that in the
polyhedron the triangle share an edge.
You may need to use the Polyhedron_incremental_builder_3 documented here:
http://www.cgal.org/Manual/last/doc_html/cgal_manual/Polyhedron_ref/Class_Polyhedron_incremental_builder_3.html#Cross_link_anchor_1095
At the bottom of this page, you will find an example. Modifying this
example like this will make what you want:
B.add_vertex(p);
B.add_vertex(q);
B.add_vertex(r);
B.add_vertex(s);
B.begin_facet();// triangle pqs
B.add_vertex_to_facet( 0);
B.add_vertex_to_facet( 1);
B.add_vertex_to_facet( 3);
B.end_facet();
B.begin_facet();//triangle qrs
B.add_vertex_to_facet( 1);
B.add_vertex_to_facet( 2);
B.add_vertex_to_facet( 3);
B.end_facet();
>
> but the triangle 'pqs' and 'sqr' do not connect correctly, it has four
> halfedges along the segment 'sq'.
>
> I want to merge the different edges 'sq' in the two triangles, so the
> rectangle 'spqr' will be colsed. Is there any way?
>
> 2010-04-14
> ------------------------------------------------------------------------
> zhoufang8811
--
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] polyhedron problem, zhoufang8811, 04/14/2010
- Re: [cgal-discuss] polyhedron problem, Sebastien Loriot (GeometryFactory), 04/14/2010
- RE: [cgal-discuss] polyhedron problem, Mastoureshgh, Sahel, 04/14/2010
- Re: [cgal-discuss] polyhedron problem, Sebastien Loriot (GeometryFactory), 04/14/2010
Archive powered by MHonArc 2.6.16.