| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010, Google Inc. | 2 * Copyright 2010, Google Inc. |
| 3 * All rights reserved. | 3 * All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 // | 185 // |
| 186 // The triangulation obeys the following guarantees: | 186 // The triangulation obeys the following guarantees: |
| 187 // - If the convex hull is a quadrilateral, then the shortest edge | 187 // - If the convex hull is a quadrilateral, then the shortest edge |
| 188 // will be chosen for the cut into two triangles. | 188 // will be chosen for the cut into two triangles. |
| 189 // - If one of the vertices is contained in the triangle spanned | 189 // - If one of the vertices is contained in the triangle spanned |
| 190 // by the other three, three triangles will be produced. | 190 // by the other three, three triangles will be produced. |
| 191 void Triangulate(bool compute_inside_edges, | 191 void Triangulate(bool compute_inside_edges, |
| 192 bool fill_right_side); | 192 bool fill_right_side); |
| 193 | 193 |
| 194 // Number of triangles computed by Triangulate(). | 194 // Number of triangles computed by Triangulate(). |
| 195 int num_triangles() { | 195 int num_triangles() const { |
| 196 return num_triangles_; | 196 return num_triangles_; |
| 197 } | 197 } |
| 198 | 198 |
| 199 // Returns the computed triangle at index, 0 <= index < | 199 // Returns the computed triangle at index, 0 <= index < |
| 200 // num_triangles(). | 200 // num_triangles(). |
| 201 Triangle* get_triangle(int index) { | 201 Triangle* get_triangle(int index) { |
| 202 DCHECK(index >= 0 && index < num_triangles_); | 202 DCHECK(index >= 0 && index < num_triangles_); |
| 203 return &triangles_[index]; | 203 return &triangles_[index]; |
| 204 } | 204 } |
| 205 | 205 |
| 206 // Number of vertices facing the inside of the shape, if | 206 // Number of vertices facing the inside of the shape, if |
| 207 // compute_inside_edges was true when Triangulate() was called. | 207 // compute_inside_edges was true when Triangulate() was called. |
| 208 int num_interior_vertices() { | 208 int num_interior_vertices() const { |
| 209 return num_interior_vertices_; | 209 return num_interior_vertices_; |
| 210 } | 210 } |
| 211 | 211 |
| 212 // Fetches the given interior vertex, 0 <= index < | 212 // Fetches the given interior vertex, 0 <= index < |
| 213 // num_interior_vertices(). Returns NULL if index is out of range. | 213 // num_interior_vertices(). Returns NULL if index is out of range. |
| 214 Vertex* get_interior_vertex(int index) { | 214 Vertex* get_interior_vertex(int index) { |
| 215 DCHECK(index >= 0 && index < num_interior_vertices_); | 215 DCHECK(index >= 0 && index < num_interior_vertices_); |
| 216 return interior_vertices_[index]; | 216 return interior_vertices_[index]; |
| 217 } | 217 } |
| 218 | 218 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 246 int num_triangles_; | 246 int num_triangles_; |
| 247 | 247 |
| 248 DISALLOW_COPY_AND_ASSIGN(LocalTriangulator); | 248 DISALLOW_COPY_AND_ASSIGN(LocalTriangulator); |
| 249 }; | 249 }; |
| 250 | 250 |
| 251 } // namespace gpu2d | 251 } // namespace gpu2d |
| 252 } // namespace o3d | 252 } // namespace o3d |
| 253 | 253 |
| 254 #endif // O3D_CORE_CROSS_GPU2D_LOCAL_TRIANGULATOR_H_ | 254 #endif // O3D_CORE_CROSS_GPU2D_LOCAL_TRIANGULATOR_H_ |
| 255 | 255 |
| OLD | NEW |