Subject: CGAL users discussion list
List archive
- From: Monique Teillaud <>
- To:
- Subject: Re: [cgal-discuss] Boolean Union of Two Spheres
- Date: Fri, 17 Aug 2012 17:02:13 +0200
Hi,
Combinatorial maps might help storing the "single shape" that you want to construct. They are not restricted to linear objects, you can associate curved objects to darts.
Combinatorial maps don't provide geometric operations, though, so, you would need to build the data structure 'by hand'.
Best,
--
Monique Teillaud
INRIA Sophia Antipolis - Méditerranée
http://www.inria.fr/sophia/members/Monique.Teillaud/
Le 17/08/12 16:24, moogroo a écrit :
Hello,
As an example to better help me learn about CGAL I have created two spheres,
which overlap.
I'm now trying to combine these spheres into a single shape.
I'm getting a little lost reading through the documentation. I understand
that I
need to use a boolean union operation.
The manual suggests that I can only perform this type of boolean operation
on
nef polygons and polyhedra. The short example code I wrote to create the
spheres
is included below. From the documentation, I can't seem to
figure out how to convert what I have into the necessary format.
Advice and anything that points me in the right direction would be greatly
appreciated
as looking through the manual is proving a little bewildering for me at the
moment!
Many Thanks!
#include <iostream>
#include <CGAL/Cartesian.h>
#include <CGAL/Spherical_kernel_3.h>
#include <CGAL/Algebraic_kernel_for_spheres_2_3.h>
#include <CGAL/MP_Float.h>
typedef CGAL::Quotient<CGAL::MP_Float> NT;
typedef CGAL::Cartesian<NT> linear_k;
typedef CGAL::Algebraic_kernel_for_spheres_2_3<linear_k> algebraic_k;
typedef CGAL::Spherical_kernel_3<linear_k, algebraic_k> spherical_k;
typedef CGAL::Sphere_3<linear_k> sphere;
typedef CGAL::Point_3<linear_k> point;
typedef CGAL::Geomview_stream geomview;
int main()
{
double r = 25.0;
CGAL::MP_Float radius_squared(r);
point center_1(3.0, 0.0, 0.0);
point center_2(-5.0, 0.0, 0.0);
sphere s1(center_1, radius_squared);
sphere s2(center_2, radius_squared);
geomview gv;
gv << s1 << s2;
//example to check intersection
if(CGAL::do_intersect(s1, s2)) {
std::cout << "intersection exists!" << std::endl;
} else {
std::cout << "spheres do not intersect!" << std::endl;
}
std::cin.get();
return 0;
}
--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/Boolean-Union-of-Two-Spheres-tp4655727.html
Sent from the cgal-discuss mailing list archive at Nabble.com.
- [cgal-discuss] Boolean Union of Two Spheres, moogroo, 08/17/2012
- Re: [cgal-discuss] Boolean Union of Two Spheres, Monique Teillaud, 08/17/2012
- [cgal-discuss] Re: Boolean Union of Two Spheres, moogroo, 08/18/2012
- Re: [cgal-discuss] Boolean Union of Two Spheres, Monique Teillaud, 08/17/2012
Archive powered by MHonArc 2.6.18.