Subject: CGAL users discussion list
List archive
- From: Tom Kazimiers <>
- To:
- Subject: Re: [cgal-discuss] how to output a point's coordinate
- Date: Fri, 06 Mar 2009 09:17:18 +0100
Hi zengming,
I have no experience with CGAL and intersection tests, but the manual
for intersection is located here:
http://www.cgal.org/Manual/3.4/doc_html/cgal_manual/Kernel_23_ref/Function_intersection.html#Index_anchor_323
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
- Re: Re: [cgal-discuss] how to output a point's coordinate, (continued)
- Re: Re: [cgal-discuss] how to output a point's coordinate, zengming, 03/06/2009
- Re: Re: [cgal-discuss] how to output a point's coordinate, Pedro Machado Manhães de Castro, 03/06/2009
- Re: Re: Re: [cgal-discuss] how to output a point's coordinate, zengming, 03/06/2009
- Re: Re: Re: [cgal-discuss] how to output a point's coordinate, zengming, 03/06/2009
- Re: Re: Re: [cgal-discuss] how to output a point's coordinate, Pedro Machado Manhães de Castro, 03/06/2009
- Re: Re: Re: [cgal-discuss] how to output a point's coordinate, zengming, 03/06/2009
- Re: Re: Re: [cgal-discuss] how to output a point's coordinate, Pedro Machado Manhães de Castro, 03/06/2009
- [cgal-discuss] How to rotate Segment_2, naresh, 03/06/2009
- [cgal-discuss] Sweep Line Running slow, naresh, 03/07/2009
- Re: [cgal-discuss] Sweep Line Running slow, Ophir Setter, 03/07/2009
- Re: [cgal-discuss] How to rotate Segment_2, Ashwin N, 03/09/2009
- [cgal-discuss] Sweep Line Running slow, naresh, 03/07/2009
- Re: Re: [cgal-discuss] how to output a point's coordinate, Pedro Machado Manhães de Castro, 03/06/2009
- Re: [cgal-discuss] how to output a point's coordinate, Tom Kazimiers, 03/06/2009
- Re: Re: [cgal-discuss] how to output a point's coordinate, zengming, 03/06/2009
- Re: Re: [cgal-discuss] how to output a point's coordinate, zengming, 03/06/2009
Archive powered by MHonArc 2.6.16.