preh.h
Go to the documentation of this file.
1 /**************************************************************************************************
2  Software License Agreement (BSD License)
3 
4  Copyright (c) 2011-2013, LAR toolkit developers - University of Aveiro - http://lars.mec.ua.pt
5  All rights reserved.
6 
7  Redistribution and use in source and binary forms, with or without modification, are permitted
8  provided that the following conditions are met:
9 
10  *Redistributions of source code must retain the above copyright notice, this list of
11  conditions and the following disclaimer.
12  *Redistributions in binary form must reproduce the above copyright notice, this list of
13  conditions and the following disclaimer in the documentation and/or other materials provided
14  with the distribution.
15  *Neither the name of the University of Aveiro nor the names of its contributors may be used to
16  endorse or promote products derived from this software without specific prior written permission.
17 
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
19  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20  FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
21  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
24  IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 ***************************************************************************************************/
34 /*CISC 829 Final Project
35 CISC829 Final project: Image reconstruction using Data-Dependent triangulation (DDT)
36 Spring 2008
37 
38 The following is an implementation of the DDT algorithm presented in
39 "Image Reconstruction Using Data-Dependent Triangulation,", Xiaohua Yu, Bryan S. Morse, Thomas W. Sederberg, IEEE Computer Graphics and Applications, vol. 21, no. 3, pp. 62-68, May/Jun, 2001
40 
41 Gowri Somanath
42 Feng Li
43 CIS
44 University of Delaware.
45 */
46 
47 
48 // header for CGAL
49 
50 #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
51 #include <CGAL/Triangulation_euclidean_traits_xy_3.h>
52 #include <CGAL/Delaunay_triangulation_2.h>
53 #include <CGAL/squared_distance_2.h>
54 #include <CGAL/Interpolation_traits_2.h>
55 #include <CGAL/natural_neighbor_coordinates_2.h>
56 #include <CGAL/interpolation_functions.h>
57 
58 #include <CGAL/point_generators_2.h>
59 #include <CGAL/copy_n.h>
60 #include <CGAL/Origin.h>
61 #include <fstream>
62 
63 struct K : CGAL::Exact_predicates_inexact_constructions_kernel {};
64 typedef K::FT Coord_type;
65 typedef K::Vector_2 Vector;
66 typedef K::Point_2 Point;
67 
68 //typedef CGAL::Triangulation_euclidean_traits_xy_3<K> Gt;
69 //typedef CGAL::Delaunay_triangulation_2<Gt> Delaunay;
70 typedef CGAL::Delaunay_triangulation_2<K> Delaunay;
71 typedef CGAL::Interpolation_traits_2<K> Traits;
72 
81 
83 typedef Delaunay::Finite_edges_iterator Edge_iterator;
87 
88 typedef std::vector< std::pair<Point, Coord_type> > Coordinate_vector;
89 typedef std::map<Point, Coord_type, K::Less_xy_2> Point_value_map;
90 typedef std::map<Point, Vector, K::Less_xy_2 > Point_vector_map;
91 typedef std::pair<Vertex_handle,Vertex_handle> GEdge;
92 
93 #include <iostream>
94 #include <algorithm>
95 #include <functional>
96 #include <vector>
97 typedef std::vector<GEdge> EdgeVector ;
98 typedef EdgeVector::iterator EdgeVectorIterator ;
99 
100 
101 #include <CGAL/Cartesian.h>
102 #include <CGAL/Polygon_2.h>
103 #include <iostream>
104 
105 typedef CGAL::Cartesian<double> K1;
107 typedef CGAL::Polygon_2<K1> Polygon_2;
108 
109 
110 bool getPlaneEqn(int x1,int y1,int z1,int x2,int y2,int z2,int x3,int y3,int z3,double *a,double *b);
111 double getCost(double a1,double b1,double a2,double b2);
112 
113 bool processForCost(Face_handle f1,int i,Point_value_map values,Delaunay *dt);
114 
115 
116 #include "cv.h"
117 #include <highgui.h>
118 #include <assert.h>
Delaunay::All_faces_iterator All_faces_iterator
Definition: preh.h:86
K1::Point_2 GPoint
Definition: preh.h:106
CGAL::Cartesian< double > K1
Definition: preh.h:105
Delaunay::Face_handle Face_handle
Definition: preh.h:79
K::FT Coord_type
Definition: preh.h:64
CGAL::Polygon_2< K1 > Polygon_2
Definition: preh.h:107
std::pair< Vertex_handle, Vertex_handle > GEdge
Definition: preh.h:91
Delaunay::Finite_edges_iterator Edge_iterator
Definition: preh.h:83
bool processForCost(Face_handle f1, int i, Point_value_map values, Delaunay *dt)
Definition: otherfns.cpp:118
Delaunay::Edge Edge
Definition: preh.h:77
EdgeVector::iterator EdgeVectorIterator
Definition: preh.h:98
Delaunay::Vertex_circulator Vertex_circulator
Definition: preh.h:73
Delaunay::Vertex_handle Vertex_handle
Definition: preh.h:78
Delaunay::Edge_circulator Edge_circulator
Definition: preh.h:74
std::vector< std::pair< Point, Coord_type > > Coordinate_vector
Definition: preh.h:88
double getCost(double a1, double b1, double a2, double b2)
Definition: otherfns.cpp:103
std::map< Point, Vector, K::Less_xy_2 > Point_vector_map
Definition: preh.h:90
Delaunay::Vertex Vertex
Definition: preh.h:75
Delaunay::Face_circulator Face_circulator
Definition: preh.h:80
std::vector< GEdge > EdgeVector
Definition: preh.h:97
std::map< Point, Coord_type, K::Less_xy_2 > Point_value_map
Definition: preh.h:89
CGAL::Interpolation_traits_2< K > Traits
Definition: preh.h:71
unsigned char b[16]
Delaunay::All_vertices_iterator All_vertices_iterator
Definition: preh.h:85
K::Point_2 Point
Definition: preh.h:66
Delaunay::Locate_type Locate_type
Definition: preh.h:82
Delaunay dt
Definition: ddt.cpp:56
bool getPlaneEqn(int x1, int y1, int z1, int x2, int y2, int z2, int x3, int y3, int z3, double *a, double *b)
Definition: otherfns.cpp:51
Definition: preh.h:63
Delaunay::Face Face
Definition: preh.h:76
Delaunay::Vertex_iterator Vertex_iterator
Definition: preh.h:84
CGAL::Delaunay_triangulation_2< K > Delaunay
Definition: preh.h:70
K::Vector_2 Vector
Definition: preh.h:65
CDT::Face_handle Face_handle


polygon_primitives_extraction
Author(s): Miguel Oliveira
autogenerated on Mon Mar 2 2015 01:32:42