Skip to Content.
Sympa Menu

cgal-discuss - Re: Re: [cgal-discuss] how to output a point's coordinate

Subject: CGAL users discussion list

List archive

Re: Re: [cgal-discuss] how to output a point's coordinate


Chronological Thread 
  • From: "zengming" <>
  • To: "" <>
  • Subject: Re: Re: [cgal-discuss] how to output a point's coordinate
  • Date: Fri, 6 Mar 2009 16:36:59 +0800

Hi, Tom
I have read the material you gave me, it help me a lot, thank you!
 
 
2009-03-06

zengming

发件人: Tom Kazimiers
发送时间: 2009-03-06  16:19:19
收件人:
抄送:
主题: Re: [cgal-discuss] how to output a point's coordinate
Hi zengming,
 
I have no experience with CGAL and intersection tests, but the manual
for intersection is located here:
 
Since intersections can be very different the intersection information
is stored in an CGAL::Object. To deal with this object you have to do an
object_cast <.. > - for example:
 
if (const Point_3 *ipoint = CGAL::object_cast <Point_3 >(&result)) {
// handle the point intersection case with *ipoint.
} else
if (const CGAL::Segment_2 <Spherical_k > *iseg =
CGAL::object_cast <CGAL::Segment_2 <Spherical_k >  >(&result)) {
// handle the segment intersection case with *iseg.
} else {
// handle the no intersection case.
}
 
Actually, I do not know of which type the intersection between spheres
is in CGAL - but again, the manual says to the intersection function you
use, that Object can have the following types:
 
- std::pair <Circular_arc_point_3 <SphericalKernel >, unsigned >, where the
unsigned integer is the multiplicity of the corresponding intersection
point,
- Circle_3 <SphericalKernel > or
- Type1, when Type1, Type2 and Type3 are equal, and if the three objets
obj1 and obj2 and obj3 are equal.
 
so I think you will have to make an if-then-else like above with those
possibilities for every Object in the vector.
 
Regards,
Tom
 
 
zengming schrieb:
> hi, everyone. I am fresh at cgal. how can I print the coordinate of a
> point?
> here is the test programe:
> #include  <CGAL/Exact_spherical_kernel_3.h >
> typedef CGAL::Exact_spherical_kernel_3 Spherical_k;
> typedef CGAL::Point_3 <Spherical_k > Point_3;
> typedef CGAL::Sphere_3 <Spherical_k > Sphere_3;
> int main() {
> Sphere_3 s1 = Sphere_3(Point_3(1.0,0.0,0.0), r);
> Sphere_3 s2 = Sphere_3(Point_3(-1.0,0.0,0.0), r);
> Sphere_3 s3 = Sphere_3(Point_3(0.0,0.0,1.0), r);
> std::vector < CGAL::Object  > intersecs;
> CGAL::intersection(s1, s2, s3, std::back_inserter(intersecs));
> std::cout < <intersecs.size() < <std::endl;
>
> Point_3 pt3;
> assign(pt3, intersecs[0]);
> //how can I output the coordinate of point pt3?
> return 0;
> }
> 2009-03-06
> ------------------------------------------------------------------------
> zengming
 
-- 
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss
 
 



Archive powered by MHonArc 2.6.16.

Top of Page