xmsgrid  1.0
triangles.h
Go to the documentation of this file.
1 #pragma once
2 //------------------------------------------------------------------------------
8 //------------------------------------------------------------------------------
9 
10 //----- Included files ---------------------------------------------------------
11 
12 // 3. Standard Library Headers
13 #include <vector>
14 
15 // 4. External Library Headers
16 #include <xmscore/points/pt.h>
17 
18 // 5. Shared Headers
19 #include <xmscore/stl/vector.h>
20 
21 // 6. Non-shared Headers
22 
23 //----- Namespace declaration --------------------------------------------------
24 
25 namespace xms
26 {
27 //----- Constants / Enumerations -----------------------------------------------
28 
29 //----- Forward declarations ---------------------------------------------------
30 
31 //----- Structs / Classes -----------------------------------------------------
32 
33 //----- Function prototypes ----------------------------------------------------
34 
35 double trArea(const Pt3d& a_pt1, const Pt3d& a_pt2, const Pt3d& a_pt3);
36 void trBuildGridPolys(int rows, int cols, VecPt3d& pts, VecInt2d& polys);
37 void trBuildGridTrianglePolys(int rows, int cols, VecPt3d& a_points, VecInt2d& a_polys);
38 
39 //------------------------------------------------------------------------------
43 //------------------------------------------------------------------------------
44 inline int trIncrementIndex(int i)
45 {
46  static const int plus1mod3[3] = {1, 2, 0};
47  return plus1mod3[i];
48 }
49 //------------------------------------------------------------------------------
53 //------------------------------------------------------------------------------
54 inline int trDecrementIndex(int i)
55 {
56  static const int minus1mod3[3] = {2, 0, 1};
57  return minus1mod3[i];
58 }
59 
60 } // namespace xms
int trDecrementIndex(int i)
Faster than a % operation and we do this a lot.
Definition: triangles.h:54
void trBuildGridPolys(int rows, int cols, VecPt3d &pts, VecInt2d &polys)
Build something like this:
Definition: triangles.cpp:132
std::vector< VecInt > VecInt2d
double trArea(const Pt3d &a_pt1, const Pt3d &a_pt2, const Pt3d &a_pt3)
Return the signed planar area of the triangle (CCW Positive).
Definition: triangles.cpp:46
void trBuildGridTrianglePolys(int rows, int cols, VecPt3d &a_points, VecInt2d &a_polys)
Create something like this:
Definition: triangles.cpp:72
XMS Namespace.
Definition: geoms.cpp:34
int trIncrementIndex(int i)
Faster than a % operation and we do this a lot.
Definition: triangles.h:44
std::vector< Pt3d > VecPt3d