skin surfaces : subdivision is *very* slow, is this normal ?

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

skin surfaces : subdivision is *very* slow, is this normal ?

SCHWARZ
Hello list,

  I am currently testing the skin package provided in CGAL (thanks a
lot Nico). My computations seem far less efficient than those
exhibited in the CGAL manual or in Nico's papers. I guess I did
something wrong. Maybe another magic compilation variable like
-DNDEBUG ?

  I pasted the code a few lines below. It only consists in reading
atom, skin it, get a coarse mesh and refine this mesh twice. The times
for these four steps on a 28 atoms molecule :

create skin  in : 0.16001
mesh   skin0 in : 0.012001
mesh   skin1 in : 11.7727
mesh   skin2 in : 11.7887

Is this normal ?

  My computer is a bit old : laptop 1.6GHz
  under linux debian lenny
  latest cgal installed through dpkg (thanks Sylvain)
  gcc version 4.3.2 (Debian 4.3.2-1)

  Compilation lines :

g++ -Wall -frounding-math -g -O2 -I/usr/include/qt3 -DCGAL_USE_F2C
-DCGAL_USE_F2C  -I /home/schwarz/include -O2 -DNDEBUG   -c -o
test-skins.o test-skins.cpp

g++   -o test-skins test-skins.o  -lCGAL -lCGALcore++ -lCGALQt
-lCGALimageIO -lCGALPDB -lqt-mt -llapack -lGL -lGLU -llapack -lf77blas
-lcblas -latlas -lz -lmpfr -lgmpxx -lgmp -lX11
-lboost_program_options-mt -lm -O2 -lm

----------My code------------
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Polyhedron_incremental_builder_3.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/IO/Geomview_stream.h>
#include <CGAL/IO/Polyhedron_geomview_ostream.h>

//#include "skin_surface_writer.h"

#include <CGAL/Skin_surface_3.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/mesh_skin_surface_3.h>
#include <CGAL/subdivide_skin_surface_mesh_3.h>

#include <CGAL/Timer.h>

#include <list>

#include <iostream>
#include <fstream>

typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Skin_surface_traits_3<K>                      Traits;
typedef CGAL::Skin_surface_3<Traits>                        Skin_surface_3;
typedef Skin_surface_3::FT                                  FT;
typedef Skin_surface_3::Weighted_point                      Weighted_point;

typedef K::Point_3                                          Point;
typedef K::Vector_3                                         Vector;
typedef CGAL::Polyhedron_3<K>                               Polyhedron;
typedef Polyhedron::Halfedge_handle Halfedge_handle;


int main(int argc, char **argv) {
  std::list<Weighted_point> l;
  double                    shrinkfactor = 0.5;
  CGAL::Timer ben_t;

// first command line arg is a "x y z w" formated file
std::ifstream in(argv[1],std::ios::in);
int i=0;
  double x,y,z,w;
  while (in>>x) {++i;
  std::cerr<<"-->"<<x<<std::endl;
        in >> y; in >> z; in >> w;
        l.push_back(Weighted_point(Point(x,y,z),w));
  }
        std::cerr<<"got "<<i<<" atoms"<<std::endl;


  Polyhedron p;

  CGAL::Geomview_stream gv(CGAL::Bbox_3(-100, -100, -100, 100, 100, 100));
  gv.set_bg_color(CGAL::Color(0, 200, 200));
  gv.clear();

  int geomId=0;
double time_coarse = ben_t.time(); ben_t.start();
  Skin_surface_3 skin_surface(l.begin(), l.end(), shrinkfactor);
ben_t.stop();time_coarse = ben_t.time() - time_coarse;

double time_meshcoarse = ben_t.time(); ben_t.start();
        CGAL::mesh_skin_surface_3(skin_surface, p);
ben_t.stop();time_meshcoarse = ben_t.time() - time_coarse;

  std::cout<<"skin mesh..."<<std::endl;
  std::cerr<<" done"<<std::endl;
  gv<<CGAL::Color(100,100,100);
  gv<<p;
  gv<<"(name-object g"<<++geomId<<" skin0)";

std::cout<<"mesh subdivide 1..."<<std::endl;
double time_subdiv1 = ben_t.time(); ben_t.start();
        CGAL::subdivide_skin_surface_mesh_3(skin_surface, p, 1);
ben_t.stop();time_subdiv1 = ben_t.time() - time_coarse;

  gv<<CGAL::Color(100,100,200);
  gv<<p;
  gv<<"(name-object g"<<++geomId<<" skin1)";

double time_subdiv2 = ben_t.time(); ben_t.start();
  CGAL::mesh_skin_surface_3(skin_surface, p);
ben_t.stop();time_subdiv2 = ben_t.time() - time_coarse;

        gv<<CGAL::Color(100,100,200);
        gv<<p;
        gv<<"(name-object g"<<++geomId<<" skin2)";

  std::cout<<std::endl;
  std::cout<<"create skin  in : "<<time_coarse<<std::endl;
  std::cout<<"mesh   skin0 in : "<<time_meshcoarse<<std::endl;
  std::cout<<"mesh   skin1 in : "<<time_subdiv1<<std::endl;
  std::cout<<"mesh   skin2 in : "<<time_subdiv2<<std::endl;
  std::cout<<"press a key to finish"<<std::endl;
  char c;std::cin>>c;
  std::cout<<c<<std::endl;
  return 0;
}


--

                  --Benjamin SCHWARZ
____________________________________________________
IGBMC
Département de Biologie et de Génomique Structurales
Parc d'Innovation, 1 rue Laurent Fries
BP 10142, 67404 ILLKIRCH CEDEX, France

E-mail : [hidden email]
Phone  : 03 88 65 57 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
Reply | Threaded
Open this post in threaded view
|

Re: skin surfaces : subdivision is *very* slow, is

Sylvain Pion
Administrator
Benjamin schwarz wrote:
>   under linux debian lenny
>   latest cgal installed through dpkg (thanks Sylvain)

You should thank Joachim Reichel for the Debian package, not me.

( and I am clueless about the skin surface package as well :-) )

--
Sylvain Pion
INRIA Sophia-Antipolis
Geometrica Project-Team
CGAL, http://cgal.org/

smime.p7s (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: skin surfaces : subdivision is *very* slow, is

SCHWARZ
> You should thank Joachim Reichel for the Debian package, not me.
Oups... thank you for corecting me Sylvain, and thank you to Joachim
for the debian package.

Another question I forgot to ask concerning the skin package : what
subdivision scheme is currently implemented ? According to the mesh it
seems to be "sqrt3", am I correct ? Is it possible to use "Chew" ?

> ( and I am clueless about the skin surface package as well :-) )
>
> --
> 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
Reply | Threaded
Open this post in threaded view
|

Re: skin surfaces : subdivision is *very* slow, is this normal ?

Laurent Rineau (GeometryFactory)
In reply to this post by SCHWARZ
On Friday 21 November 2008 10:02:35 Benjamin schwarz wrote:
> g++ -Wall -frounding-math -g -O2 -I/usr/include/qt3 -DCGAL_USE_F2C
> -DCGAL_USE_F2C  -I /home/schwarz/include -O2 -DNDEBUG   -c -o
> test-skins.o test-skins.cpp

Your compilation options seems correct.

-DNDEBUG is important for performances. Try -O3 instead of -O2.

> g++   -o test-skins test-skins.o  -lCGAL -lCGALcore++ -lCGALQt
> -lCGALimageIO -lCGALPDB -lqt-mt -llapack -lGL -lGLU -llapack -lf77blas
> -lcblas -latlas -lz -lmpfr -lgmpxx -lgmp -lX11
> -lboost_program_options-mt -lm -O2 -lm

That one is correct too. -O2 is useless here.

--
Laurent Rineau, PhD
Engineer at GeometryFactory
http://www.geometryfactory.com/
--
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: skin surfaces : subdivision is *very* slow, is this normal ?

SCHWARZ
Well... I can't explain why, but I just changed the order of my
includes... "et voilà" (What is the english for "c'est tombé en
marche" ?), now it runs a lot faster and in accordance with the
expected times.

Still, is it possible to choose the subdivision scheme ?

I don't know if the dependance on includes order is a normal behavior,
if not, here is a hint to solve the problem :

My actual includes
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Skin_surface_3.h>
#include <CGAL/Polyhedron_incremental_builder_3.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/mesh_skin_surface_3.h>
#include <CGAL/subdivide_skin_surface_mesh_3.h>

#include <CGAL/IO/Geomview_stream.h>
#include <CGAL/IO/Polyhedron_geomview_ostream.h>
#include <CGAL/Timer.h>
#include <list>
#include <iostream>
#include <fstream>



my former includes :
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Polyhedron_incremental_builder_3.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/IO/Geomview_stream.h>
#include <CGAL/IO/Polyhedron_geomview_ostream.h>
#include "skin_surface_writer.h"
#include <CGAL/Skin_surface_3.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/mesh_skin_surface_3.h>
#include <CGAL/subdivide_skin_surface_mesh_3.h>
#include <CGAL/Timer.h>
#include <list>
#include <iostream>
#include <fstream>


> -DNDEBUG is important for performances.
I already had a bad experience with that a long time ago ;)

> Try -O3 instead of -O2.
Ok, I'll try that

> That one is correct too. -O2 is useless here.
right.

Thanks Laurent
--
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: skin surfaces : subdivision is *very* slow, is

Sylvain Pion
Administrator
Benjamin schwarz wrote:

> Well... I can't explain why, but I just changed the order of my
> includes... "et voilà" (What is the english for "c'est tombé en
> marche" ?), now it runs a lot faster and in accordance with the
> expected times.
>
> Still, is it possible to choose the subdivision scheme ?
>
> I don't know if the dependance on includes order is a normal behavior,
> if not, here is a hint to solve the problem :
>
> My actual includes
> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
> #include <CGAL/Skin_surface_3.h>
> #include <CGAL/Polyhedron_incremental_builder_3.h>
> #include <CGAL/Polyhedron_3.h>
> #include <CGAL/mesh_skin_surface_3.h>
> #include <CGAL/subdivide_skin_surface_mesh_3.h>
>
> #include <CGAL/IO/Geomview_stream.h>
> #include <CGAL/IO/Polyhedron_geomview_ostream.h>
> #include <CGAL/Timer.h>
> #include <list>
> #include <iostream>
> #include <fstream>
>
>
>
> my former includes :
> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
> #include <CGAL/Polyhedron_incremental_builder_3.h>
> #include <CGAL/Polyhedron_3.h>
> #include <CGAL/IO/Geomview_stream.h>
> #include <CGAL/IO/Polyhedron_geomview_ostream.h>
> #include "skin_surface_writer.h"
> #include <CGAL/Skin_surface_3.h>
> #include <CGAL/Polyhedron_3.h>
> #include <CGAL/mesh_skin_surface_3.h>
> #include <CGAL/subdivide_skin_surface_mesh_3.h>
> #include <CGAL/Timer.h>
> #include <list>
> #include <iostream>
> #include <fstream>
This one is probably for Nico.

>> -DNDEBUG is important for performances.
> I already had a bad experience with that a long time ago ;)

Note that NDEBUG is not supposed to dramatically improve performance.
The difference is supposed to be around 20% maximum, and at the maximum
one order of magnitude.  If you notice more than that, please report it.
CGAL has several categories of assertions, and the costly ones should
not be activated by default (CGAL_CHECK_EXPENSIVE enables those).
So there might be some errors in the categorization.

--
Sylvain Pion
INRIA Sophia-Antipolis
Geometrica Project-Team
CGAL, http://cgal.org/


smime.p7s (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: skin surfaces : subdivision is *very* slow, is this normal ?

Nico Kruithof-2
In reply to this post by SCHWARZ
Hi Benjamin,

The order of the include files shoudn't matter and if it does, I
consider it a bug in my code. In the meantime I switched to industry
and have a deadline on tuesday. After that I'll have a look. At one
point, the algorithm was extremely fast, but also used a lot of
memory. How much memory do you have? In the latest public release
there is a better tradeoff between cpu times and memory consumption.

Bests,
Nico

On Fri, Nov 21, 2008 at 11:16 AM, Benjamin schwarz
<[hidden email]> wrote:

> Well... I can't explain why, but I just changed the order of my
> includes... "et voilà" (What is the english for "c'est tombé en
> marche" ?), now it runs a lot faster and in accordance with the
> expected times.
>
> Still, is it possible to choose the subdivision scheme ?
>
> I don't know if the dependance on includes order is a normal behavior,
> if not, here is a hint to solve the problem :
>
> My actual includes
> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
> #include <CGAL/Skin_surface_3.h>
> #include <CGAL/Polyhedron_incremental_builder_3.h>
> #include <CGAL/Polyhedron_3.h>
> #include <CGAL/mesh_skin_surface_3.h>
> #include <CGAL/subdivide_skin_surface_mesh_3.h>
>
> #include <CGAL/IO/Geomview_stream.h>
> #include <CGAL/IO/Polyhedron_geomview_ostream.h>
> #include <CGAL/Timer.h>
> #include <list>
> #include <iostream>
> #include <fstream>
>
>
>
> my former includes :
> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
> #include <CGAL/Polyhedron_incremental_builder_3.h>
> #include <CGAL/Polyhedron_3.h>
> #include <CGAL/IO/Geomview_stream.h>
> #include <CGAL/IO/Polyhedron_geomview_ostream.h>
> #include "skin_surface_writer.h"
> #include <CGAL/Skin_surface_3.h>
> #include <CGAL/Polyhedron_3.h>
> #include <CGAL/mesh_skin_surface_3.h>
> #include <CGAL/subdivide_skin_surface_mesh_3.h>
> #include <CGAL/Timer.h>
> #include <list>
> #include <iostream>
> #include <fstream>
>
>
>> -DNDEBUG is important for performances.
> I already had a bad experience with that a long time ago ;)
>
>> Try -O3 instead of -O2.
> Ok, I'll try that
>
>> That one is correct too. -O2 is useless here.
> right.
>
> Thanks Laurent
> --
> 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: skin surfaces : subdivision is *very* slow, is

Nico Kruithof-2
In reply to this post by Sylvain Pion
Hi Sylvain,

I didn't know about the assertion categorization. I'll check the
assertions and move some of them to the expensive set.

Nico

On Fri, Nov 21, 2008 at 11:25 AM, Sylvain Pion
<[hidden email]> wrote:

> Benjamin schwarz wrote:
>>
>> Well... I can't explain why, but I just changed the order of my
>> includes... "et voilà" (What is the english for "c'est tombé en
>> marche" ?), now it runs a lot faster and in accordance with the
>> expected times.
>>
>> Still, is it possible to choose the subdivision scheme ?
>>
>> I don't know if the dependance on includes order is a normal behavior,
>> if not, here is a hint to solve the problem :
>>
>> My actual includes
>> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
>> #include <CGAL/Skin_surface_3.h>
>> #include <CGAL/Polyhedron_incremental_builder_3.h>
>> #include <CGAL/Polyhedron_3.h>
>> #include <CGAL/mesh_skin_surface_3.h>
>> #include <CGAL/subdivide_skin_surface_mesh_3.h>
>>
>> #include <CGAL/IO/Geomview_stream.h>
>> #include <CGAL/IO/Polyhedron_geomview_ostream.h>
>> #include <CGAL/Timer.h>
>> #include <list>
>> #include <iostream>
>> #include <fstream>
>>
>>
>>
>> my former includes :
>> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
>> #include <CGAL/Polyhedron_incremental_builder_3.h>
>> #include <CGAL/Polyhedron_3.h>
>> #include <CGAL/IO/Geomview_stream.h>
>> #include <CGAL/IO/Polyhedron_geomview_ostream.h>
>> #include "skin_surface_writer.h"
>> #include <CGAL/Skin_surface_3.h>
>> #include <CGAL/Polyhedron_3.h>
>> #include <CGAL/mesh_skin_surface_3.h>
>> #include <CGAL/subdivide_skin_surface_mesh_3.h>
>> #include <CGAL/Timer.h>
>> #include <list>
>> #include <iostream>
>> #include <fstream>
>
> This one is probably for Nico.
>
>>> -DNDEBUG is important for performances.
>>
>> I already had a bad experience with that a long time ago ;)
>
> Note that NDEBUG is not supposed to dramatically improve performance.
> The difference is supposed to be around 20% maximum, and at the maximum
> one order of magnitude.  If you notice more than that, please report it.
> CGAL has several categories of assertions, and the costly ones should
> not be activated by default (CGAL_CHECK_EXPENSIVE enables those).
> So there might be some errors in the categorization.
>
> --
> 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
Reply | Threaded
Open this post in threaded view
|

Re: skin surfaces : subdivision is *very* slow, is

Nico Kruithof-2
In reply to this post by SCHWARZ
The subdivision is either bisecting edges or trisecting edges and then
retriangulating in 4 or 9 triangles. I'll give you a pointer to the
code that does the trick later this week.

Bests,
Nico

On Fri, Nov 21, 2008 at 10:41 AM, Benjamin schwarz
<[hidden email]> wrote:

>> You should thank Joachim Reichel for the Debian package, not me.
> Oups... thank you for corecting me Sylvain, and thank you to Joachim
> for the debian package.
>
> Another question I forgot to ask concerning the skin package : what
> subdivision scheme is currently implemented ? According to the mesh it
> seems to be "sqrt3", am I correct ? Is it possible to use "Chew" ?
>
>> ( and I am clueless about the skin surface package as well :-) )
>>
>> --
>> 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
>
--
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: skin surfaces : subdivision is *very* slow, is this normal ?

SCHWARZ
In reply to this post by Nico Kruithof-2
Hello Nico,

    and thanks for the answer.

> point, the algorithm was extremely fast, but also used a lot of
> memory. How much memory do you have? In the latest public release
> there is a better tradeoff between cpu times and memory consumption.

for a 28 atoms molecule, with the "good" insertion order I have times
in accordance with those you give in the cgal manual : 0.7s for the
third subdivision.

For a 1600 atoms protein, two subdivisions are OK, but the third one
induces my computer to swap and lagg, and ultimately I have to kill
the process. I only have 1Go mem and run greedy softs in the meantime
(Eclipse, firefox). Anyway, two subdivisions are enough for me at the
moment, and since you said the memory management is best in the newer
versions...

> In the meantime I switched to industry and have a deadline on tuesday. After that I'll have a look. At one
Good luck with that.

Let me know if you can't reproduce the problem with the includes order.

    cheers

    --Ben
--
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: skin surfaces : subdivision is *very* slow, is this normal ?

Nico Kruithof-2
You should have the version with the reduced memory usage. Note that
the subdivision takes exponentially more memory. With every additional
subdivision step you have 4 times as many triangles in your mesh.

-- Nico

On Sun, Nov 23, 2008 at 11:39 AM, Benjamin schwarz
<[hidden email]> wrote:

> Hello Nico,
>
>    and thanks for the answer.
>
>> point, the algorithm was extremely fast, but also used a lot of
>> memory. How much memory do you have? In the latest public release
>> there is a better tradeoff between cpu times and memory consumption.
>
> for a 28 atoms molecule, with the "good" insertion order I have times
> in accordance with those you give in the cgal manual : 0.7s for the
> third subdivision.
>
> For a 1600 atoms protein, two subdivisions are OK, but the third one
> induces my computer to swap and lagg, and ultimately I have to kill
> the process. I only have 1Go mem and run greedy softs in the meantime
> (Eclipse, firefox). Anyway, two subdivisions are enough for me at the
> moment, and since you said the memory management is best in the newer
> versions...
>
>> In the meantime I switched to industry and have a deadline on tuesday. After that I'll have a look. At one
> Good luck with that.
>
> Let me know if you can't reproduce the problem with the includes order.
>
>    cheers
>
>    --Ben
> --
> 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: skin surfaces : subdivision is *very* slow, is this normal ?

Nico Kruithof-2
In reply to this post by SCHWARZ
Hi Benjamin,

I tried your include change, but couldn't see the performance
decrease. Could you have a look at my test program? There is an
enhancement of the polyhedron datastructure in which I add
back-pointers to the Skin_surface_3 object to improve performance.
Maybe you saw something going wrong there. To get the pointers you
should use

typedef CGAL::Polyhedron_3<K,
  CGAL::Skin_surface_polyhedral_items_3<Skin_surface_3> >   Polyhedron;

The optimization used is based on the templates.

Bests,
Nico

On Fri, Nov 21, 2008 at 10:02 AM, Benjamin schwarz
<[hidden email]> wrote:

> Hello list,
>
>  I am currently testing the skin package provided in CGAL (thanks a
> lot Nico). My computations seem far less efficient than those
> exhibited in the CGAL manual or in Nico's papers. I guess I did
> something wrong. Maybe another magic compilation variable like
> -DNDEBUG ?
>
>  I pasted the code a few lines below. It only consists in reading
> atom, skin it, get a coarse mesh and refine this mesh twice. The times
> for these four steps on a 28 atoms molecule :
>
> create skin  in : 0.16001
> mesh   skin0 in : 0.012001
> mesh   skin1 in : 11.7727
> mesh   skin2 in : 11.7887
>
> Is this normal ?
>
>  My computer is a bit old : laptop 1.6GHz
>  under linux debian lenny
>  latest cgal installed through dpkg (thanks Sylvain)
>  gcc version 4.3.2 (Debian 4.3.2-1)
>
>  Compilation lines :
>
> g++ -Wall -frounding-math -g -O2 -I/usr/include/qt3 -DCGAL_USE_F2C
> -DCGAL_USE_F2C  -I /home/schwarz/include -O2 -DNDEBUG   -c -o
> test-skins.o test-skins.cpp
>
> g++   -o test-skins test-skins.o  -lCGAL -lCGALcore++ -lCGALQt
> -lCGALimageIO -lCGALPDB -lqt-mt -llapack -lGL -lGLU -llapack -lf77blas
> -lcblas -latlas -lz -lmpfr -lgmpxx -lgmp -lX11
> -lboost_program_options-mt -lm -O2 -lm
>
> ----------My code------------
> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
> #include <CGAL/Polyhedron_incremental_builder_3.h>
> #include <CGAL/Polyhedron_3.h>
> #include <CGAL/IO/Geomview_stream.h>
> #include <CGAL/IO/Polyhedron_geomview_ostream.h>
>
> //#include "skin_surface_writer.h"
>
> #include <CGAL/Skin_surface_3.h>
> #include <CGAL/Polyhedron_3.h>
> #include <CGAL/mesh_skin_surface_3.h>
> #include <CGAL/subdivide_skin_surface_mesh_3.h>
>
> #include <CGAL/Timer.h>
>
> #include <list>
>
> #include <iostream>
> #include <fstream>
>
> typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
> typedef CGAL::Skin_surface_traits_3<K>                      Traits;
> typedef CGAL::Skin_surface_3<Traits>                        Skin_surface_3;
> typedef Skin_surface_3::FT                                  FT;
> typedef Skin_surface_3::Weighted_point                      Weighted_point;
>
> typedef K::Point_3                                          Point;
> typedef K::Vector_3                                         Vector;
> typedef CGAL::Polyhedron_3<K>                               Polyhedron;
> typedef Polyhedron::Halfedge_handle                                                     Halfedge_handle;
>
>
> int main(int argc, char **argv) {
>  std::list<Weighted_point> l;
>  double                    shrinkfactor = 0.5;
>  CGAL::Timer ben_t;
>
> // first command line arg is a "x y z w" formated file
> std::ifstream in(argv[1],std::ios::in);
> int i=0;
>  double x,y,z,w;
>  while (in>>x) {++i;
>  std::cerr<<"-->"<<x<<std::endl;
>        in >> y; in >> z; in >> w;
>        l.push_back(Weighted_point(Point(x,y,z),w));
>  }
>        std::cerr<<"got "<<i<<" atoms"<<std::endl;
>
>
>  Polyhedron p;
>
>  CGAL::Geomview_stream gv(CGAL::Bbox_3(-100, -100, -100, 100, 100, 100));
>  gv.set_bg_color(CGAL::Color(0, 200, 200));
>  gv.clear();
>
>  int geomId=0;
> double time_coarse = ben_t.time(); ben_t.start();
>         Skin_surface_3 skin_surface(l.begin(), l.end(), shrinkfactor);
> ben_t.stop();time_coarse = ben_t.time() - time_coarse;
>
> double time_meshcoarse = ben_t.time(); ben_t.start();
>        CGAL::mesh_skin_surface_3(skin_surface, p);
> ben_t.stop();time_meshcoarse = ben_t.time() - time_coarse;
>
>  std::cout<<"skin mesh..."<<std::endl;
>  std::cerr<<" done"<<std::endl;
>  gv<<CGAL::Color(100,100,100);
>  gv<<p;
>  gv<<"(name-object g"<<++geomId<<" skin0)";
>
> std::cout<<"mesh subdivide 1..."<<std::endl;
> double time_subdiv1 = ben_t.time(); ben_t.start();
>        CGAL::subdivide_skin_surface_mesh_3(skin_surface, p, 1);
> ben_t.stop();time_subdiv1 = ben_t.time() - time_coarse;
>
>  gv<<CGAL::Color(100,100,200);
>  gv<<p;
>  gv<<"(name-object g"<<++geomId<<" skin1)";
>
> double time_subdiv2 = ben_t.time(); ben_t.start();
>        CGAL::mesh_skin_surface_3(skin_surface, p);
> ben_t.stop();time_subdiv2 = ben_t.time() - time_coarse;
>
>        gv<<CGAL::Color(100,100,200);
>        gv<<p;
>        gv<<"(name-object g"<<++geomId<<" skin2)";
>
>  std::cout<<std::endl;
>  std::cout<<"create skin  in : "<<time_coarse<<std::endl;
>  std::cout<<"mesh   skin0 in : "<<time_meshcoarse<<std::endl;
>  std::cout<<"mesh   skin1 in : "<<time_subdiv1<<std::endl;
>  std::cout<<"mesh   skin2 in : "<<time_subdiv2<<std::endl;
>  std::cout<<"press a key to finish"<<std::endl;
>  char c;std::cin>>c;
>  std::cout<<c<<std::endl;
>  return 0;
> }
>
>
> --
>
>                  --Benjamin SCHWARZ
> ____________________________________________________
> IGBMC
> Département de Biologie et de Génomique Structurales
> Parc d'Innovation, 1 rue Laurent Fries
> BP 10142, 67404 ILLKIRCH CEDEX, France
>
> E-mail : [hidden email]
> Phone  : 03 88 65 57 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
>
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss

skin_surface_subdiv.cpp (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: skin surfaces : subdivision is *very* slow, is

Nico Kruithof-2
In reply to this post by Nico Kruithof-2
The subdivision is done in the Skin_surface_sqrt3 class
(subdivide_skin_surface_mesh_3.h). The  policy.to_surface(v) moves the
vertex onto the surface. The rest of the code is manipulation of the
halfedge data structure to the subdivided surface.

Good luck.

Nico

On Sun, Nov 23, 2008 at 11:06 AM, Nico Kruithof <[hidden email]> wrote:

> The subdivision is either bisecting edges or trisecting edges and then
> retriangulating in 4 or 9 triangles. I'll give you a pointer to the
> code that does the trick later this week.
>
> Bests,
> Nico
>
> On Fri, Nov 21, 2008 at 10:41 AM, Benjamin schwarz
> <[hidden email]> wrote:
>>> You should thank Joachim Reichel for the Debian package, not me.
>> Oups... thank you for corecting me Sylvain, and thank you to Joachim
>> for the debian package.
>>
>> Another question I forgot to ask concerning the skin package : what
>> subdivision scheme is currently implemented ? According to the mesh it
>> seems to be "sqrt3", am I correct ? Is it possible to use "Chew" ?
>>
>>> ( and I am clueless about the skin surface package as well :-) )
>>>
>>> --
>>> 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
>>
>
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss