Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] 3D Mesh Generation Sphere example - changing radius?

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] 3D Mesh Generation Sphere example - changing radius?


Chronological Thread 
  • From: msmith81 <>
  • To:
  • Subject: Re: [cgal-discuss] 3D Mesh Generation Sphere example - changing radius?
  • Date: Mon, 28 Oct 2013 13:57:10 -0700 (PDT)

thanks! It appears that functors are just what I was looking for... but I am
too much of a newb to get them to work I've never used functors before -
can someone with more c++ experience tell me what I am missing? I found
this source
<http://www.stanford.edu/class/cs106l/course-reader/Ch13_Functors.pdf> and
wrote a functor as:

class SphereFunction {
public:
explicit SphereFunction(const FT sr) : squaredRadius(sr) {}
FT operator() (const Point& p)
{ return CGAL::squared_distance(p,
Point(CGAL::ORIGIN))-squaredRadius; }
private:
const FT squaredRadius;
};

I then tried calling this in the code as:

FT radius = 10.0;
SphereFunction sphere_function(radius*radius);
Mesh_domain domain(sphere_function, K::Sphere_3(CGAL::ORIGIN,
(radius*radius*2.0)));

but it doesn't compile because "cannot convert parameter 1 from
'SphereFunction' to 'Function (__cdecl &)' "
I suspect that the problem has a lot to do with these two typedef lines:

typedef FT (Function)(const Point&);
typedef CGAL::Implicit_mesh_domain_3<Function,K> Mesh_domain;

but with my limited c++ knowledge, I just have no idea what to modify or how
to modify it. Can someone please help?



--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/3D-Mesh-Generation-Sphere-example-changing-radius-tp4658300p4658323.html
Sent from the cgal-discuss mailing list archive at Nabble.com.



Archive powered by MHonArc 2.6.18.

Top of Page