diff --git a/.gitattributes b/.gitattributes index 193c3d58568..c935fd180a5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -15,8 +15,10 @@ AABB_tree/doc_tex/AABB_tree_ref/intro.tex -text AABB_tree/doc_tex/AABB_tree_ref/main.tex -text AABB_tree/dont_submit -text AABB_tree/examples/AABB_tree/AABB_polyhedron_facet_example.cpp -text +AABB_tree/examples/AABB_tree/AABB_segment_3_example.cpp -text AABB_tree/examples/AABB_tree/AABB_triangle_3_example.cpp -text AABB_tree/examples/AABB_tree/CMakeLists.txt -text +AABB_tree/examples/AABB_tree/cleanup.bat -text AABB_tree/include/CGAL/AABB_intersections.h -text AABB_tree/include/CGAL/AABB_polyhedron_triangle_primitive.h -text AABB_tree/include/CGAL/AABB_traits.h -text diff --git a/AABB_tree/dont_submit b/AABB_tree/dont_submit index f05b5b4650d..1a5af49d9c4 100644 --- a/AABB_tree/dont_submit +++ b/AABB_tree/dont_submit @@ -1 +1,2 @@ -shark.ppt \ No newline at end of file +shark.ppt +cleanup.bat \ No newline at end of file diff --git a/AABB_tree/examples/AABB_tree/AABB_polyhedron_facet_example.cpp b/AABB_tree/examples/AABB_tree/AABB_polyhedron_facet_example.cpp index 68ea5316f86..1abd990f597 100644 --- a/AABB_tree/examples/AABB_tree/AABB_polyhedron_facet_example.cpp +++ b/AABB_tree/examples/AABB_tree/AABB_polyhedron_facet_example.cpp @@ -36,9 +36,9 @@ typedef K::Ray_3 Ray; typedef K::Point_3 Point; typedef K::Vector_3 Vector; typedef CGAL::Polyhedron_3 Polyhedron; -typedef CGAL::AABB_polyhedron_triangle_primitive Polyhedron_triangle_primitive; -typedef CGAL::AABB_traits AABB_Polyhedron_traits; -typedef CGAL::AABB_tree Polyhedron_tree; +typedef CGAL::AABB_polyhedron_triangle_primitive Primitive; +typedef CGAL::AABB_traits Traits; +typedef CGAL::AABB_tree Polyhedron_tree; int main(void) { diff --git a/AABB_tree/examples/AABB_tree/AABB_segment_3_example.cpp b/AABB_tree/examples/AABB_tree/AABB_segment_3_example.cpp new file mode 100644 index 00000000000..57aad681915 --- /dev/null +++ b/AABB_tree/examples/AABB_tree/AABB_segment_3_example.cpp @@ -0,0 +1,85 @@ +// Copyright (c) 2009 INRIA Sophia-Antipolis (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org); you may redistribute it under +// the terms of the Q Public License version 1.0. +// See the file LICENSE.QPL distributed with CGAL. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL: $ +// $Id: $ +// +// +// Author(s) : Pierre Alliez +// +//****************************************************************************** +// File Description : +// +//****************************************************************************** + +#include +#include +#include +#include +#include + +typedef CGAL::Exact_predicates_inexact_constructions_kernel K; + +typedef K::FT FT; +typedef K::Point_3 Point; +typedef K::Plane_3 Plane; +typedef K::Segment_3 Segment; + +template +class Segment_primitive +{ + // type +public: + typedef K::Segment_3 Object; // object type + typedef Iterator Id; // Id type + + // member data +private: + Id m_it; // iterator + Object m_object; // 3D segment + +public: + Segment_primitive(Id it) + : m_it(it) + { + m_object = *it; // copy segmetn + } +public: + const Object& object() const { return m_object; } + Object& object() { return m_object; } + Id id() { return m_it; } +}; + +typedef std::list::iterator Iterator; +typedef Segment_primitive Primitive; +typedef CGAL::AABB_traits Traits; +typedef CGAL::AABB_tree Polyhedron_tree; + +int main(void) +{ + Point a(1.0, 0.0, 0.0); + Point b(0.0, 1.0, 0.0); + Point c(0.0, 0.0, 1.0); + Point d(0.0, 0.0, 0.0); + + std::list segments; + segments.push_back(Segment(a,b)); + segments.push_back(Segment(a,c)); + segments.push_back(Segment(c,d)); + + Polyhedron_tree tree(segments.begin(),segments.end()); + Plane plane(a,b,d); + std::cout << tree.number_of_intersections(plane) + << " intersections(s) with plane" << std::endl; + return 0; +} \ No newline at end of file diff --git a/AABB_tree/examples/AABB_tree/CMakeLists.txt b/AABB_tree/examples/AABB_tree/CMakeLists.txt index c133a8ea598..40520dd19db 100644 --- a/AABB_tree/examples/AABB_tree/CMakeLists.txt +++ b/AABB_tree/examples/AABB_tree/CMakeLists.txt @@ -1,7 +1,7 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. -project(AABB_example) +project(AABB_examples) CMAKE_MINIMUM_REQUIRED(VERSION 2.4.5) @@ -23,9 +23,11 @@ if ( CGAL_FOUND ) include( CGAL_CreateSingleSourceCGALProgram ) + create_single_source_cgal_program("AABB_segment_3_example.cpp") create_single_source_cgal_program("AABB_triangle_3_example.cpp") create_single_source_cgal_program("AABB_polyhedron_facet_example.cpp") + else() message(STATUS "This program requires the CGAL library, and will not be compiled.") diff --git a/AABB_tree/examples/AABB_tree/cleanup.bat b/AABB_tree/examples/AABB_tree/cleanup.bat new file mode 100644 index 00000000000..554bc516ab6 --- /dev/null +++ b/AABB_tree/examples/AABB_tree/cleanup.bat @@ -0,0 +1 @@ +del *.vcproj* *.user *.cmake ZERO* *.ncb *.sln *.suo CMakeCache.txt /Q \ No newline at end of file diff --git a/AABB_tree/include/CGAL/AABB_intersections.h b/AABB_tree/include/CGAL/AABB_intersections.h index 3b278c329b6..20fd15e2757 100644 --- a/AABB_tree/include/CGAL/AABB_intersections.h +++ b/AABB_tree/include/CGAL/AABB_intersections.h @@ -1,5 +1,6 @@ // PA: this file will move later to the kernel folder +#include #include #include #include diff --git a/AABB_tree/include/CGAL/AABB_traits.h b/AABB_tree/include/CGAL/AABB_traits.h index 2b6b1bb89a4..288bf1cc7d7 100644 --- a/AABB_tree/include/CGAL/AABB_traits.h +++ b/AABB_tree/include/CGAL/AABB_traits.h @@ -271,7 +271,7 @@ template bool AABB_traits::intersection(const Query& q, const P& pr, - Intersection& intersection) const + Intersection& result) const { // TODO: implement a real intersection construction method // do_intersect is needed here because we construct intersection between @@ -286,7 +286,7 @@ AABB_traits::intersection(const Query& q, Object o = pr.object(); CGAL::Object intersection_obj = CGAL::intersection(o, q); - return CGAL::assign(intersection, intersection_obj); + return CGAL::assign(result, intersection_obj); } diff --git a/AABB_tree/test/AABB_tree/CMakeLists.txt b/AABB_tree/test/AABB_tree/CMakeLists.txt index c0722223887..40eb78833b3 100644 --- a/AABB_tree/test/AABB_tree/CMakeLists.txt +++ b/AABB_tree/test/AABB_tree/CMakeLists.txt @@ -2,7 +2,7 @@ # This is the CMake script for compiling a CGAL application. -project(AABB_example) +project(AABB_tests) CMAKE_MINIMUM_REQUIRED(VERSION 2.4.5) @@ -16,7 +16,6 @@ endif() # Find CGAL find_package(CGAL COMPONENTS) -#include( ${CGAL_USE_FILE} ) if ( CGAL_FOUND ) @@ -25,6 +24,7 @@ if ( CGAL_FOUND ) include( CGAL_CreateSingleSourceCGALProgram ) create_single_source_cgal_program("aabb_intersection_test.cpp") + create_single_source_cgal_program("aabb_projection_test.cpp") else()