From 7e600dbb12a51cbcf4d26a8fc6b51b1c913daa9a Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Wed, 1 Jun 2016 20:01:58 +0300 Subject: [PATCH] 1st revision --- Casting_2/examples/Casting_2/CMakeLists.txt | 28 ++++++++++++ ...nd_single_mold_translational_casting_2.cpp | 43 +++++++++++++++++++ ...find_single_mold_translational_casting_2.h | 34 +++++++++++++++ 3 files changed, 105 insertions(+) create mode 100644 Casting_2/examples/Casting_2/CMakeLists.txt create mode 100644 Casting_2/examples/Casting_2/find_single_mold_translational_casting_2.cpp create mode 100644 Casting_2/include/CGAL/find_single_mold_translational_casting_2.h diff --git a/Casting_2/examples/Casting_2/CMakeLists.txt b/Casting_2/examples/Casting_2/CMakeLists.txt new file mode 100644 index 00000000000..e6c74082648 --- /dev/null +++ b/Casting_2/examples/Casting_2/CMakeLists.txt @@ -0,0 +1,28 @@ +# Created by the script cgal_create_cmake_script +# This is the CMake script for compiling a CGAL application. + + +project( Casting_2_example ) + +cmake_minimum_required(VERSION 2.8.10) + +find_package(CGAL QUIET COMPONENTS Core ) + +if ( CGAL_FOUND ) + + include( ${CGAL_USE_FILE} ) + + include( CGAL_CreateSingleSourceCGALProgram ) + + include_directories (BEFORE "../../include") + + create_single_source_cgal_program( "find_single_mold_translational_casting_2.cpp" ) + if (CMAKE_COMPILER_IS_GNUCXX) + add_definitions(-std=c++11) + endif() + +else() + + message(STATUS "This program requires the CGAL library, and will not be compiled.") + +endif() diff --git a/Casting_2/examples/Casting_2/find_single_mold_translational_casting_2.cpp b/Casting_2/examples/Casting_2/find_single_mold_translational_casting_2.cpp new file mode 100644 index 00000000000..04ad3e2ee33 --- /dev/null +++ b/Casting_2/examples/Casting_2/find_single_mold_translational_casting_2.cpp @@ -0,0 +1,43 @@ +/*! \file find_single_mold_translational_casting_2.cpp + * . + */ + +#include + +#include +#include +#include + +typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; +typedef CGAL::Polygon_2 Polygon_2; +typedef Kernel::Direction_2 Direction_2; +typedef Kernel::Point_2 Point_2; + +typedef std::pair Direction_range; +typedef std::pair Top_edge; + +// The main program: +int main() +{ + Polygon_2 pgn; + pgn.push_back(Point_2(0, 0)); + pgn.push_back(Point_2(1, 0)); + pgn.push_back(Point_2(1, 1)); + pgn.push_back(Point_2(0, 1)); + + std::list top_edges; + find_single_mold_translational_casting_2(pgn, std::back_inserter(top_edges)); + + if (top_edges.empty()) + std::cout << "The polygon is not castable!" << std::endl; + else { + std::cout << "There are " << top_edges.size() << " top edges:" << std::endl; + for (const auto& top_edge : top_edges) { + std::cout << top_edge.first << ", (" + << top_edge.second.first << "," << top_edge.second.second + << ")" << std::endl; + } + } + + return 0; +} diff --git a/Casting_2/include/CGAL/find_single_mold_translational_casting_2.h b/Casting_2/include/CGAL/find_single_mold_translational_casting_2.h new file mode 100644 index 00000000000..6005a9a1068 --- /dev/null +++ b/Casting_2/include/CGAL/find_single_mold_translational_casting_2.h @@ -0,0 +1,34 @@ +// Copyright (c) 2005,2006,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// You can redistribute it and/or modify it under the terms of the GNU +// General Public License as published by the Free Software Foundation, +// either version 3 of the License, or (at your option) any later version. +// +// 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): Shahar +// Efi Fogel + +#ifndef CGAL_FIND_SINGLE_MOLD_TRANSLATIONAL_CASTING_2_H +#define CGAL_FIND_SINGLE_MOLD_TRANSLATIONAL_CASTING_2_H + +/*! + */ +template +OutputIterator +find_single_mold_translational_casting_2(const Polygon& pgn, OutputIterator oi) +{ + return oi; +} + +#endif