1st revision

This commit is contained in:
Efi Fogel 2016-06-01 20:01:58 +03:00
parent 46be5b0470
commit 7e600dbb12
3 changed files with 105 additions and 0 deletions

View File

@ -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()

View File

@ -0,0 +1,43 @@
/*! \file find_single_mold_translational_casting_2.cpp
* .
*/
#include <list>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Polygon_2.h>
#include <CGAL/find_single_mold_translational_casting_2.h>
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
typedef CGAL::Polygon_2<Kernel> Polygon_2;
typedef Kernel::Direction_2 Direction_2;
typedef Kernel::Point_2 Point_2;
typedef std::pair<Direction_2, Direction_2> Direction_range;
typedef std::pair<size_t, Direction_range> 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_edge> 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;
}

View File

@ -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 <shasha94@gmail.com>
// Efi Fogel <efif@gmail.com>
#ifndef CGAL_FIND_SINGLE_MOLD_TRANSLATIONAL_CASTING_2_H
#define CGAL_FIND_SINGLE_MOLD_TRANSLATIONAL_CASTING_2_H
/*!
*/
template <typename Polygon, typename OutputIterator>
OutputIterator
find_single_mold_translational_casting_2(const Polygon& pgn, OutputIterator oi)
{
return oi;
}
#endif