xmsgrid  1.0
GmPolygonUnitTests Class Reference

Tests GmPolygon. More...

#include <GmPolygon.t.h>

Inheritance diagram for GmPolygonUnitTests:

Public Member Functions

void testNoHoles ()
 Test a simple polygon with some points outside, some inside, some on, and some coincident with polygon points. More...
 
void testWithHoles ()
 Test a polygon with holes. More...
 
void testMinDistanceToBoundary ()
 tests calculating the minimum distance to the boundary of a polygon.
 
void testIntersection ()
 tests intersection of polygons
 
void testUnion ()
 tests union of polygons
 

Static Public Member Functions

static void SetUpPolyWithHoles1 (xms::VecPt3d &a_outPoly, xms::VecPt3d2d &a_inPolys, xms::VecPt3d &a_ptsToTest)
 Used in tests to create a polygon with two holes. More...
 
static void SetUpPolyWithHole (xms::VecPt3d &a_outPoly, xms::VecPt3d &a_inPolys)
 Used in tests to create a polygon with lots of segments and 2 holes. More...
 

Detailed Description

Tests GmPolygon.

Tester for the GmPolygon class.

Definition at line 29 of file GmPolygon.t.h.

Member Function Documentation

◆ SetUpPolyWithHole()

void GmPolygonUnitTests::SetUpPolyWithHole ( xms::VecPt3d a_outPoly,
xms::VecPt3d a_inPoly 
)
static

Used in tests to create a polygon with lots of segments and 2 holes.

Parameters
a_outPolyThe outside polygon.
a_inPolyThe inside polygons. The first point is not repeated. Outer poly is CCW, inners are CW.
// 30 -        8---9  12--13  16--17  20--21  24------25
//    |        |   |   |   |   |   |   |   |   |       |
// 25 -        7  10--11  14--15  18--19  22--23  27--26
//    |        |                                   |
// 20 -        6---5   2---3---4---5---6---7---8  28--29
//    |            |   |                       |       |
// 15 -        3---4   1  18---17 14---13 10---9  31--30
//    |        |       |   |   |   |   |   |       |
// 10 -        2       0---19 16---15 12---11     32--33
//    |        |                                       |
//  5 -        1   51-50   47-46   43-42   39-38   35-34
//    |        |   |   |   |   |   |   |   |   |   |
//  0 -        0--52   49-48  45--44   41-40   37-36
//
//             |---|---|---|---|---|---|---|---|---|---|
//             0   5  10  15  20  25  30  35  40  45  50  55
/// 

Definition at line 624 of file GmPolygon.cpp.

References xms::gmArrayToVecPt3d(), and XM_COUNTOF.

Referenced by GmPointInPolyUnitTests::Setup().

◆ SetUpPolyWithHoles1()

void GmPolygonUnitTests::SetUpPolyWithHoles1 ( xms::VecPt3d a_outPoly,
xms::VecPt3d2d a_inPolys,
xms::VecPt3d a_ptsToTest 
)
static

Used in tests to create a polygon with two holes.

Parameters
a_outPolyThe outside polygon.
a_inPolysThe inside polygons.
a_ptsToTestLocations to test if they are inside the polygon. The first point is not repeated. Outer poly is CCW, inners are CW.
// 30 -        1---------------------------------------2
//    |        |                                       |
// 25 -        |                                       |
//    |        |                                       |
// 20 -        |       5-------4       5-------4       |
//    |        |       |       |       |       |       |
// 15 -        |       |       3       |       3       3
//    |        |       |       |       |       |       |
// 10 -        |       0---1---2       0---1---2       |
//    |        |                                       |
//  5 -        |                                       |
//    |        |                                       |
//  0 -        0-------------------5-------------------4
//
//             |---|---|---|---|---|---|---|---|---|---|
//             0   5  10  15  20  25  30  35  40  45  50  55
/// 

Definition at line 568 of file GmPolygon.cpp.

Referenced by testWithHoles().

◆ testNoHoles()

void GmPolygonUnitTests::testNoHoles ( )

Test a simple polygon with some points outside, some inside, some on, and some coincident with polygon points.

// 15 -    0   1   2   3   4
//    |
// 10 -    5   6---7---8   9
//    |        |       |
//  5 -   10  11  12  13  14
//    |        |       |
//  0 -   15  16--17--18  19
//    |
// -5 -   20  21  22  23  24
//
//         |---|---|---|---|
//        -5   0   5   10  15
/// 

Definition at line 396 of file GmPolygon.cpp.

References xms::GmPolygon::New().

◆ testWithHoles()

void GmPolygonUnitTests::testWithHoles ( )

Test a polygon with holes.

See also
StripPointTests::testWithHoles
// 35 -    *   *   *   *   *   *   *   *   *   *   *   *   *
//    |
// 30 -    *   5---*---*---*---*---*---*---*---*---*---4   *
//    |        |                                       |
// 25 -    *   *   *   *   *   *   *   *   *   *   *   *   *
//    |        |                                       |
// 20 -    *   *   *   1---*---2   *   1---*---2   *   *   *
//    |        |       |       |       |       |       |
// 15 -    *   *   *   *   *   3   *   *   *   3   *   3   *
//    |        |       |       |       |       |       |
// 10 -    *   *   *   0---5---4   *   0---5---4   *   *   *
//    |        |                                       |
//  5 -    *   *   *   *   *   *   *   *   *   *   *   *   *
//    |        |                                       |
//  0 -    *   0---*---*---*---*---1---*---*---*---*---2   *
//    |
// -5 -    *   *   *   *   *   *   *   *   *   *   *   *   *
//
//         |---|---|---|---|---|---|---|---|---|---|---|---|
//        -5   0   5  10  15  20  25  30  35  40  45  50  55
/// 

Definition at line 484 of file GmPolygon.cpp.

References xms::GmPolygon::New(), SetUpPolyWithHoles1(), and TS_ASSERT_EQUALS_VEC.


The documentation for this class was generated from the following files: