Subject: CGAL users discussion list
List archive
- From: Oleg <(005b7a4cd6%hidden_head%005b7a4cd6)olegs(005b7a4cd6%hidden_at%005b7a4cd6)mosk.ru(005b7a4cd6%hidden_end%005b7a4cd6)>
- To: (005b7a4cd6%hidden_head%005b7a4cd6)cgal-discuss(005b7a4cd6%hidden_at%005b7a4cd6)lists-sop.inria.fr(005b7a4cd6%hidden_end%005b7a4cd6)
- Subject: [cgal-discuss] Using implicit functions to create complex surfaces
- Date: Tue, 29 May 2012 23:05:13 -0700 (PDT)
Hello everyone! I'm trying to use a combination of implicit functions to
create cone, cylinder, cube, and other surfaces for subsequent
triangulation. I'm taking
http://www.cgal.org/Manual/latest/examples/Surface_mesher/mesh_an_implicit_function.cpp
mesh_an_implicit_function.cpp and
http://www.cgal.org/Manual/latest/examples/Mesh_3/mesh_two_implicit_spheres_with_balls.cpp
mesh_two_implicit_spheres_with_balls.cpp examples as the starting point and
trying to apply them to my case. Having tried a few variants I've come up
with the following code for the cone function:
FT cone_function (Point_3 p) {
const FT x2=p.x()*p.x(), y2=p.y()*p.y(), z2=p.z()*p.z();
const FT z1=p.z();
if( z1<=1 && z1>=0 )
return x2+y2-z2;
else if( z1==1 )
return z2-1;
else
return 1;
}
It does produce a cone surface, automatically cutting off the part of z2-1
plane exceeding the cone. So, I'd suppose that the following code should
also work:
FT cone_function1 (Point_3 p) {
const FT x2=p.x()*p.x(), y2=p.y()*p.y(), z2=p.z()*p.z();
return x2+y2-z2;
}
FT cone_function2 (Point_3 p) {
const FT z2=p.z();
return z2-1;
}
FT cone_function (Point_3 p) {
if(cone_function1(p)==0 || cone_function2(p)==0)
return 0;
else
return 1;
}
but it produces an invalid .off file. What would be the general guidelines
for using implicit functions for creating complex shapes? E.g., what would
be the best way to define a cube surface? Appreciate any help.
--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/Using-implicit-functions-to-create-complex-surfaces-tp4655120.html
Sent from the cgal-discuss mailing list archive at Nabble.com.
- [cgal-discuss] Using implicit functions to create complex surfaces, Oleg, 05/30/2012
Archive powered by MHonArc 2.6.18.