Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Re: AABB tree Exact_predicates_exact_constructions_kernel

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Re: AABB tree Exact_predicates_exact_constructions_kernel


Chronological Thread 
  • From: "Sebastien Loriot (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] Re: AABB tree Exact_predicates_exact_constructions_kernel
  • Date: Thu, 12 May 2011 09:29:01 +0200
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; b=BwKngkAG/cdYVhWoQVddZSKvYWQ8DuNF3U6dl/maRQiRzl4al/eywa8eJ17uRHg1ZU fOeXrzCvl0LQ2jdkqmnBJjHyR5Q4ijv+3OvCJ3RF2MGShU4HkaygwF//qyZ0OiffQ0bh p5EKTzHYau5faF0atPjflugQZvkUzs/Dvz9zs=

I also observe a quite strange error.
I'll dig into it and let you know.

S.

On 05/11/2011 12:49 AM, schrodingersnewcat wrote:
I took the example "AABB_polyhedron_facet_distance_example.cpp" and changed
the kernel and added some output statements.

#include<iostream>

#include&lt;CGAL/AABB_tree.h&gt; // must be inserted before kernel
#include&lt;CGAL/AABB_traits.h&gt;
#include&lt;CGAL/Polyhedron_3.h&gt;
#include&lt;CGAL/AABB_polyhedron_triangle_primitive.h&gt;

#include&lt;CGAL/Simple_cartesian.h&gt;
#include&lt;CGAL/Exact_predicates_exact_constructions_kernel.h&gt;

//typedef CGAL::Simple_cartesian<double> K;
typedef CGAL::Exact_predicates_exact_constructions_kernel K;
typedef K::FT FT;
typedef K::Point_3 Point;
typedef K::Segment_3 Segment;
typedef CGAL::Polyhedron_3<K> Polyhedron;
typedef CGAL::AABB_polyhedron_triangle_primitive&lt;K,Polyhedron&gt;
Primitive;
typedef CGAL::AABB_traits&lt;K, Primitive&gt; Traits;
typedef CGAL::AABB_tree<Traits> Tree;
typedef Tree::Object_and_primitive_id Object_and_primitive_id;
typedef Tree::Point_and_primitive_id Point_and_primitive_id;

int main()
{
Point p(1.0, 0.0, 0.0);
Point q(0.0, 1.0, 0.0);
Point r(0.0, 0.0, 1.0);
Point s(0.0, 0.0, 0.0);
Polyhedron polyhedron;
polyhedron.make_tetrahedron(p, q, r, s);

// constructs AABB tree and computes internal KD-tree
// data structure to accelerate distance queries
Tree tree(polyhedron.facets_begin(),polyhedron.facets_end());
std::cout<< "tree.accelerate_distance_queries()"<< std::endl;
tree.accelerate_distance_queries();
std::cout<< "KD tree constructed"<< std::endl;

// query point
Point query(0.0, 0.0, 3.0);

// computes squared distance from query
FT sqd = tree.squared_distance(query);
std::cout<< "squared distance: "<< sqd<< std::endl;

// computes closest point
Point closest = tree.closest_point(query);
std::cout<< "closest point: "<< closest<< std::endl;

// computes closest point and primitive id
Point_and_primitive_id pp = tree.closest_point_and_primitive(query);
std::cout<< "closest point: "<< pp.first<< std::endl;
Polyhedron::Face_handle f = pp.second; // closest primitive id
return EXIT_SUCCESS;
}

--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/AABB-tree-Exact-predicates-exact-constructions-kernel-tp3506553p3513225.html
Sent from the cgal-discuss mailing list archive at Nabble.com.





Archive powered by MHonArc 2.6.16.

Top of Page