31 March 2020 04:06:32 PM POLYGON_GRID_TEST: C++ version Test the POLYGON_GRID library. POLYGON_GRID_COUNT_TEST: POLYGON_GRID_COUNT counts NG, the number of points in a grid defined with N+1 points on each side of a polygon of NV vertices. Polygonal vertex count NV = 3 N NG 0 1 1 4 2 10 3 19 4 31 5 46 Polygonal vertex count NV = 4 N NG 0 1 1 5 2 13 3 25 4 41 5 61 Polygonal vertex count NV = 5 N NG 0 1 1 6 2 16 3 31 4 51 5 76 POLYGON_GRID_POINTS_TEST01: POLYGON_GRID_POINTS returns grid points for a polygon of NV vertices, with N+1 points on a side For this test, the polygon is a triangle. Polygon vertices: Row: 0 1 Col 0: 0 0 1: 1 0 2: 0.5 0.866025 N = 5 Number of grid points will be NG = 46 The grid point array: Row: 0 1 Col 0: 0.5 0.288675 1: 0.4 0.23094 2: 0.5 0.173205 3: 0.6 0.11547 4: 0.7 0.057735 5: 0.8 0 6: 0.3 0.173205 7: 0.4 0.11547 8: 0.5 0.057735 9: 0.6 0 10: 0.2 0.11547 11: 0.3 0.057735 12: 0.4 0 13: 0.1 0.057735 14: 0.2 0 15: 0 0 16: 0.6 0.23094 17: 0.6 0.34641 18: 0.6 0.46188 19: 0.6 0.57735 20: 0.6 0.69282 21: 0.7 0.173205 22: 0.7 0.288675 23: 0.7 0.404145 24: 0.7 0.519615 25: 0.8 0.11547 26: 0.8 0.23094 27: 0.8 0.34641 28: 0.9 0.057735 29: 0.9 0.173205 30: 1 0 31: 0.5 0.404145 32: 0.4 0.34641 33: 0.3 0.288675 34: 0.2 0.23094 35: 0.1 0.173205 36: 0.5 0.519615 37: 0.4 0.46188 38: 0.3 0.404145 39: 0.2 0.34641 40: 0.5 0.635085 41: 0.4 0.57735 42: 0.3 0.519615 43: 0.5 0.750555 44: 0.4 0.69282 45: 0.5 0.866025 Created vertex file 'triangle_vertex.txt' Created grid file 'triangle_grid.txt' Created command file 'triangle_commands.txt' Data written to the file 'triangle.xy' POLYGON_GRID_POINTS_TEST02: POLYGON_GRID_POINTS returns grid points for a polygon of NV vertices, with N+1 points on a side For this test, the polygon is a convex quadrilateral with sides of varying length. Polygon vertices: Row: 0 1 Col 0: 1 1 1: 2 0 2: 4 3 3: 0 5 N = 7 Number of grid points will be NG = 113 The grid point array: Row: 0 1 Col 0: 1.75 2.25 1: 1.64286 2.07143 2: 1.67857 1.75 3: 1.71429 1.42857 4: 1.75 1.10714 5: 1.78571 0.785714 6: 1.82143 0.464286 7: 1.85714 0.142857 8: 1.53571 1.89286 9: 1.57143 1.57143 10: 1.60714 1.25 11: 1.64286 0.928571 12: 1.67857 0.607143 13: 1.71429 0.285714 14: 1.42857 1.71429 15: 1.46429 1.39286 16: 1.5 1.07143 17: 1.53571 0.75 18: 1.57143 0.428571 19: 1.32143 1.53571 20: 1.35714 1.21429 21: 1.39286 0.892857 22: 1.42857 0.571429 23: 1.21429 1.35714 24: 1.25 1.03571 25: 1.28571 0.714286 26: 1.10714 1.17857 27: 1.14286 0.857143 28: 1 1 29: 1.78571 1.92857 30: 2.10714 2.03571 31: 2.42857 2.14286 32: 2.75 2.25 33: 3.07143 2.35714 34: 3.39286 2.46429 35: 3.71429 2.57143 36: 1.82143 1.60714 37: 2.14286 1.71429 38: 2.46429 1.82143 39: 2.78571 1.92857 40: 3.10714 2.03571 41: 3.42857 2.14286 42: 1.85714 1.28571 43: 2.17857 1.39286 44: 2.5 1.5 45: 2.82143 1.60714 46: 3.14286 1.71429 47: 1.89286 0.964286 48: 2.21429 1.07143 49: 2.53571 1.17857 50: 2.85714 1.28571 51: 1.92857 0.642857 52: 2.25 0.75 53: 2.57143 0.857143 54: 1.96429 0.321429 55: 2.28571 0.428571 56: 2 0 57: 2.07143 2.35714 58: 1.82143 2.75 59: 1.57143 3.14286 60: 1.32143 3.53571 61: 1.07143 3.92857 62: 0.821429 4.32143 63: 0.571429 4.71429 64: 2.39286 2.46429 65: 2.14286 2.85714 66: 1.89286 3.25 67: 1.64286 3.64286 68: 1.39286 4.03571 69: 1.14286 4.42857 70: 2.71429 2.57143 71: 2.46429 2.96429 72: 2.21429 3.35714 73: 1.96429 3.75 74: 1.71429 4.14286 75: 3.03571 2.67857 76: 2.78571 3.07143 77: 2.53571 3.46429 78: 2.28571 3.85714 79: 3.35714 2.78571 80: 3.10714 3.17857 81: 2.85714 3.57143 82: 3.67857 2.89286 83: 3.42857 3.28571 84: 4 3 85: 1.5 2.64286 86: 1.39286 2.46429 87: 1.28571 2.28571 88: 1.17857 2.10714 89: 1.07143 1.92857 90: 0.964286 1.75 91: 0.857143 1.57143 92: 1.25 3.03571 93: 1.14286 2.85714 94: 1.03571 2.67857 95: 0.928571 2.5 96: 0.821429 2.32143 97: 0.714286 2.14286 98: 1 3.42857 99: 0.892857 3.25 100: 0.785714 3.07143 101: 0.678571 2.89286 102: 0.571429 2.71429 103: 0.75 3.82143 104: 0.642857 3.64286 105: 0.535714 3.46429 106: 0.428571 3.28571 107: 0.5 4.21429 108: 0.392857 4.03571 109: 0.285714 3.85714 110: 0.25 4.60714 111: 0.142857 4.42857 112: 0 5 Created vertex file 'quad_vertex.txt' Created grid file 'quad_grid.txt' Created command file 'quad_commands.txt' Data written to the file 'quad.xy' POLYGON_GRID_POINTS_TEST03: POLYGON_GRID_POINTS returns grid points for a polygon of NV vertices, with N+1 points on a side For this test, the polygon is nonconvex and six sided. Two degenerate triangles are created, and some grid points are generated several times. Polygon vertices: Row: 0 1 Col 0: 0 0 1: 2 0 2: 2 1 3: 1 1 4: 1 2 5: 0 2 N = 5 Number of grid points will be NG = 91 The grid point array: Row: 0 1 Col 0: 1 1 1: 0.8 0.8 2: 1 0.6 3: 1.2 0.4 4: 1.4 0.2 5: 1.6 0 6: 0.6 0.6 7: 0.8 0.4 8: 1 0.2 9: 1.2 0 10: 0.4 0.4 11: 0.6 0.2 12: 0.8 0 13: 0.2 0.2 14: 0.4 0 15: 0 0 16: 1.2 0.8 17: 1.4 0.8 18: 1.6 0.8 19: 1.8 0.8 20: 2 0.8 21: 1.4 0.6 22: 1.6 0.6 23: 1.8 0.6 24: 2 0.6 25: 1.6 0.4 26: 1.8 0.4 27: 2 0.4 28: 1.8 0.2 29: 2 0.2 30: 2 0 31: 1.2 1 32: 1.2 1 33: 1.2 1 34: 1.2 1 35: 1.2 1 36: 1.4 1 37: 1.4 1 38: 1.4 1 39: 1.4 1 40: 1.6 1 41: 1.6 1 42: 1.6 1 43: 1.8 1 44: 1.8 1 45: 2 1 46: 1 1 47: 1 1.2 48: 1 1.4 49: 1 1.6 50: 1 1.8 51: 1 1 52: 1 1.2 53: 1 1.4 54: 1 1.6 55: 1 1 56: 1 1.2 57: 1 1.4 58: 1 1 59: 1 1.2 60: 1 1 61: 1 1.2 62: 0.8 1.4 63: 0.6 1.6 64: 0.4 1.8 65: 0.2 2 66: 1 1.4 67: 0.8 1.6 68: 0.6 1.8 69: 0.4 2 70: 1 1.6 71: 0.8 1.8 72: 0.6 2 73: 1 1.8 74: 0.8 2 75: 1 2 76: 0.8 1.2 77: 0.6 1 78: 0.4 0.8 79: 0.2 0.6 80: 0 0.4 81: 0.6 1.4 82: 0.4 1.2 83: 0.2 1 84: 0 0.8 85: 0.4 1.6 86: 0.2 1.4 87: 0 1.2 88: 0.2 1.8 89: 0 1.6 90: 0 2 Created vertex file 'ell_vertex.txt' Created grid file 'ell_grid.txt' Created command file 'ell_commands.txt' Data written to the file 'ell.xy' POLYGON_GRID_TEST: Normal end of execution. 31 March 2020 04:06:32 PM