Subject: CGAL users discussion list
List archive
- From: Pedro Machado Manhães de Castro <>
- To:
- Subject: Re: [cgal-discuss] CGAL 3D Objects Intersections
- Date: Thu, 3 Sep 2009 12:36:35 +0200
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=lSJE8h+oe0rTm3SOjiNfQXjcd3Kg1aovBpJq88R6mm+dm18Uv8For/Qu7mY14TmERy xuilEQDd8BIqZSswrMGintInzumG1CyDrGqvLMifMfCrzrsLPVDK+heahx/qlYAkOWyl Z+CVMCNI5q+FIZaKMecyzG5o6gcwhUyZyw0/I=
Hello,
Be aware that what you pass as argument here:
SK::Sphere_3 s10( sphereCenter10, <<<<< CGAL::MP_Float(r1) >>>>> );
is the squared radius, not the radius.
If you replace r1 = 10.0 by r1 = 100.0 (or even r1 = 25.0), it works fine for me.
Best regards,
Pedro Machado
On Wed, Sep 2, 2009 at 2:15 PM, george13 <> wrote:
Hello,
I made a simple testing program in order to check the intersection of two
spheres. I used a sphere with center in ( 0.5, 0.0, 0.0 ) and another sphere
with center in ( -0.5, 0.0, 0.0 ) and both radius 1.0. Then I tested if they
are intersected using the predicate CGAL::do_intersect() and it worked.
Next, I consider a second peer of two spheres first with center in ( 5.0,
0.0, 0.0 ) and the second with center in ( -5.0, 0.0, 0.0 ) and both radius
10.0 and test again if they are intersected using the same predicate
do_intersect() but in this case it doesn't work. Choosing in this way this
values i made a upscale of 10 times and it doesn't work. I mentioned that
the code was compiled with VS 2008 under Windows XP SP3.
Could you help me with this problem?
My source code follows:
=============================================================
#include "stdafx.h"
#include <CGAL/Cartesian.h>
#include <CGAL/Algebraic_kernel_for_spheres_2_3.h>
#include <CGAL/Spherical_kernel_3.h>
#include <CGAL/MP_Float.h>
#include <CGAL/Quotient.h>
typedef CGAL::Quotient< CGAL::MP_Float> NT;
typedef CGAL::Cartesian<NT> Linear_k;
typedef CGAL::Algebraic_kernel_for_spheres_2_3<NT> Algebraic_k;
typedef CGAL::Spherical_kernel_3<Linear_k,Algebraic_k> SK;
int main()
{
double r0 = 1.0;
SK::Point_3 sphereCenter00( 0.5, 0.0, 0.0 );
SK::Point_3 sphereCenter01( -0.5, 0.0, 0.0 );
SK::Sphere_3 s00( sphereCenter00, CGAL::MP_Float(r0) );
SK::Sphere_3 s01( sphereCenter01, CGAL::MP_Float(r0) );
if( CGAL::do_intersect( s00, s01 ) ){
std::cout<<"\n s00, s01 intersect \n";
}else{
std::cout<<"\n s00, s01 NOT intersect \n";
}
double r1 = 10.0;
SK::Point_3 sphereCenter10( 5.0, 0.0, 0.0 );
SK::Point_3 sphereCenter11( -5.0, 0.0, 0.0 );
SK::Sphere_3 s10( sphereCenter10, CGAL::MP_Float(r1) );
SK::Sphere_3 s11( sphereCenter11, CGAL::MP_Float(r1) );
if( CGAL::do_intersect( s10, s11 ) ){
std::cout<<"\n s10, s11 intersect \n";
}else{
std::cout<<"\n s10, s11 NOT intersect \n";
}
return 0;
}
--
View this message in context: http://www.nabble.com/CGAL-3D-Objects-Intersections-tp25256322p25256322.html
Sent from the cgal-discuss mailing list archive at Nabble.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
- [cgal-discuss] CGAL 3D Objects Intersections, george13, 09/02/2009
- Re: [cgal-discuss] CGAL 3D Objects Intersections, Pedro Machado Manhães de Castro, 09/03/2009
- Re: [cgal-discuss] CGAL 3D Objects Intersections, george13, 09/03/2009
- Re: [cgal-discuss] CGAL 3D Objects Intersections, Pedro Machado Manhães de Castro, 09/03/2009
Archive powered by MHonArc 2.6.16.