Simple Question

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

Simple Question

s.nagella
Simple Question

Hi All

How do I generate tetrahedrons/Polyhedron to be used in CSG Nef_Polyhedra for geometry primitives (Sphere,Cone,Cylinder)?

Please help. I havent received any reply for my previous emails. CGAL seems to be too complicated to work on without a good indepth tutorial, is there one?

Thanks

Sri

Reply | Threaded
Open this post in threaded view
|

Re: Simple Question

Bo Schwarzstein-2
Simple Question
Here is a part of my code, generate polyhedron from a wavefront obj file, all the facet are triangles, learned from a example in manual.
 
#include "CCSubd.h"
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Polyhedron_incremental_builder_3.h>
#include <CGAL/Subdivision_method_3.h>
#include <CGAL/Polyhedron_3.h>
#include <fstream>
#include <iostream>
#include <string>
#include <memory.h>
#include <CGAL/IO/Polyhedron_iostream.h>
#include <CGAL/IO/Polyhedron_VRML_1_ostream.h>
 
using namespace std;
 
template<class HDS>
class TriangleBuilder : public CGAL::Modifier_base<HDS>
{
public:
 TriangleBuilder( WavefrontObj* P=NULL) : _Obj(P)
 {
 }
 void operator()(HDS& H)
 {
  CGAL::Polyhedron_incremental_builder_3<HDS> B( H, true);
  if( _Obj->FacetCount == 0 )
  {
   cerr<<"CCSUBD ERROR : FacetCount < 1"<<endl;
   return;
  }
  B.begin_surface(_Obj->VertexCount, _Obj->FacetCount, 6);
  //cout<<"B.begin_surface"<<endl;
  typedef typename HDS::Vertex Vertex;
  typedef typename Vertex::Point Point;
  for( size_t i=0; i<_Obj->VertexCount; i++ )
  {
   size_t j=i*3;
   B.add_vertex( Point(_Obj->VertexPtr[j+0],_Obj->VertexPtr[j+1],_Obj->VertexPtr[j+2]) );
  }
  for( size_t i=0; i<_Obj->FacetCount; i++ )
  {
   B.begin_facet();
   size_t j=i*3;
   B.add_vertex_to_facet( _Obj->IndexPtr[j+0] );
   B.add_vertex_to_facet( _Obj->IndexPtr[j+1] );
   B.add_vertex_to_facet( _Obj->IndexPtr[j+2] );
   B.end_facet();
  }
  B.end_surface();
  //cout<<"B.end_surface"<<endl;
 }
private:
 WavefrontObj* _Obj;
};
 
After declare this class, we can use it like this
 
 typedef CGAL::Simple_cartesian<float> Kernel;
 typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
 typedef Polyhedron::HalfedgeDS HalfedgeDS;
 TriangleBuilder<HalfedgeDS> TB(pObj);
 Polyhedron P;
 P.delegate(TB);
 
if no error happened, the polyhedron is valid.
 

Sent: Wednesday, July 30, 2008 5:22 PM
Subject: [cgal-discuss] Simple Question

Hi All

How do I generate tetrahedrons/Polyhedron to be used in CSG Nef_Polyhedra for geometry primitives (Sphere,Cone,Cylinder)?

Please help. I haven’t received any reply for my previous emails. CGAL seems to be too complicated to work on without a good indepth tutorial, is there one?

Thanks

Sri

Reply | Threaded
Open this post in threaded view
|

Re: Simple Question

Pierre Alliez
In reply to this post by s.nagella
you can generate polyhedra or load .off files, convert them to
Nef_polyhedra, apply the Boolean operations, and convert the Nef back to
the polyhedra.

start printing the doc of Nef_polyhedra.

Nagella, S (Srikanth) a écrit :

> Hi All
>
> How do I generate tetrahedrons/Polyhedron to be used in CSG
> Nef_Polyhedra for geometry primitives (Sphere,Cone,Cylinder)?
>
> Please help. I haven’t received any reply for my previous emails. CGAL
> seems to be too complicated to work on without a good indepth tutorial,
> is there one?
>
> Thanks
>
> Sri
>
--
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
|

RE: Simple Question

s.nagella
Thanks for the help. I need some pointers to where I can generate polyhedra for sphere, cone, cylinder.
Schwarzstein example seems to load triangles and create polyhedra.

Is it possible to use implicit surface class and generate triangles and then convert them to polyhedra??? Am I going tangential

Thanks
Sri
-----Original Message-----
From: Pierre Alliez [mailto:[hidden email]]
Sent: 30 July 2008 11:09
To: [hidden email]
Subject: Re: [cgal-discuss] Simple Question

you can generate polyhedra or load .off files, convert them to
Nef_polyhedra, apply the Boolean operations, and convert the Nef back to
the polyhedra.

start printing the doc of Nef_polyhedra.

Nagella, S (Srikanth) a écrit :

> Hi All
>
> How do I generate tetrahedrons/Polyhedron to be used in CSG
> Nef_Polyhedra for geometry primitives (Sphere,Cone,Cylinder)?
>
> Please help. I haven't received any reply for my previous emails. CGAL
> seems to be too complicated to work on without a good indepth tutorial,
> is there one?
>
> Thanks
>
> Sri
>
--
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
|

Re: Simple Question

Pierre Alliez
Nagella, S (Srikanth) a écrit :
> Thanks for the help. I need some pointers to where I can generate polyhedra for sphere, cone, cylinder.
> Schwarzstein example seems to load triangles and create polyhedra.

you can take a geometric modeling system such as Blender or Maya and
generate such meshes, then export them.


> Is it possible to use implicit surface class and generate triangles and then convert them to polyhedra??? Am I going tangential
there is a mesh generator in CGAL for implicit functions but it is now
limited to smooth surfaces.


>
> Thanks
> Sri
> -----Original Message-----
> From: Pierre Alliez [mailto:[hidden email]]
> Sent: 30 July 2008 11:09
> To: [hidden email]
> Subject: Re: [cgal-discuss] Simple Question
>
> you can generate polyhedra or load .off files, convert them to
> Nef_polyhedra, apply the Boolean operations, and convert the Nef back to
> the polyhedra.
>
> start printing the doc of Nef_polyhedra.
>
> Nagella, S (Srikanth) a écrit :
>> Hi All
>>
>> How do I generate tetrahedrons/Polyhedron to be used in CSG
>> Nef_Polyhedra for geometry primitives (Sphere,Cone,Cylinder)?
>>
>> Please help. I haven't received any reply for my previous emails. CGAL
>> seems to be too complicated to work on without a good indepth tutorial,
>> is there one?
>>
>> Thanks
>>
>> Sri
>>


--
Pierre Alliez
INRIA Sophia Antipolis - Mediterranee
http://www-sop.inria.fr/geometrica/team/Pierre.Alliez/
Tel: +33 4 92 38 76 77
Fax: +33 4 97 15 53 95
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss