1 /*
2  * This file is a part of the C port of the Poly2Tri library
3  * Porting to C done by (c) Barak Itkin <lightningismyname@gmail.com>
4  * http://code.google.com/p/poly2tri-c/
5  *
6  * Poly2Tri Copyright (c) 2009-2010, Poly2Tri Contributors
7  * http://code.google.com/p/poly2tri/
8  *
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without modification,
12  * are permitted provided that the following conditions are met:
13  *
14  * * Redistributions of source code must retain the above copyright notice,
15  *   this list of conditions and the following disclaimer.
16  * * Redistributions in binary form must reproduce the above copyright notice,
17  *   this list of conditions and the following disclaimer in the documentation
18  *   and/or other materials provided with the distribution.
19  * * Neither the name of Poly2Tri nor the names of its contributors may be
20  *   used to endorse or promote products derived from this software without specific
21  *   prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
27  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
29  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  */
35 
36 #ifndef __P2TC_P2T_CDT_H__
37 #define __P2TC_P2T_CDT_H__
38 
39 #include "../common/poly2tri-private.h"
40 #include "advancing_front.h"
41 #include "sweep_context.h"
42 #include "sweep.h"
43 
44 /**
45  *
46  * @author Mason Green <mason.green@gmail.com>
47  *
48  */
49 
50 struct CDT_
51 {
52   /*private: */
53 
54   /**
55    * Internals
56    */
57 
58   P2tSweepContext* sweep_context_;
59   P2tSweep* sweep_;
60 
61 };
62 /**
63  * Constructor - add polyline with non repeating points
64  *
65  * @param polyline
66  */
67 void p2t_cdt_init (P2tCDT* THIS, P2tPointPtrArray polyline);
68 P2tCDT* p2t_cdt_new (P2tPointPtrArray polyline);
69 
70 /**
71  * Destructor - clean up memory
72  */
73 void p2t_cdt_destroy (P2tCDT* THIS);
74 void p2t_cdt_free (P2tCDT* THIS);
75 
76 /**
77  * Add a hole
78  *
79  * @param polyline
80  */
81 void p2t_cdt_add_hole (P2tCDT *THIS, P2tPointPtrArray polyline);
82 
83 /**
84  * Add a steiner point
85  *
86  * @param point
87  */
88 void p2t_cdt_add_point (P2tCDT *THIS, P2tPoint* point);
89 
90 /**
91  * Triangulate - do this AFTER you've added the polyline, holes, and Steiner points
92  */
93 void p2t_cdt_triangulate (P2tCDT *THIS);
94 
95 /**
96  * Get CDT triangles
97  */
98 P2tTrianglePtrArray p2t_cdt_get_triangles (P2tCDT *THIS);
99 
100 /**
101  * Get triangle map
102  */
103 P2tTrianglePtrList p2t_cdt_get_map (P2tCDT *THIS);
104 
105 #endif
106