Skip to Content.
Sympa Menu

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

Subject: CGAL users discussion list

List archive

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


Chronological Thread 
  • From: msmith81 <>
  • To:
  • Subject: [cgal-discuss] 3D Mesh Generation Sphere example - changing radius?
  • Date: Fri, 25 Oct 2013 08:13:50 -0700 (PDT)

Hello,
I am fairly new to c++ and very new to CGAL. I got the example 3D Mesh
Generation code for the implicit sphere to compile, and am playing around
with parameters. My problem seems so simple but I just can't figure it out.
I am very confused on how to actually change the radius of the generated
sphere.

The example code says

// Domain (Warning: Sphere_3 constructor uses squared radius !)
Mesh_domain domain(sphere_function, K::Sphere_3(CGAL::ORIGIN, 2.));

I saw the warning and assumed that 2. was the squared radius value. However,
no matter what number is put in here, the resulting sphere will always have
a radius of 1. I was able to force it by modifying the sphere_function,
given as:

// Function
FT sphere_function (const Point& p)
{ return CGAL::squared_distance(p, Point(CGAL::ORIGIN))-1; }

For example, if I compile the code with

FT sphere_function (const Point& p)
{ return CGAL::squared_distance(p, Point(CGAL::ORIGIN))-100; }
...
Mesh_domain domain(sphere_function, K::Sphere_3(CGAL::ORIGIN, 100.));

I will get a sphere with radius 10, as desired. But I suspect I am not
supposed to modify the sphere_function in this way? One problem is I don't
know how to use a variable for the radius in the sphere_function.



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



Archive powered by MHonArc 2.6.18.

Top of Page