06 August 2018 12:15:40 PM GEOMETRY_PRB C++ version Test the GEOMETRY library. ANGLE_BOX_2D_TEST ANGLE_BOX_2D Compute P4 and P5, normal to line through P1 and P2, and line through P2 and P3, and DIST units from P2. DIST 1 P1: 0 0 P2: 3 0 P3: 4 2 P4: 2.38197 1 P5: 3.61803 -1 DIST 1 P1: 0 0 P2: 3 0 P3: 2 -2 P4: 3.61803 -1 P5: 2.38197 1 DIST 1 P1: 3 0 P2: 3 0 P3: 2 -2 P4: 2.10557 0.447214 P5: 3.89443 -0.447214 ANGLE_CONTAINS_RAY_2D_TEST ANGLE_CONTAINS_RAY_2D sees if a ray lies within an angle. Vertex A 0: 1 1: 0 Vertex B 0: 0 1: 0 Vertex C 0: 1 1: 1 X Y Inside? 1 0 1 0.866025 0.5 1 0.5 0.866025 0 6.12323e-17 1 0 -0.5 0.866025 0 -0.866025 0.5 0 -1 1.22465e-16 0 -0.866025 -0.5 0 -0.5 -0.866025 0 -1.83697e-16 -1 0 0.5 -0.866025 0 0.866025 -0.5 0 1 -2.44929e-16 0 Vertex A 0: 1 1: 0 Vertex B 0: 0 1: 0 Vertex C 0: 0 1: 1 X Y Inside? 1 0 1 0.866025 0.5 1 0.5 0.866025 1 6.12323e-17 1 1 -0.5 0.866025 0 -0.866025 0.5 0 -1 1.22465e-16 0 -0.866025 -0.5 0 -0.5 -0.866025 0 -1.83697e-16 -1 0 0.5 -0.866025 0 0.866025 -0.5 0 1 -2.44929e-16 0 Vertex A 0: 1 1: -1 Vertex B 0: 0 1: 0 Vertex C 0: 0 1: 1 X Y Inside? 1 0 1 0.866025 0.5 1 0.5 0.866025 1 6.12323e-17 1 1 -0.5 0.866025 0 -0.866025 0.5 0 -1 1.22465e-16 0 -0.866025 -0.5 0 -0.5 -0.866025 0 -1.83697e-16 -1 0 0.5 -0.866025 0 0.866025 -0.5 1 1 -2.44929e-16 1 Vertex A 0: 1 1: 0 Vertex B 0: 0 1: 0 Vertex C 0: -1 1: 0 X Y Inside? 1 0 1 0.866025 0.5 1 0.5 0.866025 1 6.12323e-17 1 1 -0.5 0.866025 1 -0.866025 0.5 1 -1 1.22465e-16 1 -0.866025 -0.5 0 -0.5 -0.866025 0 -1.83697e-16 -1 0 0.5 -0.866025 0 0.866025 -0.5 0 1 -2.44929e-16 0 Vertex A 0: 1 1: 0 Vertex B 0: 0 1: 0 Vertex C 0: 0 1: -1 X Y Inside? 1 0 1 0.866025 0.5 1 0.5 0.866025 1 6.12323e-17 1 1 -0.5 0.866025 1 -0.866025 0.5 1 -1 1.22465e-16 1 -0.866025 -0.5 1 -0.5 -0.866025 1 -1.83697e-16 -1 1 0.5 -0.866025 0 0.866025 -0.5 0 1 -2.44929e-16 0 Vertex A 0: 1 1: 0 Vertex B 0: 0 1: 0 Vertex C 0: 1 1: -0.01 X Y Inside? 1 0 1 0.866025 0.5 1 0.5 0.866025 1 6.12323e-17 1 1 -0.5 0.866025 1 -0.866025 0.5 1 -1 1.22465e-16 1 -0.866025 -0.5 1 -0.5 -0.866025 1 -1.83697e-16 -1 1 0.5 -0.866025 1 0.866025 -0.5 1 1 -2.44929e-16 0 TANGLE_DEG_2D_TEST ANGLE_DEG_2D computes an angle; X Y Theta atan2 ANGLE_DEG_2D 1 0 0 0 0 0.866025 0.5 30 30 30 0.5 0.866025 60 60 60 6.12323e-17 1 90 90 90 -0.5 0.866025 120 120 120 -0.866025 0.5 150 150 150 -1 1.22465e-16 180 180 180 -0.866025 -0.5 210 -150 210 -0.5 -0.866025 240 -120 240 -1.83697e-16 -1 270 -90 270 0.5 -0.866025 300 -60 300 0.866025 -0.5 330 -30 330 1 -2.44929e-16 360 -1.40334e-14 360 ANGLE_HALF_2D_TEST ANGLE_HALF_2D computes the half angle between two rays; The angle is defined by the points (P1,P2,P3) or by the rays P2-->P3, P2-->P1 Point P1: 0: 5.77646 1: 5.89778 Point P2: 0: 5 1: 3 Point P3: 0: 6.93185 1: 3.51764 End point of unit ray from P2, defining half angle, P4: 0: 5.70711 1: 3.70711 Expected value of P4: 0: 5.70711 1: 3.70711 ANGLE_RAD_2D_TEST ANGLE_RAD_2D computes the angle between two rays; Vertex A 0: 1 1: 0 Vertex B 0: 0 1: 0 Vertex C 0: 1 1: 1 Angle = 5.49779 Vertex A 0: 1 1: 0 Vertex B 0: 0 1: 0 Vertex C 0: 0 1: 1 Angle = 4.71239 Vertex A 0: 1 1: -1 Vertex B 0: 0 1: 0 Vertex C 0: 0 1: 1 Angle = 3.92699 Vertex A 0: 1 1: 0 Vertex B 0: 0 1: 0 Vertex C 0: -1 1: 0 Angle = 3.14159 Vertex A 0: 1 1: 0 Vertex B 0: 0 1: 0 Vertex C 0: 0 1: -1 Angle = 1.5708 Vertex A 0: 1 1: 0 Vertex B 0: 0 1: 0 Vertex C 0: 1 1: -0.01 Angle = 0.00999967 ANGLE_RAD_3D_TEST ANGLE_RAD_3D computes an angle; X Y Z ANGLE_RAD_3D (Degrees) 1 0 0 1.5708 90 1 2 3 0.640522 36.6992 0 0 1 0 0 ANGLE_RAD_ND_TEST ANGLE_RAD_ND computes an angle. X Y Theta atan2 ANGLE_RAD_ND 1 0 0 0 0 0.866025 0.5 30 30 0.523599 0.5 0.866025 60 60 1.0472 6.12323e-17 1 90 90 1.5708 -0.5 0.866025 120 120 2.0944 -0.866025 0.5 150 150 2.61799 -1 1.22465e-16 180 180 3.14159 -0.866025 -0.5 210 -150 2.61799 -0.5 -0.866025 240 -120 2.0944 -1.83697e-16 -1 270 -90 1.5708 0.5 -0.866025 300 -60 1.0472 0.866025 -0.5 330 -30 0.523599 1 -2.44929e-16 360 -1.40334e-14 0 ANGLE_TURN_2D_TEST ANGLE_TURN_2D computes the turning angle defined by the line segments [P1,P2] and [P2,P3]. Our three points are: P1 = (C,S) P2 = (0,0) P3 = (1,0) C = cosine ( theta ), S = sine ( theta ). Test Theta Turn 1 0 3.14159 2 30 2.61799 3 60 2.0944 4 90 1.5708 5 120 1.0472 6 150 0.523599 7 180 0 8 210 -0.523599 9 240 -1.0472 10 270 -1.5708 11 300 -2.0944 12 330 -2.61799 13 360 -3.14159 ANNULUS_SECTOR_CENTROID_2D_TEST ANNULUS_SECTOR_CENTROID_2D computes the centroid of a circular annulus. The circle has center 5 3 The inner radius is R1 = 2 The outer radius is R2 = 3 The first angle is THETA1 = 0.523599 The second angle is THETA2 = 1.0472 Centroid: 6.77094 4.77094 BALL01_SAMPLE_2D_TEST For the unit ball in 2 dimensions (the disk): BALL01_SAMPLE_2D samples; A few sample values: 0.44986 -0.126667 -0.843197 -0.34428 0.589627 0.26009 0.39114 0.3234 -0.139466 -0.156136 Number of sample points = 1000 Now average the points, which should get a value close to zero, and closer as N increases. Average: -9.14724e-05 0.0197329 Now average the distance of the points from the center, which should be 1/sqrt(2) = 0.707107 Average: 0.669616 Now average the angle THETA, which should be PI. Average: 3.21598 BALL01_SAMPLE_3D_TEST For the unit ball in 3 dimensions: BALL01_SAMPLE_3D samples; A few sample values: 0.747368 -0.210437 -0.529145 -0.345789 0.203599 0.0498951 0.237652 0.196494 -0.170945 0.683223 0.279121 0.205248 0.0266891 -0.908632 -0.183031 Number of sample points = 1000 Now average the points, which should get a value close to zero, and closer as sample_num increases. Average: 0.00897568 0.0052022 0.0168622 Now average the distance of the points from the center, which should be the 1/2^(1/n) = 0.793701 Average: 0.743321 Now average the angle THETA, which should be PI. Average: 3.20787 Now average the angle PHI, which should be PI/2. Average: 1.60135 BALL01_SAMPLE_ND_TEST For the unit ball in N dimensions: BALL01_SAMPLE_ND samples; A few sample values: -0.420169 0 0 -0.745457 -0 0 -0.812792 -0 0 -0.237917 -0 0 0.458565 -0 0 Number of sample points = 1000 Now average the points, which should get a value close to zero, and closer as N increases. Average: 0.0201863 0 0 Now average the distance of the points from the center, which should be the 1/2^(1/dim_num) = 0.793701 Average: 0.381613 Now average the angle THETA, which should be PI. Average: 1.57708 Now average the angle PHI, which should be PI/2. Average: 1.5708 BALL01_VOLUME_TEST BALL01_VOLUME returns the volume of the unit ball. Volume = 4.18879 BASIS_MAP_3D_TEST BASIS_MAP_3D computes the linear transform A which maps vectors U1, U2 and U3 to vectors V1, V2 and V3. The matrix U Col: 1 2 3 Row 1: 1 0 1 2: 2 0 0 3: 3 1 2 The matrix V Col: 1 2 3 Row 1: 14 3 7 2: 4 1 3 3: 4 0 2 The transformation matrix Col: 1 2 3 Row 1: 1 2 3 2: 1 0 1 3: 2 1 0 The product matrix A * [ U1 | U2 | U3 ] Col: 1 2 3 Row 1: 14 3 7 2: 4 1 3 3: 4 0 2 BOX_CONTAINS_POINT_2D_TEST BOX_CONTAINS_POINT_2D reports if a box contains a point. We will call the function repeatedly, and draw a sketch of the box. ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ------*************************************--- ------*************************************--- ------*************************************--- ------*************************************--- ------*************************************--- ------*************************************--- ------*************************************--- ------*************************************--- ------*************************************--- ------*************************************--- ------*************************************--- ------*************************************--- ------*************************************--- ------*************************************--- ------*************************************--- ------*************************************--- ------*************************************--- ------*************************************--- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- BOX_SEGMENT_CLIP_2D_TEST BOX_SEGMENT_CLIP_2D clips a line with respect to a box. The lower left box corner is: -10 10 The upper right box corner is: 10 20 We list the points PA and PB, and then the clipped values. 1 2 8 16 5 10 -3 12 5 12 Line is inside the box. -20 20 7 20 -10 20 -20 40 0 0 -10 20 -5 10 10 40 20 30 Line is outside the box. BOX_RAY_INT_2D_TEST BOX_RAY_INT_2D computes the intersection of a box with coordinate line sides and a ray whose origin is within the box. Lower left box corner: 0 0 Upper right box corner: 5 3 Origin: 3 1 Point 2: 5 5 Intersection: 4 3 Correct: 4 3 Origin: 4 1 Point 2: 3 1 Intersection: 0 1 Correct: 0 1 Origin: 3 1 Point 2: 4 2 Intersection: 5 3 Correct: 5 3 BOX01_CONTAINS_POINT_2D_TEST BOX01_CONTAINS_POINT_2D reports if the unit box contains a point. We will call the function repeatedly, and draw a sketch of the unit square. ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- CIRCLE_DIA2IMP_2D_TEST CIRCLE_DIA2IMP_2D converts a diameter to an implicit circle in 2D. P1: 0: -0.0807342 1: 6.54649 P2: 0: 4.08073 1: -2.54649 The implicit circle: Radius = 5 Center = (2, 2) CIRCLE_EXP_CONTAINS_POINT_2D_TEST CIRCLE_EXP_CONTAINS_POINT_2D determines if a point lies inside a circle. Possible return values are: -1: The point is inside the circle. 0: The point is on the circle. 1: The point is outside the circle 2: Colinear data, the point is on the line. 3: Colinear data, the point is not on the line. 4: Two equal data points, the point is on the line. 5: Two equal data points, the point is not on the line. 6: All data points equal, the point is equal. 7: All data points equal, the point is not equal. P1 = 4 2 P2 = 1 5 P3 = -2 2 P4 = 2 3 INSIDE = -1 P1 = 4 2 P2 = 1 5 P3 = -2 2 P4 = 1 -1 INSIDE = 0 P1 = 4 2 P2 = 1 5 P3 = -2 2 P4 = 4 6 INSIDE = 1 CIRCLE_EXP2IMP_2D_TEST CIRCLE_EXP2IMP_2D computes the radius and center of the circle through three points. The points:: Row: 1 2 Col 1: 4 2 2: 1 5 3: -2 2 The implicit circle: Radius = 3 Center = (1, 2) The points:: Row: 1 2 Col 1: 4 2 2: 5 4 3: 6 6 The implicit circle: Radius = -1 Center = (0, 0) The points:: Row: 1 2 Col 1: 4 2 2: 1 5 3: 4 2 The implicit circle: Radius = 2.12132 Center = (2.5, 3.5) CIRCLE_IMP_POINT_DIST_2D_TEST CIRCLE_IMP_POINT_DIST_2D finds the distance from a point to a circle. The circle: Radius = 5 Center = (0, 0) X Y D -5.63163 9.12635 9.48713 6.59018 1.23391 4.46689 -1.69386 -8.67763 7.2918 -4.84844 -7.80086 7.7046 -9.12342 2.67931 8.08799 -8.76546 -1.00922 7.26992 -1.97387 5.09347 2.19991 5.94574 -9.96323 10.4699 7.95008 -2.98495 6.86394 -8.1091 -9.72766 11.6355 CIRCLE_IMP_POINTS_ARC_2D_TEST CIRCLE_IMP_POINTS_ARC_2D returns points on a circular arc. The circle will have center 5, -2 and radius R = 2 The arc extends from THETA1 = 1.5708 to THETA2 = 4.71239 Sample results: Row: 1 2 Col 1: 5 0 2: 4.48236 -0.0681483 3: 4 -0.267949 4: 3.58579 -0.585786 5: 3.26795 -1 6: 3.06815 -1.48236 7: 3 -2 8: 3.06815 -2.51764 9: 3.26795 -3 10: 3.58579 -3.41421 11: 4 -3.73205 12: 4.48236 -3.93185 13: 5 -4 CIRCLE_LLR2IMP_2D_TEST CIRCLE_LLR2IMP_2D is given: a line through P1 and P2, a line through Q1 and Q2, and a radius R, and determines the centers C of 4 circles of the given radius, tangent to both lines. Radius R = 1.17532 Point #P1: ( -5.63163, 9.12635) Point #P2: ( 6.59018, 1.23391) Point #Q1: ( -1.69386, -8.67763) Point #Q2: ( -4.84844, -7.80086) Center #1: ( 39.308, -21.2932) Center #2: ( 32.6753, -17.0101) Center #3: ( 46.9151, -23.4075) Center #4: ( 40.2824, -19.1243) 1.17532 1.17532 1.17532 1.17532 1.17532 1.17532 1.17532 1.17532 Radius R = 2.40301 Point #P1: ( 2.67931, -8.76546) Point #P2: ( -1.00922, -1.97387) Point #Q1: ( 5.09347, 5.94574) Point #Q2: ( -9.96323, 7.95008) Center #1: ( -1.75434, 4.43311) Center #2: ( -4.59275, 9.65937) Center #3: ( -7.64963, 5.21789) Center #4: ( -10.488, 10.4442) 2.40301 2.40301 2.40301 2.40301 2.40301 2.40301 2.40301 2.40301 Radius R = 1.45466 Point #P1: ( -8.1091, -9.72766) Point #P2: ( 7.18194, 6.81695) Point #Q1: ( -7.53792, -9.84975) Point #Q2: ( -4.79394, 8.24967) Center #1: ( -9.55235, -13.4324) Center #2: ( -6.0324, -9.62389) Center #3: ( -8.775, -8.30497) Center #4: ( -5.25505, -4.49645) 1.45466 1.45466 1.45466 1.45466 1.45466 1.45466 1.45466 1.45466 Radius R = 3.39167 Point #P1: ( -2.96743, 6.45775) Point #P2: ( -4.65735, 3.84133) Point #Q1: ( 1.23325, 7.22432) Point #Q2: ( -0.924124, 8.23954) Center #1: ( -6.56175, 7.14407) Center #2: ( -2.84826, 12.8935) Center #3: ( -0.368831, 4.22979) Center #4: ( 3.34466, 9.97916) 3.39167 3.39167 3.39167 3.39167 3.39167 3.39167 3.39167 3.39167 Radius R = 1.85172 Point #P1: ( -6.22091, 5.22984) Point #P2: ( -2.06023, -6.29372) Point #Q1: ( 1.48732, -2.65947) Point #Q2: ( 2.3441, -2.76943) Center #1: ( -6.37974, 0.217101) Center #2: ( -4.96611, -3.69814) Center #3: ( -2.25097, -0.312786) Center #4: ( -0.837344, -4.22803) 1.85172 1.85172 1.85172 1.85172 1.85172 1.85172 1.85172 1.85172 CIRCLE_LUNE_ANGLE_BY_HEIGHT_2D_TEST CIRCLE_LUNE_ANGLE_BY_HEIGHT_2D computes the angle of a circular lune based on the 'height' of the circular triangle. R H Angle 2 -2 6.28319 2 -1.66667 5.11181 2 -1.33333 4.60105 2 -1 4.18879 2 -0.666667 3.82127 2 -0.333333 3.47649 2 0 3.14159 2 0.333333 2.8067 2 0.666667 2.46192 2 1 2.0944 2 1.33333 1.68214 2 1.66667 1.17137 2 2 0 CIRCLE_LUNE_AREA_BY_ANGLE_2D_TEST CIRCLE_LUNE_AREA_BY_ANGLE_2D computes the area of a circular lune, defined by joining the endpoints of a circular arc. R Theta1 Theta2 Area 1 0 0 0 1 0 0.523599 0.0117994 1 0 1.0472 0.0905861 1 0 1.5708 0.285398 1 0 2.0944 0.614185 1 0 2.61799 1.059 1 0 3.14159 1.5708 1 0 3.66519 2.0826 1 0 4.18879 2.52741 1 0 4.71239 2.85619 1 0 5.23599 3.05101 1 0 5.75959 3.12979 1 0 6.28319 3.14159 CIRCLE_LUNE_AREA_BY_HEIGHT_2D_TEST CIRCLE_LUNE_AREA_BY_HEIGHT_2D computes the area of a circular lune, defined by joining the endpoints of a circular arc. R Height Area 2 -2 12.5664 2 -1.66667 12.0662 2 -1.33333 11.1897 2 -1 10.1096 2 -0.666667 8.89961 2 -0.333333 7.61032 2 0 6.28319 2 0.333333 4.95605 2 0.666667 3.66676 2 1 2.45674 2 1.33333 1.37666 2 1.66667 0.500173 2 2 0 CIRCLE_LUNE_CENTROID_2D_TEST CIRCLE_LUNE_CENTROID_2D computes the centroid of a circular lune, defined by joining the endpoints of a circular arc. The implicit circle: Radius = 2 Center = (5, 3) The first angle of our lune is always 0. THETA2 X Y 0 7 3 0.523599 6.69667 3.97958 1.0472 5.91994 4.59337 1.5708 5 4.65174 2.0944 4.29498 4.22113 2.61799 4.01733 3.56734 3.14159 4.15117 3 3.66519 4.50032 2.71151 4.18879 4.82867 2.70325 4.71239 5 2.83495 5.23599 5.02731 2.95269 5.75959 5.0064 2.99631 6.28319 5 3 CIRCLE_LUNE_HEIGHT_BY_ANGLE_2D_TEST CIRCLE_LUNE_HEIGHT_BY_ANGLE_2D computes the height of the triangle of a circular lune, given the subtended angle. R Angle Height 2 0 2 2 0.523599 1.93185 2 1.0472 1.73205 2 1.5708 1.41421 2 2.0944 1 2 2.61799 0.517638 2 3.14159 1.22465e-16 2 3.66519 -0.517638 2 4.18879 -1 2 4.71239 -1.41421 2 5.23599 -1.73205 2 5.75959 -1.93185 2 6.28319 -2 CIRCLE_PPPR2IMP_3D_TEST CIRCLE_PPPR2IMP_3D is given 3D points P1, P2, P3, and a radius R, and determines the centers C of two circles of the given radius, passing through P1 and P2 and lying in the plane of P1, P2 and P3. Radius R = 23.1027 Point #1: ( -5.63163, 9.12635) Point #2: ( 1.23391, -1.69386) Point #3: ( -4.84844, -7.80086) Center #1: ( -18.4543, -9.19767) Center #2: ( 14.0566, 16.6302) 23.1027 23.1027 23.1027 23.1027 0 1.77636e-15 -2.66454e-15 -8.88178e-16 Radius R = 17.5115 Point #1: ( -8.76546, -1.00922) Point #2: ( 5.09347, 5.94574) Point #3: ( 7.95008, -2.98495) Center #1: ( 5.5928, -10.6987) Center #2: ( -9.26478, 15.6352) 17.5115 17.5115 17.5115 17.5115 -8.88178e-16 -1.77636e-15 1.77636e-15 8.88178e-16 Radius R = 27.2999 Point #1: ( 7.18194, 6.81695) Point #2: ( -9.84975, -4.79394) Point #3: ( -7.72672, -2.96743) Center #1: ( -3.71727, 21.4175) Center #2: ( 1.04946, -19.3945) 27.2999 27.2999 27.2999 27.2999 -5.50671e-14 -8.61533e-14 8.65974e-14 5.68434e-14 Radius R = 10.903 Point #1: ( 3.84133, 1.23325) Point #2: ( -0.924124, 8.23954) Point #3: ( -6.22091, 5.22984) Center #1: ( -4.32856, -2.05279) Center #2: ( 7.24577, 11.5256) 10.903 10.903 10.903 10.903 8.88178e-16 6.66134e-16 -9.99201e-16 -8.88178e-16 Radius R = 9.72709 Point #1: ( 1.48732, -2.65947) Point #2: ( -2.76943, -5.7414) Point #3: ( -7.64586, -4.01342) Center #1: ( -5.31478, 3.57908) Center #2: ( 4.03267, -11.9799) 9.72709 9.72709 9.72709 9.72709 -4.44089e-16 -6.66134e-16 6.66134e-16 4.44089e-16 CIRCLE_PPR2IMP_2D_TEST CIRCLE_PPR2IMP_2D is given points P1 and P2, and a radius R, and determines the centers C of two circles of the given radius, passing through P1 and P2. Radius R = 16.6252 Point #1: ( -5.63163, 9.12635) Point #2: ( 6.59018, 1.23391) Center #1: ( -7.6305, -7.37824) Center #2: ( 8.58905, 17.7385) 16.6252 16.6252 16.6252 16.6252 Radius R = 7.53379 Point #1: ( -8.67763, -4.84844) Point #2: ( -7.80086, -9.12342) Center #1: ( -15.3031, -8.43467) Center #2: ( -1.17539, -5.5372) 7.53379 7.53379 7.53379 7.53379 Radius R = 13.1171 Point #1: ( -8.76546, -1.00922) Point #2: ( -1.97387, 5.09347) Center #1: ( 2.84933, -7.10465) Center #2: ( -13.5887, 11.1889) 13.1171 13.1171 13.1171 13.1171 Radius R = 17.5779 Point #1: ( -9.96323, 7.95008) Point #2: ( -2.98495, -8.1091) Center #1: ( -20.4538, -6.15419) Center #2: ( 7.50563, 5.99517) 17.5779 17.5779 17.5779 17.5779 Radius R = 23.5378 Point #1: ( 7.18194, 6.81695) Point #2: ( -7.53792, -9.84975) Center #1: ( -15.728, 12.2172) Center #2: ( 15.372, -15.25) 23.5378 23.5378 23.5378 23.5378 CIRCLE_SECTOR_AREA_2D_TEST CIRCLE_SECTOR_AREA_2D computes the area of a circular sector, defined by joining the endpoints of a circular arc to the center. R Theta1 Theta2 Area 1 0 0 0 1 0 0.523599 0.261799 1 0 1.0472 0.523599 1 0 1.5708 0.785398 1 0 2.0944 1.0472 1 0 2.61799 1.309 1 0 3.14159 1.5708 1 0 3.66519 1.8326 1 0 4.18879 2.0944 1 0 4.71239 2.35619 1 0 5.23599 2.61799 1 0 5.75959 2.87979 1 0 6.28319 3.14159 CIRCLE_SECTOR_CENTROID_2D_TEST CIRCLE_SECTOR_CENTROID_2D computes the centroid of a circular sector, defined by joining the endpoints of a circular arc to the center. The implicit circle: Radius = 2 Center = (5, 3) The first angle of our sector is always 0. THETA2 X Y 0 6.33333 3 0.523599 6.14156 3.65908 1.0472 5.63662 4.10266 1.5708 5 4.20042 2.0944 4.44867 3.95493 2.61799 4.14793 3.49194 3.14159 4.15117 3 3.66519 4.39138 2.64861 4.18879 4.72434 2.52254 4.71239 5 2.59986 5.23599 5.12732 2.77947 5.75959 5.10378 2.94008 6.28319 5 3 CIRCLE_TRIANGLE_AREA_2D_TEST CIRCLE_TRIANGLE_AREA_2D computes the signed area of a triangle, defined by joining the endpoints of a circular arc and the center. R Theta1 Theta2 Area 1 0 0 0 1 0 0.523599 0.25 1 0 1.0472 0.433013 1 0 1.5708 0.5 1 0 2.0944 0.433013 1 0 2.61799 0.25 1 0 3.14159 6.12323e-17 1 0 3.66519 -0.25 1 0 4.18879 -0.433013 1 0 4.71239 -0.5 1 0 5.23599 -0.433013 1 0 5.75959 -0.25 1 0 6.28319 -1.22465e-16 TEST0155 CIRCLE_EXP2IMP_2D computes the radius and center of the circle through three points. We can use this routine to compute, for three points in space, the circle incident to those points, and hence the radius of that circle, and hence the "curvature" of those points. Our three points are: (0,0) (1,0) (C,S) C = cosine ( theta), S = sine ( theta ). Test Theta Curvature 1 0 2 2 30 1.93185 3 60 1.73205 4 90 1.41421 5 120 1 6 150 0.517638 7 180 1.22465e-16 8 210 0.517638 9 240 1 10 270 1.41421 11 300 1.73205 12 330 1.93185 13 360 2 TEST0156 CIRCLE_EXP2IMP_2D converts an explicit circle to an implicit circle. CIRCLE_IMP2EXP_2D converts an implicit circle to an explicit circle. The implicit circle: Radius = 3 Center = (10, 5) P1: 0: 13 1: 5 P2: 0: 8.5 1: 7.59808 P3: 0: 8.5 1: 2.40192 The recovered implicit circle: Radius = 3 Center = (10, 5) TEST016 CIRCLE_IMP_POINTS_2D gets points on a circle; POLYGON_AREA_2D finds the area of a polygon. The implicit circle: Radius = 2 Center = (5, -2) The area = 12.5664 Sample results: Row: 1 2 Col 1: 7 -2 2: 6.41421 -0.585786 3: 5 0 4: 3.58579 -0.585786 5: 3 -2 6: 3.58579 -3.41421 7: 5 -4 8: 6.41421 -3.41421 For any N, the sampled points define a polygon whose area approximates the circle area. N Area 3 5.19615 4 8 5 9.51057 6 10.3923 7 10.9456 8 11.3137 9 11.5702 10 11.7557 11 11.8941 12 12 13 12.0828 14 12.1487 15 12.2021 16 12.2459 17 12.2822 18 12.3127 19 12.3386 20 12.3607 21 12.3797 22 12.3962 23 12.4107 24 12.4233 TEST0165 CIRCLE_IMP_POINTS_3D gets points on a circle in 3D; The implicit circle: Radius = 2 Center = (5, -2, 1) Normal = (1, 1, 1) Points on the circle: Row: 1 2 3 Col 1: 3.58579 -0.585786 1 2: 3.36701 -1.1835 1.8165 3: 3.58579 -2 2.41421 4: 4.1835 -2.8165 2.63299 5: 5 -3.41421 2.41421 6: 5.8165 -3.63299 1.8165 7: 6.41421 -3.41421 1 8: 6.63299 -2.8165 0.183503 9: 6.41421 -2 -0.414214 10: 5.8165 -1.1835 -0.632993 11: 5 -0.585786 -0.414214 12: 4.1835 -0.367007 0.183503 CIRCLES_INTERSECT_AREA_2D_TEST CIRCLES_INTERSECT_AREA_2D determines the area of the intersection of two circes of radius R1 and R2, with a distance D between the centers. R1 R2 D Area 1 0.5 1.5 0 1 0.5 1 0.350767 1 0.5 0.5 0.785398 1 1 1.5 0.453312 1 1 1 1.22837 1 1 0 3.14159 CIRCLES_INTERSECT_POINTS_2D_TEST CIRCLES_IMP_INT_2D determines the intersections of two circles in 2D. The first circle: Radius = 5 Center = (0, 0) The second circle: Radius = 0.5 Center = (5, 5) The circles do not intersect. The second circle: Radius = 5 Center = (7.07107, 7.07107) The circles intersect at two points: P 3.53533 3.53574 3.53574 3.53533 The second circle: Radius = 3 Center = (4, 0) The circles intersect at two points: P 4 3 4 -3 The second circle: Radius = 3 Center = (6, 0) The circles intersect at two points: P 4.33333 2.49444 4.33333 -2.49444 The second circle: Radius = 5 Center = (0, 0) The circles coincide (infinite intersection). TEST020 For the cube, CUBE_SIZE_3D returns dimension information; CUBE_SHAPE_3D returns face and order information. SHAPE_PRINT_3D prints this information. Number of vertices: 8 Number of edges : 12 Number of faces : 6 Maximum face order: 4 SHAPE_PRINT_3D Information about a polytope. The number of vertices is 8 Vertices: Index X Y Z 1 -0.57735027 -0.57735027 -0.57735027 2 0.57735027 -0.57735027 -0.57735027 3 0.57735027 0.57735027 -0.57735027 4 -0.57735027 0.57735027 -0.57735027 5 -0.57735027 -0.57735027 0.57735027 6 0.57735027 -0.57735027 0.57735027 7 0.57735027 0.57735027 0.57735027 8 -0.57735027 0.57735027 0.57735027 The number of faces is 6 The maximum order of any face is 4 Index Order Indices of Nodes in Face 1 2 3 4 1 4 1 4 3 2 2 4 1 2 6 5 3 4 2 3 7 6 4 4 3 4 8 7 5 4 1 5 8 4 6 4 5 6 7 8 CUBE01_VOLUME_TEST CUBE01_VOLUME returns the volume of the unit cube. Volume = 1 CYLINDER_POINT_DIST_3D_TEST CYLINDER_POINT_DIST_3D computes the distance to a cylinder. Radius R = 1 Center of bottom disk = 0 -2 0 Center of top disk = 0 2 0 P = 4 0.5 0 Distance (computed) = 3 Distance (exact) = 3 P = -0.5 -1 0 Distance (computed) = 0.5 Distance (exact) = 0.5 P = 4 6 0 Distance (computed) = 5 Distance (exact) = 5 P = 0.75 -10 0 Distance (computed) = 8 Distance (exact) = 8 P = 0 0 0 Distance (computed) = 1 Distance (exact) = 1 P = 0.25 1.75 0 Distance (computed) = 0.25 Distance (exact) = 0.25 CYLINDER_POINT_DIST_SIGNED_3D_TEST CYLINDER_POINT_DIST_SIGNED_3D computes the signed distance to a cylinder. Radius R = 1 Center of bottom disk = 0 -2 0 Center of top disk = 0 2 0 P = 4 0.5 0 Signed distance (computed) = 3 Signed distance (exact) = 3 P = -0.5 -1 0 Signed distance (computed) = -0.5 Signed distance (exact) = -0.5 P = 4 6 0 Signed distance (computed) = 5 Signed distance (exact) = 5 P = 0.75 -10 0 Signed distance (computed) = 8 Signed distance (exact) = 8 P = 0 0 0 Signed distance (computed) = -1 Signed distance (exact) = -1 P = 0.25 1.75 0 Signed distance (computed) = -0.25 Signed distance (exact) = -0.25 TEST0202 CYLINDER_POINT_INSIDE_3D determines if a point is inside a cylinder. Radius R = 1 Center of bottom disk = 0 -2 0 Center of top disk = 0 2 0 P = 4 0.5 0 INSIDE (computed) = 0 INSIDE (exact) = 0 P = -0.5 -1 0 INSIDE (computed) = 1 INSIDE (exact) = 1 P = 4 6 0 INSIDE (computed) = 0 INSIDE (exact) = 0 P = 0.75 -10 0 INSIDE (computed) = 0 INSIDE (exact) = 0 P = 0 0 0 INSIDE (computed) = 1 INSIDE (exact) = 1 P = 0.25 1.75 0 INSIDE (computed) = 1 INSIDE (exact) = 1 TEST0203 CYLINDER_POINT_NEAR_3D computes the nearest point on a cylinder. Radius R = 1 Center of bottom disk = 0 -2 0 Center of top disk = 0 2 0 P = 4 0.5 0 PN (computed) = 1 0.5 0 PN (exact) = 1 0.5 0 P = -0.5 -1 0 PN (computed) = -1 -1 0 PN (exact) = -1 -1 0 P = 4 6 0 PN (computed) = 1 2 0 PN (exact) = 1 2 0 P = 0.75 -10 0 PN (computed) = 0.75 -2 0 PN (exact) = 0.75 -2 0 P = 0 0 0 PN (computed) = 1 0 0 PN (exact) = 1 0 0 P = 0.25 1.75 0 PN (computed) = 0.25 2 0 PN (exact) = 0.25 2 0 (Note that case 5 is ambiguous. The set of nearest points forms a circle, any of which will do.) TEST02035 CYLINDER_SAMPLE_3D samples points in a cylinder. Radius R = 1 Center of bottom disk = 0 -2 0 Center of top disk = 0 2 0 Sample points: Row: 1 2 3 Col 1: 0.44985962 -1.7355251 -0.32340003 2: 0.73708181 1.1891478 0.025742881 3: 0.30635659 -1.9699505 0.26662277 4: 0.26217153 1.4448632 0.35386252 5: 0.031360212 -0.53189333 -0.60049571 6: 0.62444359 -1.7525529 -0.44403972 7: -0.3111115 -0.37212144 0.36846162 8: 0.68348575 -1.8838538 -0.10799692 9: 0.43543119 1.2380763 -0.7482775 10: -0.80550987 0.078902884 -0.020622455 11: -0.46895029 1.8576167 -0.23441305 12: -0.61725094 1.102603 0.11690512 13: 0.37246863 -0.83521908 0.3406036 14: -0.4016184 -1.5908868 0.38542173 15: -0.79038796 0.43653925 0.85364832 16: 0.10845078 -1.3762371 -0.076465139 17: -0.88970778 0.55847349 -0.0034214208 18: -0.44453521 1.0740534 0.53715283 19: -0.22132107 0.38221939 0.555551 20: -0.21505433 0.152145 0.054213201 TEST0204 CYLINDER_VOLUME_3D computes the volume of a cylinder. Radius R = 5 Center of bottom disk = 1 2 3 Center of top disk = 5 6 5 Volume (computed) = 471.2389 Volume (exact) = 471.2389 TEST0205 DEGREES_TO_RADIANS converts an angle from degrees to radians; RADIANS_TO_DEGREES converts an angle from radians to degrees; Degrees Radians Degrees -60 -1.0471976 -60 -30 -0.52359878 -30 0 0 0 30 0.52359878 30 60 1.0471976 60 90 1.5707963 90 120 2.0943951 120 150 2.6179939 150 180 3.1415927 180 210 3.6651914 210 240 4.1887902 240 270 4.712389 270 300 5.2359878 300 330 5.7595865 330 360 6.2831853 360 390 6.8067841 390 420 7.3303829 420 TEST021 DIRECTION_PERT_3D perturbs a direction vector. We use SEED = 2015304040 Base vector: 1 0 0 Using sigma = 0.99 0.98671759 -0.12672152 -0.1016369 0.98475062 -0.16099536 -0.065929619 0.99868583 -0.048527454 -0.016483023 0.95759615 -0.032838035 0.28623641 0.93664955 0.28485355 0.20382852 0.95698664 0.12467242 -0.26197968 0.95808163 0.031115542 -0.28480064 0.95246768 -0.20450788 0.22579161 0.96537268 -0.25838682 -0.035942285 0.99929936 0.034460304 0.014603782 0.99935284 -0.035252151 -0.0071539445 0.99591296 -0.087699499 -0.021591054 0.9991037 0.042215864 0.0031009358 0.99748732 -0.023364303 0.066881668 0.98615257 -0.15948178 -0.045482622 0.98084372 -0.16328393 0.10622597 0.98371496 0.17854562 -0.020648015 0.99492635 -0.0087251471 -0.10022694 0.99353962 0.11306329 -0.0097836526 0.99693472 0.038372012 -0.068181813 Using sigma = 0.5 -0.1337001 0.92032521 0.36759459 -0.038703318 -0.94903851 -0.31277461 0.8285244 -0.19759465 0.52393098 -0.11951338 0.3954173 0.91069298 0.75285711 -0.35015046 -0.55731573 0.40395706 0.28412943 -0.86953387 0.7907351 -0.39877948 -0.46444905 -0.048297094 -0.92016512 0.38854026 0.43495635 -0.80912048 -0.39514177 0.33192324 -0.079679869 -0.93993515 0.77049661 0.19784175 -0.60596503 -0.22938214 0.95265777 -0.19956705 0.23906887 -0.51098161 -0.82567782 0.58754095 -0.52659267 0.61440687 0.90961478 0.40895357 -0.073197818 0.98841425 -0.12693277 -0.083218593 0.45748737 -0.71627977 0.52692371 0.6639411 0.49392882 0.56144148 0.42571274 -0.88409425 0.19273303 -0.36924004 -0.88456411 0.2849704 Using sigma = 0.1 0.23363025 -0.4585022 -0.85743375 0.036394478 -0.80331262 -0.59444451 -0.23120734 0.3943859 0.88938345 -0.90258687 0.31813672 -0.29004478 -0.23888479 0.049572124 -0.96978176 0.28985992 -0.95706898 -0.00043432551 0.0018697746 -0.99964879 -0.026434699 0.9440988 -0.25997681 -0.20270548 0.44411823 0.56721417 0.69356116 0.62946217 -0.1774565 -0.75649624 0.39457839 0.64258666 -0.65680307 0.2824841 0.86044031 -0.4240816 0.71193299 -0.69953681 -0.061641515 -0.22236339 -0.97138657 0.083442475 -0.89890337 -0.43548596 -0.048215328 -0.51908616 0.098074707 0.8490765 0.80124825 -0.59204912 -0.086481672 -0.45474421 -0.33062008 -0.8269813 0.37195686 0.63803437 0.67421083 -0.22366639 -0.95347465 -0.20213717 TEST022 DIRECTION_UNIFORM_3D picks a random direction vector. We use SEED = 2015304040 0.62543825 -0.77980033 0.027174104 0.37804553 -0.92315984 -0.069695739 0.15699306 -0.46220124 0.87276755 -0.63936916 -0.07335065 -0.76539321 -0.22807702 0.3187412 -0.91999181 0.57330269 0.27282664 -0.77258634 0.64665599 0.0706496 -0.75950291 -0.42472548 -0.38468969 -0.81952554 0.10455391 -0.75163148 -0.65124389 -0.14229118 0.33576214 0.93113748 DIRECTION_UNIFORM_ND_TEST DIRECTION_UNIFORM_ND picks a random direction vector. 0.90838212 -0.25577393 -0.30624555 -0.12504109 0.57367631 0.25305423 0.60037353 0.49639771 -0.48450403 -0.54241497 -0.65211665 0.213976 0.026280302 -0.89471486 0.4458342 0.0051499826 -0.12386542 0.16880231 0.97425921 0.083559123 0.14048348 -0.21878283 0.96453234 0.045561288 0.52716834 -0.32312341 -0.46843989 0.63106963 -0.063218473 0.58501527 -0.74862497 -0.30548519 -0.75356417 0.22513769 -0.50437342 -0.35645689 0.057864478 -0.79997928 0.23610678 0.54857856 DISK_POINT_DIST_3D_TEST DISK_POINT_DIST_3D finds the distance from a disk to a point in 3D. Disk radius = 2 Disk center: 0: 0 1: 1.4142135 2: 1.4142135 Disk axis: 0: 0 1: 1 2: 1 Point: 0: 0 1: 0 2: 0 Distance = 1.9999999 Expected = 2 Point: 0: 0 1: 0.70710677 2: 2.1213202 Distance = 2.1213203e-08 Expected = 0 Point: 0: 2 1: 1.4142135 2: 1.4142135 Distance = 0 Expected = 0 Point: 0: 10 1: 1.4142135 2: 1.4142135 Distance = 8 Expected = 8 Point: 0: 10 1: 5.6568542 2: 5.6568542 Distance = 10 Expected = 10 TEST0234 R8MAT_SOLVE_2D solves 2D linear systems. Solution / Computed: 0.41530708 0.41530708 0.066118735 0.066118735 Solution / Computed: 0.061727229 0.061727229 0.44953896 0.44953896 Solution / Computed: 0.89750406 0.89750406 0.35075234 0.35075234 Solution / Computed: 0.12310392 0.12310392 0.0075123641 0.0075123641 Solution / Computed: 0.82288732 0.82288732 0.26713227 0.26713227 TEST0235 DMS_TO_RADIANS converts an angle from degrees/minutes/seconds to radians; RADIANS_TO_DEGREES converts an angle from radians to degrees/minutes/seconds; Radians DMS Radians -0.8975979 -51 -25 -42 -0.89759375 -0.44879895 -25 -42 -51 -0.44879687 0 0 0 0 0 0.44879895 25 42 51 0.44879687 0.8975979 51 25 42 0.89759375 1.3463969 77 8 34 1.3463955 1.7951958 102 51 25 1.7951923 2.2439948 128 34 17 2.2439941 2.6927937 154 17 8 2.6927909 3.1415927 180 0 0 3.1415927 3.5903916 205 42 51 3.5903895 4.0391906 231 25 42 4.0391864 4.4879895 257 8 34 4.4879881 4.9367885 282 51 25 4.936785 5.3855874 308 34 17 5.3855867 5.8343864 334 17 8 5.8343836 6.2831853 360 0 0 6.2831853 6.7319843 385 42 51 6.7319822 TEST0236 For the dodecahedron, DODEC_SIZE_3D returns dimension information; DODEC_SHAPE_3D returns face and order information. SHAPE_PRINT_3D prints this information. Number of vertices: 20 Number of edges : 30 Number of faces : 12 Maximum face order: 5 SHAPE_PRINT_3D Information about a polytope. The number of vertices is 20 Vertices: Index X Y Z 1 0.57735027 0.57735027 0.57735027 2 0.57735027 0.57735027 -0.57735027 3 0.57735027 -0.57735027 0.57735027 4 0.57735027 -0.57735027 -0.57735027 5 -0.57735027 0.57735027 0.57735027 6 -0.57735027 0.57735027 -0.57735027 7 -0.57735027 -0.57735027 0.57735027 8 -0.57735027 -0.57735027 -0.57735027 9 0.35682209 0.93417236 0 10 -0.35682209 0.93417236 0 11 0.35682209 -0.93417236 0 12 -0.35682209 -0.93417236 0 13 0.93417236 0 0.35682209 14 0.93417236 0 -0.35682209 15 -0.93417236 0 0.35682209 16 -0.93417236 0 -0.35682209 17 0 0.35682209 0.93417236 18 0 -0.35682209 0.93417236 19 0 0.35682209 -0.93417236 20 0 -0.35682209 -0.93417236 The number of faces is 12 The maximum order of any face is 5 Index Order Indices of Nodes in Face 1 2 3 4 5 1 5 2 9 1 13 14 2 5 5 10 6 16 15 3 5 3 11 4 14 13 4 5 8 12 7 15 16 5 5 3 13 1 17 18 6 5 2 14 4 20 19 7 5 5 15 7 18 17 8 5 8 16 6 19 20 9 5 5 17 1 9 10 10 5 3 18 7 12 11 11 5 2 19 6 10 9 12 5 8 20 4 11 12 DUAL_SIZE_3D_TEST DUAL_SIZE_3D finds the sizes of the dual of a polyhedron; The cube: Number of vertices: 8 Number of edges : 12 Number of faces : 6 Maximum face order: 4 The dual of the cube: Number of vertices: 6 Number of edges : 12 Number of faces : 8 Maximum face order: 3 The dodecahedron: Number of vertices: 20 Number of edges : 30 Number of faces : 12 Maximum face order: 5 The dual of the dodecahedron: Number of vertices: 12 Number of edges : 30 Number of faces : 20 Maximum face order: 3 The icosahedron: Number of vertices: 12 Number of edges : 30 Number of faces : 20 Maximum face order: 3 The dual of the icosahedron: Number of vertices: 20 Number of edges : 30 Number of faces : 12 Maximum face order: 5 The octahedron: Number of vertices: 6 Number of edges : 12 Number of faces : 8 Maximum face order: 3 The dual of the octahedron: Number of vertices: 8 Number of edges : 12 Number of faces : 6 Maximum face order: 4 The soccer ball: Number of vertices: 60 Number of edges : 90 Number of faces : 32 Maximum face order: 6 The dual of the soccer ball: Number of vertices: 32 Number of edges : 90 Number of faces : 60 Maximum face order: 3 The tetrahedron: Number of vertices: 4 Number of edges : 12 Number of faces : 4 Maximum face order: 3 The dual of the tetrahedron: Number of vertices: 4 Number of edges : 12 Number of faces : 4 Maximum face order: 3 DUAL_SHAPE_3D_TEST DUAL_SHAPE_3D finds the dual of a polyhedron. The dodecahedron: Number of vertices: 20 Number of edges : 30 Number of faces : 12 Maximum face order: 5 SHAPE_PRINT_3D Information about a polytope. The number of vertices is 20 Vertices: Index X Y Z 1 0.57735027 0.57735027 0.57735027 2 0.57735027 0.57735027 -0.57735027 3 0.57735027 -0.57735027 0.57735027 4 0.57735027 -0.57735027 -0.57735027 5 -0.57735027 0.57735027 0.57735027 6 -0.57735027 0.57735027 -0.57735027 7 -0.57735027 -0.57735027 0.57735027 8 -0.57735027 -0.57735027 -0.57735027 9 0.35682209 0.93417236 0 10 -0.35682209 0.93417236 0 11 0.35682209 -0.93417236 0 12 -0.35682209 -0.93417236 0 13 0.93417236 0 0.35682209 14 0.93417236 0 -0.35682209 15 -0.93417236 0 0.35682209 16 -0.93417236 0 -0.35682209 17 0 0.35682209 0.93417236 18 0 -0.35682209 0.93417236 19 0 0.35682209 -0.93417236 20 0 -0.35682209 -0.93417236 The number of faces is 12 The maximum order of any face is 5 Index Order Indices of Nodes in Face 1 2 3 4 5 1 5 2 9 1 13 14 2 5 5 10 6 16 15 3 5 3 11 4 14 13 4 5 8 12 7 15 16 5 5 3 13 1 17 18 6 5 2 14 4 20 19 7 5 5 15 7 18 17 8 5 8 16 6 19 20 9 5 5 17 1 9 10 10 5 3 18 7 12 11 11 5 2 19 6 10 9 12 5 8 20 4 11 12 The dual of the dodecahedron: Number of vertices: 12 Number of edges : 30 Number of faces : 20 Maximum face order: 3 SHAPE_PRINT_3D Information about a polytope. The number of vertices is 12 Vertices: Index X Y Z 1 0.85065081 0.52573111 0 2 -0.85065081 0.52573111 0 3 0.85065081 -0.52573111 0 4 -0.85065081 -0.52573111 0 5 0.52573111 0 0.85065081 6 0.52573111 0 -0.85065081 7 -0.52573111 0 0.85065081 8 -0.52573111 0 -0.85065081 9 0 0.85065081 0.52573111 10 0 -0.85065081 0.52573111 11 0 0.85065081 -0.52573111 12 0 -0.85065081 -0.52573111 The number of faces is 20 The maximum order of any face is 3 Index Order Indices of Nodes in Face 1 2 3 1 3 1 9 5 2 3 1 6 11 3 3 3 5 10 4 3 3 12 6 5 3 2 7 9 6 3 2 11 8 7 3 4 10 7 8 3 4 8 12 9 3 1 11 9 10 3 2 9 11 11 3 3 10 12 12 3 4 12 10 13 3 1 5 3 14 3 1 3 6 15 3 2 4 7 16 3 2 8 4 17 3 5 9 7 18 3 5 7 10 19 3 6 8 11 20 3 6 12 8 TEST025: ELLIPSE_POINT_DIST_2D is given a point P, and finds the distance to an ellipse in 2D. The ellipse is (X/R1)^2 + (Y/R2)^2 = 1 R1 = 3 R2 = 2 P DIST -1.2 3.9 2.0123599 -0.8 3.6 1.6524391 -0.4 3.3 1.3137926 0 3 1 0.4 2.7 0.71538639 0.8 2.4 0.46536327 1.2 2.1 0.25700337 1.6 1.8 0.099981989 2 1.5 0.007981287 2.4 1.2 4.4408921e-16 2.8 0.9 0.097826614 3.2 0.6 0.31149917 3.6 0.3 0.62308574 4 0 1 4.4 -0.3 1.4164009 4.8 -0.6 1.8568115 5.2 -0.9 2.3124652 ELLIPSE_AREA1_TEST C++ version ELLIPSE_AREA1 computes the area of an ellipse. R = 10 Matrix A in ellipse definition x*A*x=r^2 Col: 1 2 Row 1: 5 1 2: 1 2 Area = 104.71976 ELLIPSE_AREA1_TEST Normal end of execution. ELLIPSE_AREA2_TEST C++ version ELLIPSE_AREA2 computes the area of an ellipse. Ellipse: 5 * x^2 + 2 * xy + 2 * y^2 = 10 Area = 104.71976 ELLIPSE_AREA2_TEST Normal end of execution. ELLIPSE_AREA3_TEST C++ version ELLIPSE_AREA3 computes the area of an ellipse. Ellipse: (x/10)^2 + (y/3.3333333)^2 = 1 Area = 104.71976 ELLIPSE_AREA3_TEST Normal end of execution. ELLIPSE_POINT_NEAR_2D_TEST: ELLIPSE_POINT_NEAR_2D is given a point P, and finds the nearest point on an ellipse in 2D. The ellipse is (X/R1)^2 + (Y/R2)^2 = 1 R1 = 3 R2 = 2 P PN -1.2 3.9 -0.8236892 1.9231382 -0.8 3.6 -0.58346085 1.9618102 -0.4 3.3 -0.30940107 1.989335 0 3 1.8369702e-16 2 0.4 2.7 0.34495788 1.9867342 0.8 2.4 0.72389782 1.9409015 1.2 2.1 1.1325918 1.8519942 1.6 1.8 1.5623343 1.7073841 2 1.5 1.9959235 1.4931383 2.4 1.2 2.4 1.2 2.8 0.9 2.71979 0.84399638 3.2 0.6 2.9086973 0.48966204 3.6 0.3 2.9842177 0.20487896 4 0 3 0 4.4 -0.3 2.9920269 -0.14571639 4.8 -0.6 2.9760507 -0.25220995 5.2 -0.9 2.9581993 -0.33270382 TEST026 ELLIPSE_POINTS_2D returns points on an ellipse; POLYGON_AREA_2D finds the area of a polygon. Ellipse center: 0: 5 1: -2 radii R1 = 3 R2 = 1 and angle PSI = 0.52359878 and area = 9.424778 Sample points: Row: 1 2 Col 1: 7.5980762 -0.5 2: 7.2089677 -0.28276713 3: 6.4835639 -0.32696739 4: 5.532301 -0.62587171 5: 4.5 -1.1339746 6: 3.5438195 -1.773922 7: 2.8093293 -2.4482877 8: 2.4083488 -3.0544057 9: 2.4019238 -3.5 10: 2.7910323 -3.7172329 11: 3.5164361 -3.6730326 12: 4.467699 -3.3741283 13: 5.5 -2.8660254 14: 6.4561805 -2.226078 15: 7.1906707 -1.5517123 16: 7.5916512 -0.94559428 For any N, the sampled points define a polygon whose area approximates the ellipse area. N Area 3 3.8971143 4 6 5 7.1329239 6 7.7942286 7 8.2092306 8 8.4852814 9 8.6776327 10 8.8167788 11 8.9205735 12 9 13 9.0621019 14 9.1115585 15 9.1515745 16 9.1844024 17 9.2116625 18 9.2345439 19 9.2539349 20 9.2705098 21 9.284788 22 9.2971744 23 9.3079886 24 9.3174856 ELLIPSE_POINTS_ARC_2D_TEST ELLIPSE_POINTS_ARC_2D returns points on an elliptical arc. The ellipse has center 5 -2 radii R1 = 3 R2 = 1 and angle PSI = 0.52359878 The arc extends from THETA1 = 1.5707963 to THETA2 = 6.2831853 Sample points: Row: 1 2 Col 1: 4.5 -1.1339746 2: 3.5438195 -1.773922 3: 2.8093293 -2.4482877 4: 2.4083488 -3.0544057 5: 2.4019238 -3.5 6: 2.7910323 -3.7172329 7: 3.5164361 -3.6730326 8: 4.467699 -3.3741283 9: 5.5 -2.8660254 10: 6.4561805 -2.226078 11: 7.1906707 -1.5517123 12: 7.5916512 -0.94559428 13: 7.5980762 -0.5 HALFPLANE_CONTAINS_POINT_2D_TEST HALFPLANE_CONTAINS_POINT_2D determines whether a halfplane bounded by PA:PB contains the point P. P1 = 0 0 P2 = 2 0 P = 1 1 Contains? = 1 Correct = 1 P1 = 0 0 P2 = 2 0 P = 1 -1 Contains? = 0 Correct = 0 P1 = -5 -5 P2 = 10 10 P = -1 1 Contains? = 1 Correct = 1 P1 = 3 150 P2 = 1 50 P = 2 200 Contains? = 0 Correct = 0 TEST029 HALFSPACE_IMP_TRIANGLE_INT_3D finds intersection points of an implicit halfspace and a triangle. The implicitly defined bounding plane has the form: A*X + B*Y + C*Z + D = 0. A,B,C,D = 1 -2 -3 6 Case 0 Triangle vertices: Row: 1 2 3 Col 1: 0 0 0 2: 0 -1 0 3: 0 0 -2 Number of intersection points is 0 Case 1 Triangle vertices: Row: 1 2 3 Col 1: -6 0 0 2: 0 -1 0 3: 0 0 -2 Number of intersection points is 1 0 -6 0 0 Case 2 Triangle vertices: Row: 1 2 3 Col 1: 0 0 0 2: 0 3 0 3: 0 0 2 Number of intersection points is 2 0 0 3 0 1 0 0 2 Case 3 Triangle vertices: Row: 1 2 3 Col 1: -6 0 0 2: 0 4 0 3: 0 0 3 Number of intersection points is 3 0 -6 0 0 1 0 4 0 2 0 0 3 Case 4 Triangle vertices: Row: 1 2 3 Col 1: -8 0 0 2: 0 -1 0 3: 0 0 -2 Number of intersection points is 3 0 -8 0 0 1 -6.4 -0.2 0 2 -6.8571429 0 -0.28571429 Case 5 Triangle vertices: Row: 1 2 3 Col 1: 0 0 0 2: 0 4 0 3: 0 0 4 Number of intersection points is 4 0 0 3 0 1 0 4 0 2 0 0 4 3 0 0 2 TEST030 HALFSPACE_NORM_TRIANGLE_INT_3D finds intersection points of a normal form halfspace and a triangle. A point on the plane: 0: -6 1: 0 2: 0 The normal vector: 0: 2 1: -4 2: -6 Case 0 Triangle vertices: Row: 1 2 3 Col 1: 0 0 0 2: 0 -1 0 3: 0 0 -2 Number of intersection points is 1 0 0 0 0 Case 1 Triangle vertices: Row: 1 2 3 Col 1: -6 0 0 2: 0 -1 0 3: 0 0 -2 Number of intersection points is 3 0 -6 0 0 1 -1.5 -0.75 0 2 -3 0 -1 Case 2 Triangle vertices: Row: 1 2 3 Col 1: 0 0 0 2: 0 3 0 3: 0 0 2 Number of intersection points is 3 0 0 0 0 1 0 3 0 2 0 0 2 Case 3 Triangle vertices: Row: 1 2 3 Col 1: -6 0 0 2: 0 4 0 3: 0 0 3 Number of intersection points is 3 0 -6 0 0 1 0 4 0 2 0 0 3 Case 4 Triangle vertices: Row: 1 2 3 Col 1: -8 0 0 2: 0 -1 0 3: 0 0 -2 Number of intersection points is 3 0 -8 0 0 1 -1.6 -0.8 0 2 -3.4285714 0 -1.1428571 Case 5 Triangle vertices: Row: 1 2 3 Col 1: 0 0 0 2: 0 4 0 3: 0 0 4 Number of intersection points is 3 0 0 0 0 1 0 4 0 2 0 0 4 TEST031 HAVERSINE computes the haversine of an angle. Degrees Radians Haversine 0 0 0 30 0.52359878 0.066987298 60 1.0471976 0.25 90 1.5707963 0.5 120 2.0943951 0.75 150 2.6179939 0.9330127 180 3.1415927 1 210 3.6651914 0.9330127 240 4.1887902 0.75 270 4.712389 0.5 300 5.2359878 0.25 330 5.7595865 0.066987298 360 6.2831853 0 TEST0315 HEXAGON_CONTAINS_POINT_2D reports if a hexagon contains a point. We will call the function repeatedly, and draw a sketch of an irregular hexagon in the unit square. ---------------------------------------- ---------------***---------------------- --------------*****--------------------- -------------********------------------- ------------**********------------------ -----------*************---------------- ----------***************--------------- ---------******************------------- --------********************------------ --------**********************---------- --------***********************--------- --------*************************------- --------**************************------ --------****************************---- --------*****************************--- --------*******************************- --------*******************************- --------*******************************- --------*******************************- --------******************************-- --------******************************-- --------******************************-- --------*****************************--- --------*****************************--- ---------****************************--- ----------**************************---- -----------*************************---- ------------************************---- -------------**********************----- --------------*********************----- ---------------********************----- ----------------******************------ ------------------****************------ --------------------**************------ ----------------------***********------- ------------------------*********------- --------------------------*******------- ----------------------------****-------- ------------------------------**-------- ---------------------------------------- TEST032 HEXAGON_SHAPE_2D: points on a unit hexagon. Angle X Y -10 0.90760373 -0.16003503 0 1 0 10 0.90760373 0.16003503 20 0.82635182 0.30076747 30 0.75 0.4330127 40 0.67364818 0.56525794 50 0.59239627 0.70599038 60 0.5 0.8660254 70 0.31520747 0.8660254 80 0.15270364 0.8660254 90 5.3028762e-17 0.8660254 100 -0.15270364 0.8660254 110 -0.31520747 0.8660254 120 -0.5 0.8660254 130 -0.59239627 0.70599038 140 -0.67364818 0.56525794 150 -0.75 0.4330127 160 -0.82635182 0.30076747 170 -0.90760373 0.16003503 180 -1 1.2246468e-16 190 -0.90760373 -0.16003503 200 -0.82635182 -0.30076747 210 -0.75 -0.4330127 220 -0.67364818 -0.56525794 230 -0.59239627 -0.70599038 240 -0.5 -0.8660254 250 -0.31520747 -0.8660254 260 -0.15270364 -0.8660254 270 -1.5908629e-16 -0.8660254 280 0.15270364 -0.8660254 290 0.31520747 -0.8660254 300 0.5 -0.8660254 310 0.59239627 -0.70599038 320 0.67364818 -0.56525794 330 0.75 -0.4330127 340 0.82635182 -0.30076747 350 0.90760373 -0.16003503 360 1 0 370 0.90760373 0.16003503 TEST0321 HEXAGON_VERTICES_2D: the vertices of the unit hexagon. Vertices: Row: 1 2 Col 1: 1 0 2: 0.5 0.8660254 3: -0.5 0.8660254 4: -1 0 5: -0.5 -0.8660254 6: 0.5 -0.8660254 TEST0322 I4COL_FIND_ITEM finds the first occurrence of an item in an integer array of columns. The matrix of columns: Col: 1 2 3 4 Row 1: 11 12 13 14 2: 21 22 23 24 3: 31 32 33 34 4: 41 42 43 44 5: 51 52 53 54 Item 34 occurs in row 3 and column 4 Item 12 occurs in row 1 and column 2 Item 90 occurs in row -1 and column -1 TEST0323 I4COL_FIND_PAIR_WRAP finds the first occurrence of a pair of item in an integer array of columns. Items in the array are ordered by column, and wraparound is allowed. The matrix of columns: Col: 1 2 3 4 Row 1: 11 12 13 14 2: 21 22 23 24 3: 31 32 33 34 4: 41 42 43 44 5: 51 52 53 54 Item 22 followed by item 32 occurs in row 2 and column 2 Item 32 followed by item 22 occurs in row -1 and column -1 Item 22 followed by item 23 occurs in row -1 and column -1 Item 54 followed by item 14 occurs in row 5 and column 4 Item 54 followed by item 11 occurs in row -1 and column -1 TEST0325 For the icosahedron, ICOS_SIZE returns dimension information; ICOS_SHAPE returns face and order information. SHAPE_PRINT_3D prints this information. Number of vertices: 12 Number of edges : 30 Number of faces : 20 Maximum face order: 3 SHAPE_PRINT_3D Information about a polytope. The number of vertices is 12 Vertices: Index X Y Z 1 0.85065081 0.52573111 0 2 0.85065081 -0.52573111 0 3 0.52573111 0 0.85065081 4 0.52573111 0 -0.85065081 5 0 0.85065081 0.52573111 6 0 0.85065081 -0.52573111 7 0 -0.85065081 0.52573111 8 0 -0.85065081 -0.52573111 9 -0.52573111 0 0.85065081 10 -0.52573111 0 -0.85065081 11 -0.85065081 0.52573111 0 12 -0.85065081 -0.52573111 0 The number of faces is 20 The maximum order of any face is 3 Index Order Indices of Nodes in Face 1 2 3 1 3 1 2 4 2 3 1 3 2 3 3 1 4 6 4 3 1 5 3 5 3 1 6 5 6 3 2 3 7 7 3 2 7 8 8 3 2 8 4 9 3 3 5 9 10 3 3 9 7 11 3 4 8 10 12 3 4 10 6 13 3 5 6 11 14 3 5 11 9 15 3 6 10 11 16 3 7 9 12 17 3 7 12 8 18 3 8 12 10 19 3 9 11 12 20 3 10 12 11 TEST0327 LINE_EXP_NORMAL_2D determines a unit normal vector to a given explicit line. Point 1: 0: 1 1: 3 Point 2: 0: 4 1: 0 Normal vector N: 0: 0.70710678 1: 0.70710678 LINE_EXP_PERP_2D_TEST LINE_EXP_PERP_2D is given an explicit line (P1,P2), and another point P3. It then finds a point P4 on (P1,P2) so that (P1,P2) is perpendicular to (P3,P4). Point P1: 0: 1 1: 3 Point P2: 0: 4 1: 0 Point P3: 0: 0 1: 0 Point P4: 0: 2 1: 2 Point P3: 0: 5 1: -1 Point P4: 0: 5 1: -1 Point P3: 0: 5 1: 3 Point P4: 0: 3 1: 1 LINE_EXP_POINT_DIST_2D_TEST LINE_EXP_POINT_DIST_2D finds the distance from an explicit line to a point in 2D. Point 1: 0: 1 1: 3 Point 2: 0: 4 1: 0 Point: 0: 0 1: 0 Distance = 2.8284271 Point: 0: 5 1: -1 Distance = 0 Point: 0: 5 1: 3 Distance = 2.8284271 TEST0336 LINE_EXP_POINT_DIST_3D finds the distance from an explicit line to a point in 3D. Point 1: 0: 1 1: 3 2: 2 Point 2: 0: 4 1: 0 2: 1 Point: 0: 0 1: 0 2: 2 Distance = 2.8469744 Point: 0: 5 1: -1 2: 1 Distance = 0.32444284 Point: 0: 5 1: 3 2: 3 Distance = 3.2606102 TEST0337 LINE_EXP_POINT_DIST_SIGNED_2D finds the signed distance to a point from an explicit line. Point 1: 0: 1 1: 3 Point 2: 0: 4 1: 0 Point: 0: 0 1: 0 Signed distance = 2.8284271 Point: 0: 5 1: -1 Signed distance = 0 Point: 0: 5 1: 3 Signed distance = -2.8284271 TEST034 LINE_EXP_POINT_NEAR_2D finds the point on a line nearest in point in 2D. The point P1: 0: 1 1: 3 The point P2: 0: 4 1: 0 The point P: 0: 0 1: 0 Nearest point PN: 0: 2 1: 2 Distance = 2.8284271 Relative line position T = 0.33333333 The point P: 0: 5 1: -1 Nearest point PN: 0: 5 1: -1 Distance = 0 Relative line position T = 1.3333333 The point P: 0: 5 1: 3 Nearest point PN: 0: 3 1: 1 Distance = 2.8284271 Relative line position T = 0.66666667 TEST0345 LINE_EXP2IMP_2D converts explicit to implicit lines. LINE_IMP2EXP_2D converts implicit to explicit lines. Implicit line A = 1 B = 2 C = 3 The point P1: 0: -0.6 1: -1.2 The point P2: 0: -1.2 1: -0.9 Recovered implicit line A = 0.3 B = 0.6 C = 0.9 TEST0346 LINE_EXP2PAR_2D converts explicit to parametric lines. LINE_PAR2EXP_2D converts parametric to explicit lines. Parametric line: F = 1 G = 2 X0 = 3 Y0 = 4 The point P1: 0: 3 1: 4 The point P2: 0: 4 1: 6 Recovered parametric line: F = 0.4472136 G = 0.89442719 X0 = 3 Y0 = 4 LINE_IMP_POINT_DIST_2D_TEST LINE_IMP_POINT_DIST_2D finds the distance from a point P to a line A * X + B * Y + C = 0. X Y A B C DIST 0 6 2 5 3 6.1279462 0 5 2 5 3 5.1994695 0 4 2 5 3 4.2709928 TEST0351 LINE_PAR_POINT_NEAR_2D finds the point on a parametric line (X0,Y0,F,G) nearest a point P in 2D. Parametric line: X(t) = 1 + 1 * t Y(t) = 3 + -1 * t The point P: 0: 0 1: 0 Distance = 2.8284271 Nearest point PN: 0: 2 1: 2 Distance recomputed = 2.8284271 The point P: 0: 5 1: -1 Distance = 0 Nearest point PN: 0: 5 1: -1 Distance recomputed = 0 The point P: 0: 5 1: 3 Distance = 2.8284271 Nearest point PN: 0: 3 1: 1 Distance recomputed = 2.8284271 TEST0352 LINE_PAR_POINT_DIST_3D finds the distance from a parametric line to a point in 3D. Parametric line: X(t) = 1 + 3 * t Y(t) = 3 + -3 * t Z(t) = 2 + -1 * t The point P: 0: 0 1: 0 2: 2 Distance = 2.8469744 Nearest point PN: 0: 1.9473684 1: 2.0526316 2: 1.6842105 Distance recomputed = 2.8469744 The point P: 0: 5 1: -1 2: 1 Distance = 0.32444284 Nearest point PN: 0: 4.9473684 1: -0.94736842 2: 0.68421053 Distance recomputed = 0.32444284 The point P: 0: 5 1: 3 2: 3 Distance = 3.2606102 Nearest point PN: 0: 2.7368421 1: 1.2631579 2: 1.4210526 Distance recomputed = 3.2606102 TEST038 LINES_EXP_ANGLE_3D finds the angle between two explicit lines in 3D; Angle between lines is 1.8925469 LINES_EXP_ANGLE_3D - Warning! One of the lines is degenerate! Angle between lines is inf TEST0385 LINES_EXP_DIST_3D finds the distance between two explicit lines in 3D; LINES_EXP_DIST_3D_2 finds the distance between two explicit lines in 3D; P1: 0 0 0 P2: 1 2 0 Q1: 0 3 3 Q2: 3 0 3 LINES_EXP_DIST_3D = 3 LINES_EXP_DIST_3D_2 = 3 P1: 4 -3 0 P2: -8 6 0 Q1: 3 4 -1 Q2: 3 4 3 LINES_EXP_DIST_3D = 5 LINES_EXP_DIST_3D_2 = 5 TEST03855 LINES_EXP_NEAR_3D finds nearest points on two explicit lines in 3D; P1: 0 0 0 P2: 1 2 0 Q1: 0 3 3 Q2: 3 0 3 PN: 1 2 0 QN: 1 2 3 P1: 4 -3 0 P2: -8 6 0 Q1: 3 4 -1 Q2: 3 4 3 PN: 0 0 0 QN: 3 4 0 TEST0386 LINES_EXP_EQUAL_2D tries to determine if two explicit lines in 2D are equal; P1: 0 0 P2: 1 2 Q1: 0 0 Q2: 1 2 The lines are equal. P1: 0 0 P2: 1 2 Q1: 1 2 Q2: 0 0 The lines are equal. P1: 0 0 P2: 1 2 Q1: 0 0 Q2: 2 4 The lines are equal. P1: 0 0 P2: 1 2 Q1: 7 14 Q2: 5.5 11 The lines are equal. P1: 0 0 P2: 1 2 Q1: 1 2 Q2: 3 5 The lines are distinct. P1: 0 0 P2: 1 2 Q1: 0 10 Q2: 1 12 The lines are distinct. LINES_EXP_INT_2D_TEST LINES_EXP_INT_2D finds intersections of two explicit lines in 2D; P1: 0 0 P2: 4 0 Q1: 0 -1 Q2: 1 0 Intersection at 1 0 P1: 0 2 P2: 4 0 Q1: 0 0.25 Q2: 0.5 0 Lines are parallel, no intersection. P1: 0 2 P2: 4 0 Q1: 0 2 Q2: 4 0 Lines are coincident. TEST040 For two lines written in implicit form: LINES_IMP_ANGLE_2D finds the angle; Line 1 coefficients: 1 2 -4 Line 2 coefficients: 1 -1 -1 Angle between lines is 108.43495 Line 1 coefficients: 1 2 -4 Line 2 coefficients: 2 4 -1 Angle between lines is 1.2074183e-06 Line 1 coefficients: 1 2 -4 Line 2 coefficients: -3 -6 12 Angle between lines is 180 TEST041 LINES_IMP_DIST_3D finds the distance between two implicit lines in 2D. A1 B1 C1 A2 B2 C2 DIST 4 -1 3 4 -1 12 2.1828206 2 -1 0 4 -2 6 1.3416408 1 2 2 2 3 1 0 TEST0415 For two lines written in implicit form: LINES_IMP_INT_2D finds the intersection. Line 1 coefficients: 1 2 -4 Line 2 coefficients: 1 -1 -1 Intersection at 2 1 Line 1 coefficients: 1 2 -4 Line 2 coefficients: 2 4 -1 Lines are parallel, no intersection. Line 1 coefficients: 1 2 -4 Line 2 coefficients: -3 -6 12 Lines are coincident. TEST0416 LINES_PAR_INT_2D finds the intersection of two lines written in parametric form. Line 1 parameters: 0 1 2 1 Line 2 parameters: 10 -2 1 1 Line 1 evaluated at T1: T1 = 13 X(T1)= 26 Y(T1)= 14 Line 2 evaluated at T2: T2 = 16 X(T2)= 26 Y(T2)= 14 Reported intersection PINT: 26 14 TEST0418 SEGMENTS_CURVATURE_2D computes the local curvature defined by the line segments [P1,P2] and [P2,P3]. Our three points are: P1 = (0,0) P2 = (1,0) P3 = (C,S) C = cosine ( theta), S = sine ( theta ). Test Theta Curvature 1 0 2 2 30 1.9318517 3 60 1.7320508 4 90 1.4142136 5 120 1 6 150 0.51763809 7 180 1.2246468e-16 8 210 0.51763809 9 240 1 10 270 1.4142136 11 300 1.7320508 12 330 1.9318517 13 360 2 TEST042 SEGMENTS_DIST_2D computes the distance between line segments in 2D. Same slope, different intercepts. P1: 2 3 P2: 8 6 Q1: 8 3 Q2: 14 6 Distance = 2.6832816 Same slope, same intercepts, overlapping. Distance should be 0. P1: 2 3 P2: 8 6 Q1: 4 4 Q2: 14 9 Distance = 0 Same slope, same intercepts, disjoint. Distance should be sqrt(45)=6.7082038 P1: 2 3 P2: 8 6 Q1: 14 9 Q2: 16 10 Distance = 6.7082039 Different slopes, intersecting. Distance should be 0. P1: 2 3 P2: 8 6 Q1: 0 8 Q2: 5 3 Distance = 0 Different slopes, not intersecting. P1: 2 3 P2: 8 6 Q1: 7 3 Q2: 9 -1 Distance = 2.236068 Simple problem. Distance should be 0. P1: 57 53 P2: 58 53 Q1: 65 45 Q2: 57 53 Distance = 0 Same data, translated by 50. Distance should be 0. P1: 7 3 P2: 8 3 Q1: 15 -5 Q2: 7 3 Distance = 0 Diagonal and horizontal. Distance should be sqrt(2500/2)=35.355339 P1: 0 0 P2: 100 100 Q1: 50 0 Q2: 60 0 Distance = 35.355339 Same data, except first segment extended. Distance should be sqrt(2500/2)=35.355339 P1: -10 -10 P2: 100 100 Q1: 50 0 Q2: 60 0 Distance = 35.355339 TEST043 SEGMENTS_DIST_3D computes the distance between two line segments in 3D. Case Computed True 0 1 1 1 5 5 2 0 0 3 3 3 4 0 0 5 1 1 6 3 3 7 1 1 8 10 10 9 4 4 TEST044 SEGMENTS_INT_1D determines the intersection [R1,R2] of line segments [P1,P2] and [Q1,Q2] in 1D. DIST is negative for overlap, 0 for point intersection, positive if there is no overlap. Test P1 P2 Q1 Q2 R1 R2 DIST 0 -1 1 -1 1 -1 1 -2 1 -1 1 3 2 2 1 1 2 -1 1 1 2 1 1 0 3 -1 1 0.5 -3 -1 0.5 -1.5 4 -1 1 0.25 0.5 0.25 0.5 -0.25 5 -1 1 0.5 0.5 0.5 0.5 0 6 -1 1 2 2 2 1 1 TEST045 SEGMENTS_INT_2D searches for an intersection of two line segments in 2D. All tests use the same line segment 1: P1: -1 3 P2: 1 1 Q1: -1 1 Q2: 1 -1 The line segments do not intersect. Q1: 3 -1 Q2: 2 0 The line segments do not intersect. Q1: 0 0 Q2: 0 9 The line segments intersect at: -0 2 Q1: 1 2 Q2: 3 2 The line segments do not intersect. TEST046 MINABS finds the minimum of a function F(X) = a * ABS ( X ) + B within an interval, given three data points. The points lie on a straight line. XMIN = 9 YMIN = 2 The points straddle a minimum. XMIN = 7 YMIN = 2 The points straddle a maximum. XMIN = 2 YMIN = 5 TEST047 MINQUAD finds the minimum of a function F(X) = A * X^2 + B * X + C within an interval, given three data points. The minimum lies in the interval. X1, Y1 = 0 5 X2, Y2 = 2 5 X3, Y3 = 3 8 XMIN = 1 YMIN = 4 The minimum is to the left of the interval X1, Y1 = 2 5 X2, Y2 = 4 13 X3, Y3 = 5 20 XMIN = 2 YMIN = 5 The function is flat. X1, Y1 = 11 6 X2, Y2 = 6 6 X3, Y3 = 2 6 XMIN = 11 YMIN = 6 The function has a maximum. X1, Y1 = 0 3 X2, Y2 = 2 3 X3, Y3 = 3 0 XMIN = 3 YMIN = 0 TEST0475 For the octahedron, OCTAHEDRON_SIZE_3D returns dimension information; OCTAHEDRON_SHAPE_3D returns face and order information. SHAPE_PRINT_3D prints this information. Number of vertices: 6 Number of edges : 12 Number of faces : 8 Maximum face order: 3 SHAPE_PRINT_3D Information about a polytope. The number of vertices is 6 Vertices: Index X Y Z 1 0 0 -1 2 0 -1 0 3 1 0 0 4 0 1 0 5 -1 0 0 6 0 0 1 The number of faces is 8 The maximum order of any face is 3 Index Order Indices of Nodes in Face 1 2 3 1 3 1 3 2 2 3 1 4 3 3 3 1 5 4 4 3 1 2 5 5 3 2 3 6 6 3 3 4 6 7 3 4 5 6 8 3 5 2 6 TEST0477 PARALLELOGRAM_AREA_2D finds the area of a parallelogram in 2D. Vertices: Row: 1 2 Col 1: 2 7 2: 5 7 3: 6 9 4: 3 9 AREA = 6 TEST0478 PARALLELOGRAM_AREA_3D finds the area of a parallelogram in 3D. Vertices: Row: 1 2 3 Col 1: 1 2 3 2: 2.4142137 3.4142137 3 3: 1.7071068 2.7071068 4 4: 0.2928931 0.2928931 4 AREA = 2.0000002 PARALLELOGRAM_CONTAINS_POINT_2D_TEST PARALLELOGRAM_CONTAINS_POINT_2D determines if a point is within a parallelogram in 2D. P Inside? 1 0.5 1 2 0 0 0.5 -0.1 0 0.1 0.5 0 PARALLELOGRAM_CONTAINS_POINT_2D_TEST2 PARALLELOGRAM_CONTAINS_POINT_2D reports if a parallelogram contains a point. We will call the function repeatedly, and draw a sketch of the unit square. --------------------------------------------------- ---------------------------------------*----------- --------------------------------------**----------- -------------------------------------**------------ ------------------------------------***------------ -----------------------------------****------------ ----------------------------------****------------- ---------------------------------*****------------- --------------------------------******------------- -------------------------------******-------------- -------------------------------******-------------- -----------------------------********-------------- ----------------------------********--------------- ---------------------------*********--------------- --------------------------**********--------------- --------------------------**********--------------- -------------------------**********---------------- -----------------------************---------------- ----------------------************----------------- ----------------------************----------------- --------------------**************----------------- --------------------*************------------------ --------------------*************------------------ --------------------*************------------------ -------------------*************------------------- -------------------*************------------------- -------------------*************------------------- ------------------**************------------------- ------------------*************-------------------- -----------------**************-------------------- -----------------**************-------------------- -----------------*************--------------------- ----------------************----------------------- ----------------***********------------------------ ----------------**********------------------------- ----------------*********-------------------------- ---------------**********-------------------------- ---------------********---------------------------- --------------********----------------------------- --------------********----------------------------- --------------******------------------------------- -------------******-------------------------------- -------------******-------------------------------- -------------****---------------------------------- -------------***----------------------------------- ------------****----------------------------------- ------------**------------------------------------- ------------*-------------------------------------- -----------**-------------------------------------- -----------*--------------------------------------- ----------*---------------------------------------- PARALLELOGRAM_CONTAINS_POINT_3D_TEST PARALLELOGRAM_CONTAINS_POINT_3D determines if a point is within a parallelogram in 3D. P Inside? 1 1 0.5 1 3 3 0 0 0.5 0.5 -0.1 0 0.1 0.1 0.5 0 1.5 1.6 0.5 0 TEST0493 PARABOLA_EX finds the extreme value of a parabola determined by three points. PARABOLA_EX2 finds the extreme value of a parabola determined by three points. Parabolic coefficients (A,B,C) = 2 -4 10 X, Y data: X1, Y1 = 1 8 X2, Y2 = 2 10 X3, Y3 = 3 16 PARABOLA_EX returns (XMIN,YMIN) = 1 8 PARABOLA_EX2 returns (XMIN,YMIN) = 1 8 and (A,B,C) = 2 -4 10 TEST0495 PARALLELEPIPED_POINT_DIST_3D computes the distance from a point to a box (parallelipiped) in 3D. The 4 box corners that are specified: 0 0 0 2 0 0 0 8 0 0 0 1 TEST P Distance to box 0 1 4 0.5 1.118034 1 1 0 0.5 0 2 0 4 1 0 3 2 8 1 0 4 -0.5 4 0.5 0.70710678 5 1 -1 -1 1.4142136 6 3 9 2 1.7320508 PLANE_EXP_NORMAL_3D_TEST PLANE_EXP_NORMAL_3D finds the normal to a plane. Coordinates of 3 points: P1 = -10.56 -10.56 78.09 P2 = 44.66 -65.77 0 P3 = 44.66 44.66 0 Unit normal vector: PN = 0.81648657 0 0.57736443 TEST051 PLANE_EXP2IMP_3D puts a plane defined by 3 points into A*X+B*Y+C*Z+D = 0 form. Input: P1 = -1 0 -1 P2 = -4 0 0 P3 = -20 2 4 Output: (A,B,C,D)= -2 -4 -6 -8 Correct answer is a multiple of 1, 2, 3, 4. Input: P1 = -16 2 4 P2 = 0 0 0 P3 = 4 -2 0 Output: (A,B,C,D)= -8 -16 -24 0 Correct answer is a multiple of 1, 2, 3, 0. TEST052 PLANE_EXP2NORMAL_3D puts a plane defined by 3 points into point, normal form Input: P1 = -1 0 -1 P2 = -4 0 0 P3 = -20 2 4 Output: PP = -1 0 -1 PN = -0.26726124 -0.53452248 -0.80178373 P1: -16 2 4 P2: 0 0 0 P3: 4 -2 0 Output: PP = -16 2 4 PN = -0.26726124 -0.53452248 -0.80178373 TEST053 PLANE_EXP_PROJECT_3D projects a point through a focus point into a plane. PO PP IVIS 0 2 2 0 0.5 0.5 3 4 5 -8 4 5 -8 3 0.25 0.25 0.25 0.33333333 0.33333333 0.33333333 1 5 -2 -3 7.6478035e+15 -3.0591214e+15 -4.5886821e+15 1 -2 0 0 1 0 0 -1 TEST054 PLANE_IMP2EXP_3D converts a plane in implicit (A,B,C,D) form to explicit form. A = 1 B = -2 C = -3 D = 6 P1: -6 0 0 P2: -6 -0.83205029 0.5547002 P3: -6.9636241 -0.14824986 -0.22237479 PLANE_IMP2NORMAL_3D_TEST PLANE_IMP2NORMAL_3D converts a plane in implicit (A,B,C,D) form to point, normal form. A = 1 B = -2 C = -3 D = 6 PP = -6 0 0 PN = 0.26726124 -0.53452248 -0.80178373 PLANE_IMP_LINE_PAR_INT_3D_TEST PLANE_IMP_LINE_PAR_INT_3D finds the intersection of an implicit plane and a parametric line, in 3D. The plane and line intersect at 7 2 3 Expected answer: The plane and line intersect at 7, 2, 3. TEST057 PLANE_IMP_SEGMENT_NEAR_3D finds the point on a line segment nearest a plane. The distance between the plane and the line segment is 0 A nearest point on the line segment is PLS = 7 2 3 A nearest point on the plane is PP = 7 2 3 The distance between the plane and the line segment is 4.0089186 A nearest point on the line segment is PLS = 5 1 -2 A nearest point on the plane is PP = 3.9285714 3.1428571 1.2142857 TEST058 PLANE_IMP_POINT_DIST_3D computes the distance between an implicit plane and a point in 3D; PLANE_IMP_POINT_DIST_SIGNED 3D computes the signed distance between an implicit plane and a point in 3D. For all tests, we use the implicit plane with (A,B,C,D) = 0 0 1 -10 P DISTANCE SIGNED_DISTANCE -12 14 0 10 -10 7 8 9 1 -1 1 2 10 0 0 0 0 12 2 2 TEST059 PLANE_IMP_TRIANGLE_NEAR_3D finds the nearest points on an implicit plane and a triangle. Implicit plane: A*X + B*Y + C*Z + D = 0. A = 1 B = -2 C = -3 D = 6 Triangle vertices: Row: 1 2 3 Col 1: 3 0 -7 2: 13 -4 -1 3: 0 0 0 Triangle to plane distance is 1.6035675 Nearest points: Row: 1 2 3 Col 1: 0 0 0 2: -0.42857143 0.85714286 1.2857143 3: 0 0 0 4: -0.42857143 0.85714286 1.2857143 Triangle vertices: Row: 1 2 3 Col 1: 3 0 -7 2: 13 -4 -1 3: 5 1 -2 Triangle to plane distance is 4.0089186 Nearest points: Row: 1 2 3 Col 1: 5 1 -2 2: 3.9285714 3.1428571 1.2142857 3: 5 1 -2 4: 3.9285714 3.1428571 1.2142857 TEST060 PLANE_IMP_TRIANGLE_INT_3D finds the intersection points of an implicit plane and a triangle. The implicit plane: A*X + B*Y + C*Z + D = 0. (A,B,C,D) = 1 -2 -3 6 Case 0 Triangle vertices: Row: 1 2 3 Col 1: 3 0 -7 2: 13 -4 -1 3: 5 1 -2 Number of intersection points is 0 Case 1 Triangle vertices: Row: 1 2 3 Col 1: 3 0 -7 2: 13 -4 -1 3: 9 3 8 Number of intersection points is 2 1 7 2 3 2 10.333333 0.66666667 5 Case 2 Triangle vertices: Row: 1 2 3 Col 1: -6 0 0 2: 0 3 0 3: 0 0 2 Number of intersection points is 3 1 -6 0 0 2 0 3 0 3 0 0 2 Case 3 Triangle vertices: Row: 1 2 3 Col 1: -4 1 0 2: 0 6 -2 3: 0 0 1 Number of intersection points is 2 1 -4 1 0 2 0 6 -2 TEST061 PLANE_NORMAL_BASIS_3D, given a plane in point, normal form (P,N), finds two unit vectors Q and R that lie in the plane and are mutually orthogonal. Data for first case: PP = 0.2184183 0.95631758 0.82950923 PN = 0.56169544 0.41530708 0.066118735 PQ = -0.59452148 0.80407973 0 PR = -0.075767885 -0.056021354 0.99555052 Dot product matrix: Col: 1 2 3 Row 1: 0.49235343 5.5511151e-17 1.3877788e-17 2: 5.5511151e-17 1 -6.9388939e-18 3: 1.3877788e-17 -6.9388939e-18 1 Dot product matrix: Col: 1 2 3 Row 1: 0.60780805 0 0 2: 0 1 -6.9388939e-18 3: 0 -6.9388939e-18 1 Dot product matrix: Col: 1 2 3 Row 1: 0.92854412 5.5511151e-17 -8.1315163e-20 2: 5.5511151e-17 1 -1.0842022e-19 3: -8.1315163e-20 -1.0842022e-19 1 Dot product matrix: Col: 1 2 3 Row 1: 0.72223544 0 1.7347235e-18 2: 0 1 0 3: 1.7347235e-18 0 1 Dot product matrix: Col: 1 2 3 Row 1: 0.8721459 -5.5511151e-17 0 2: -5.5511151e-17 1 0 3: 0 0 1 TEST0615 PLANE_NORMAL_LINE_EXP_INT_3D finds the intersection of a normal plane and an explicit line, in 3D. Plane point PP: 0: -1 1: 1 2: 1 Plane Normal: 0: 0.26726124 1: -0.53452248 2: -0.80178373 Line point P1: 0: 3 1: 0 2: -7 Line point P2: 0: 5 1: 1 2: -2 The unique intersection point: 0: 7 1: 2 2: 3 Expected answer: The unique intersection point: 7, 2, 3. TEST0616 For a normal plane, with point PP and NORMAL vector, and in-plane basis vectors PQ and PR, PLANE_NORMAL_QR_TO_XYZ converts QR to XYZ coordinates; PLANE_NORMAL_XYZ_TO_QR converts XYZ to QR coordinates. Maximum difference was 7.8504623e-17 TEST0617 PLANE_NORMAL_TETRAHEDRON_INTERSECT determines the intersection of a plane and tetrahedron. Plane normal vector number 1 0 0 1 Point on plane: 0 0 0 Number of intersection points = 3 0 0 0 0 1 1 0 0 2 0 1 0 Point on plane: 0 0 0.2 Number of intersection points = 3 0 0 0 0.2 1 0.8 0 0.2 2 0 0.8 0.2 Point on plane: 0 0 0.4 Number of intersection points = 3 0 0 0 0.4 1 0.6 0 0.4 2 0 0.6 0.4 Point on plane: 0 0 0.6 Number of intersection points = 3 0 0 0 0.6 1 0.4 0 0.6 2 0 0.4 0.6 Point on plane: 0 0 0.8 Number of intersection points = 3 0 0 0 0.8 1 0.2 0 0.8 2 0 0.2 0.8 Point on plane: 0 0 1 Number of intersection points = 1 0 0 0 1 Point on plane: 0 0 1.2 Number of intersection points = 0 Plane normal vector number 2 0.70710678 0.70710678 0 Point on plane: 0 0 0 Number of intersection points = 2 0 0 0 0 1 0 0 1 Point on plane: 0.14142136 0.14142136 0 Number of intersection points = 4 0 0.28284271 0 0 1 0 0.28284271 0 2 0.28284271 0 0.71715729 3 0 0 0 Point on plane: 0.28284271 0.28284271 0 Number of intersection points = 4 0 0.39439425 0.17129117 0.43431458 1 0 0.56568542 0.43431458 2 0.56568542 0 0.43431458 3 0 0.28284271 0.71715729 Point on plane: 0.42426407 0.42426407 0 Number of intersection points = 4 0 0.65123928 0.19728885 0.15147186 1 0 0.84852814 0.15147186 2 0.84852814 0 0.15147186 3 0 0.56568542 0.43431458 Point on plane: 0.56568542 0.56568542 0 Number of intersection points = 0 Point on plane: 0.70710678 0.70710678 0 Number of intersection points = 0 Point on plane: 0.84852814 0.84852814 0 Number of intersection points = 0 TEST062 PLANE_NORMAL_TRIANGLE_INT_3D finds the intersection points of a normal form plane and a triangle. The point PP: 0: 0 1: 0 2: 2 The normal vector N: 0: 1 1: -2 2: -3 Triangle vertices: Row: 1 2 3 Col 1: 3 0 -7 2: 13 -4 -1 3: 5 1 -2 Number of intersection points is 0 Intersection points: Row: 1 2 3 Col Triangle vertices: Row: 1 2 3 Col 1: 3 0 -7 2: 13 -4 -1 3: 9 3 8 Number of intersection points is 2 Intersection points: Row: 1 2 3 Col 1: 7 2 3 2: 10.333333 0.66666667 5 Triangle vertices: Row: 1 2 3 Col 1: -6 0 0 2: 0 3 0 3: 0 0 2 Number of intersection points is 3 Intersection points: Row: 1 2 3 Col 1: -6 0 0 2: 0 3 0 3: 0 0 2 Triangle vertices: Row: 1 2 3 Col 1: -4 1 0 2: 0 6 -2 3: 0 0 1 Number of intersection points is 2 Intersection points: Row: 1 2 3 Col 1: -4 1 0 2: 0 6 -2 TEST063 PLANE_NORMAL2EXP_3D puts a plane defined by point, normal form into explicit form. The point PP: 0: -1 1: 0 2: -1 Normal vector: 0: -0.2672612 1: -0.5345225 2: -0.8017837 P1: -1 0 -1 P2: -1 -0.83205028 -0.44529978 P3: -1.9636241 0.14824985 -0.77762524 TEST064 PLANE_NORMAL2IMP_3D puts a plane defined by point, normal form into implicit ABCD form. Input: PP = -1 0 -1 PN = -0.2672612 -0.5345225 -0.8017837 Output: (A,B,C,D) = -0.2672612 -0.5345225 -0.8017837 -1.0690449 Input: PP = -16 2 4 PN = -0.2672612 -0.5345225 -0.8017837 Output: (A,B,C,D) = -0.2672612 -0.5345225 -0.8017837 6e-07 POINTS_CENTROID_2D_TEST POINTS_CENTROID_2D computes the centroid of a discrete set of points. The points: Row: 1 2 Col 1: 7 3 2: 4 7 3: 5 13 4: 2 7 5: 6 9 6: 12 8 7: 3 4 8: 6 6 9: 3 10 10: 8 7 11: 5 13 12: 10 6 The centroid is point #: 4 POINTS_COLIN_2D_TEST POINTS_COLIN_2D estimates the colinearity of three points. P1: 0 0 P2: 10 10 P3: 5 4.99 Colinearity index = 0.0012990375 Points almost on a line: Expect tiny COLIN. P1: 0 0 P2: 0 1 P3: 100 0 Colinearity index = 0.02572161 Two points close, one far: Expect tiny COLIN. P1: 0 0 P2: 1 0 P3: 0.5 0.86602539 Colinearity index = 1 TEST068 SPHERE_DISTANCE1, SPHERE_DISTANCE2 and SPHERE_DISTANCE3 measure the distance between two points on a sphere. All tests uses RADIUS = 3957 which is the radius of the earth in miles. Distance from Atlanta, Georgia to North Pole 3923.9112 3923.9112 3923.9112 to South Pole 8507.3709 8507.3709 8507.3709 to Timbuktu 4995.7635 4995.7635 4995.7635 to San Antonio, Texas 974.43026 974.43026 974.43026 to Savannah, Georgia 114.22379 114.22379 114.22379 Distance from North Pole to South Pole 12431.282 12431.282 12431.282 to Timbuktu 5054.237 5054.237 5054.237 to San Antonio, Texas 4184.0473 4184.0473 4184.0473 to Savannah, Georgia 3999.8801 3999.8801 3999.8801 Distance from South Pole to Timbuktu 7377.0451 7377.0451 7377.0451 to San Antonio, Texas 8247.2349 8247.2349 8247.2349 to Savannah, Georgia 8431.402 8431.402 8431.402 Distance from Timbuktu to San Antonio, Texas 5969.4411 5969.4411 5969.4411 to Savannah, Georgia 4922.9356 4922.9356 4922.9356 Distance from San Antonio, Texas to Savannah, Georgia 1047.8155 1047.8155 1047.8155 TEST0685 POLAR_TO_XY converts (R,Theta) to (X,Y); XY_TO_POLAR converts (X,Y) to (R,Theta). X Y ===> R T => X Y -0.56316341 0.91263515 1.0724066 -0.55287939 0.91263515 -0.56316341 0.65901847 0.12339089 0.67047047 1.385705 0.12339089 0.65901847 -0.16938584 -0.86776253 0.8841399 -2.9488183 -0.86776253 -0.16938584 -0.48484442 -0.78008641 0.91848186 -2.585495 -0.78008641 -0.48484442 -0.912342 0.26793142 0.95087075 -1.285153 0.26793142 -0.912342 -0.87654554 -0.10092208 0.8823363 -1.6854277 -0.10092208 -0.87654554 -0.19738744 0.50934697 0.54625648 -0.36971072 0.50934697 -0.19738744 0.59457391 -0.99632326 1.1602492 2.603553 -0.99632326 0.59457391 0.79500812 -0.29849532 0.84919808 1.929972 -0.29849532 0.79500812 -0.8109105 -0.97276622 1.266432 -2.4466894 -0.97276622 -0.8109105 TEST0755 For a polygon in 2D: POLYGON_1_2D integrates 1 POLYGON_X_2D integrates X POLYGON_Y_2D integrates Y POLYGON_XX_2D integrates X*X POLYGON_XY_2D integrates X*Y POLYGON_YY_2D integrates Y*Y The polygon vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 1 1 4: 0 1 F(X,Y) Integral 1 1 X 0.5 Y 0.5 X*X 0.33333333 X*Y 0.25 Y*Y 0.33333333 POLYGON_ANGLES_2D_TEST For a polygon in 2D: POLYGON_ANGLES_2D computes the angles. Number of polygonal vertices = 6 The polygon vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 2 1 4: 3 0 5: 3 2 6: 1 2 Polygonal angles in degrees: 0 63.434949 1 135 2 270 3 45 4 90 5 116.56505 TEST076 For a polygon in 2D: POLYGON_AREA_2D computes the area. Number of polygonal vertices = 4 The polygon vertices: Row: 1 2 Col 1: 1 0 2: 2 1 3: 1 2 4: 0 1 Exact area is 2 The computed area is 2 Number of polygonal vertices = 8 The polygon vertices: Row: 1 2 Col 1: 0 0 2: 3 0 3: 3 3 4: 2 3 5: 2 1 6: 1 1 7: 1 2 8: 0 2 Exact area is 6 The computed area is 6 TEST0765 For a polygon in 2D: POLYGON_AREA_2D_2 computes the area. Number of polygonal vertices = 4 The polygon vertices: Row: 1 2 Col 1: 1 0 2: 2 1 3: 1 2 4: 0 1 Exact area is 2 The computed area is 2 Number of polygonal vertices = 8 The polygon vertices: Row: 1 2 Col 1: 0 0 2: 3 0 3: 3 3 4: 2 3 5: 2 1 6: 1 1 7: 1 2 8: 0 2 Exact area is 6 The computed area is 6 TEST078 For a polygon in 3D: POLYGON_AREA_3D computes the area; The polygon vertices: Row: 1 2 3 Col 1: 1 0 0 2: 2 1 1 3: 1 2 1 4: 0 1 0 Exact area is 2.4494898 The computed area is 2.4494897 The polygon vertices: Row: 1 2 3 Col 1: 0 0 0 2: 2.62679 1.26009 -0.715657 3: 1.48153 3.973 -0.142512 4: 0.605932 3.55297 0.0960401 5: 1.36944 1.74437 -0.286056 6: 0.493842 1.32433 -0.0475041 7: 0.11209 2.22864 0.143544 8: -0.763505 1.80861 0.382097 Exact area is 6 The computed area is 6.0000044 TEST0782 For a polygon in 3D: POLYGON_AREA_3D_2 computes the area; The polygon vertices: Row: 1 2 3 Col 1: 1 0 0 2: 2 1 1 3: 1 2 1 4: 0 1 0 Exact area is 2.4494898 The computed area is 2.4494897 The polygon vertices: Row: 1 2 3 Col 1: 0 0 0 2: 2.62679 1.26009 -0.715657 3: 1.48153 3.973 -0.142512 4: 0.605932 3.55297 0.0960401 5: 1.36944 1.74437 -0.286056 6: 0.493842 1.32433 -0.0475041 7: 0.11209 2.22864 0.143544 8: -0.763505 1.80861 0.382097 Exact area is 6 The computed area is 6.0000044 TEST0784 For a polygon in 2D: POLYGON_CENTROID_2D computes the centroid. POLYGON_CENTROID_2D_2 computes the centroid. The polygon vertices: Row: 1 2 Col 1: 1 0 2: 2 1 3: 1 2 4: 0 1 POLYGON_CENTROID_2D: 0: 1 1: 1 POLYGON_CENTROID_2D_2: 0: 1 1: 1 POLYGON_CENTROID_3D_TEST For a polygon in 3D: POLYGON_CENTROID_3D computes the centroid. The polygon vertices: Row: 1 2 3 Col 1: 1 0 0 2: 2 1 1 3: 1 2 1 4: 0 1 0 The centroid: 0: 1 1: 1 2: 0.5 POLYGON_CONTAINS_POINT_2D_TEST POLYGON_CONTAINS_POINT_2D determines if a point is in a polygon. The polygon vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 2 1 4: 1 2 5: 0 2 P Inside 1 1 true 3 4 false 0 2 false 0.5 -0.25 false POLYGON_CONTAINS_POINT_2D_2_TEST POLYGON_CONTAINS_POINT_2D determines if a point is in a polygon. The polygon vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 2 1 4: 1 2 5: 0 2 P Inside 1 1 true 3 4 false 0 2 true 0.5 -0.25 false POLYGON_CONTAINS_POINT_2D_3_TEST POLYGON_CONTAINS_POINT_2D_3 determines if a point is in a polygon. The polygon vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 2 1 4: 1 2 5: 0 2 P Inside 1 1 true 3 4 false 0 2 true 0.5 -0.25 false TEST080 For a polygon in 2D: POLYGON_DIAMETER_2D computes the diameter; The polygon vertices: Row: 1 2 Col 1: 1 0 2: 2 1 3: 1 2 4: 0 1 Diameter ( computed ) 2 Diameter ( exact ) 2 TEST0803 For a REGULAR polygon in 2D: the inradius, outradius and side are related. POLYGON_INRAD_DATA_2D uses the inradius; POLYGON_OUTRAD_DATA_2D uses the inradius; POLYGON_SIDE_DATA_2D uses the inradius; Number of polygonal sides = 3 Assuming SIDE = 1 AREA = 0.4330127 RADIN = 0.28867513 RADOUT = 0.57735027 Assuming RADIN = 0.28867513 AREA = 0.4330127 RADOUT = 0.57735027 SIDE = 1 Assuming RADOUT = 0.57735027 AREA = 0.4330127 RADIN = 0.28867513 SIDE = 1 Number of polygonal sides = 4 Assuming SIDE = 1 AREA = 1 RADIN = 0.5 RADOUT = 0.70710678 Assuming RADIN = 0.5 AREA = 1 RADOUT = 0.70710678 SIDE = 1 Assuming RADOUT = 0.70710678 AREA = 1 RADIN = 0.5 SIDE = 1 Number of polygonal sides = 5 Assuming SIDE = 1 AREA = 1.7204774 RADIN = 0.68819096 RADOUT = 0.85065081 Assuming RADIN = 0.68819096 AREA = 1.7204774 RADOUT = 0.85065081 SIDE = 1 Assuming RADOUT = 0.85065081 AREA = 1.7204774 RADIN = 0.68819096 SIDE = 1 TEST0805 For a polygon in 2D: POLYGON_DIAMETER_2D computes the diameter; The polygonal vertices: Row: 1 2 Col 1: 1 0 2: 2 1 3: 1 2 4: 0 1 Diameter ( computed ) 2 Diameter ( exact ) 2 POLYGON_SOLID_ANGLE_3D_TEST POLYGON_SOLID_ANGLE_3D computes the solid angle subtended by a planar polygon in 3D as viewed from a point P. TEST #1 The viewing point P: 0: 0 1: 0 2: 0 The polygon vertices V: Row: 1 2 3 Col 1: 1 0 0 2: 0 1 0 3: 0 0 1 Solid angle subtended: -1.5707963 TEST #2 The viewing point P: 0: 0 1: 0 2: 0 The polygon vertices V: Row: 1 2 3 Col 1: 1 0 0 2: 0 0 1 3: 0 1 0 Solid angle subtended: 1.5707963 TEST #3 The viewing point P: 0: 1 1: 2 2: 3 The polygon vertices V: Row: 1 2 3 Col 1: 2 2 3 2: 1 3 3 3: 1 2 4 Solid angle subtended: -1.5707963 TEST #4 The viewing point P: 0: 0 1: 0 2: 0 The polygon vertices V: Row: 1 2 3 Col 1: 2 0 0 2: 0 2 0 3: 0 0 2 Solid angle subtended: -1.5707963 POLYHEDRON_AREA_3D_TEST For a polyhedron in 3D: POLYHEDRON_AREA_3D computes surface area; Number of faces is 4 Order of each face: 0: 3 1: 3 2: 3 3: 3 Nodes per face: 0 2 1 0 1 0 1 3 2 0 3 2 3 1 2 3 Nodal coordinates: 0 0 0 0 1 1 0 0 2 0 1 0 3 0 0 1 Surface area = 2.3660254 Exact area = 2.366025 POLYHEDRON_CENTROID_3D_TEST For a polyhedron in 3D: POLYHEDRON_CENTROID_3D computes the centroid; Number of faces is 4 Order of each face: 0: 3 1: 3 2: 3 3: 3 Nodes per face: 0 3 2 1 1 1 2 4 2 1 4 3 3 2 3 4 Nodal coordinates: 0 0 0 0 1 1 0 0 2 0 1 0 3 0 0 1 The computed centroid is 0.25 0.25 0.25 The correct centroid is 0.25 0.25 0.25 TEST0825 POLYHEDRON_CONTAINS_POINT_3D determines if a point is inside a polyhedron. We test this routine by using a tetrahedron as the polyhedron. For this shape, an independent check can be made, using barycentric coordinates. We label these checks IN1 and IN2, and we expect them to agree. The vertices: Row: 1 2 3 Col 1: 0 0 0 2: 1 0 0 3: 0 1 0 4: 0 0 1 The face orders: 0: 3 1: 3 2: 3 3: 3 The nodes making each face: Row: 1 2 3 Col 1: 1 2 4 2: 1 3 2 3: 1 4 3 4: 2 3 4 X Y Z IN1 IN2 0.2184183 0.95631758 0.82950923 false false 0.56169544 0.41530708 0.066118735 false false 0.25757779 0.10995679 0.043828998 true true 0.63396571 0.061727229 0.44953896 false false 0.40130628 0.75467349 0.79728695 false false 0.0018383712 0.89750406 0.35075234 false false 0.09454475 0.013616892 0.85909686 true true 0.84084745 0.12310392 0.0075123641 true true 0.260303 0.91248371 0.11366405 false false 0.35162866 0.82288732 0.26713227 false false 0.6920665 0.56166247 0.86121579 false false 0.45379378 0.91197703 0.59791688 false false 0.18895469 0.76149206 0.39698848 false false 0.18531412 0.57436586 0.36702667 false false 0.61720483 0.3615287 0.21293 false false 0.71447121 0.11770687 0.29932915 false false 0.82500295 0.82466007 0.061861771 false false 0.71078052 0.088283334 0.77799401 false false 0.74530307 0.30867492 0.89937309 false false 0.76353672 0.76173065 0.40696964 false false 0.93874945 0.56208829 0.017820022 false false 0.50110323 0.041909255 0.36885058 true true 0.2717236 0.85857256 0.029036559 false false 0.017442279 0.15238379 0.11431867 true true 0.35390726 0.11930783 0.20665276 true true 0.21292396 0.61294755 0.80951907 false false 0.58708963 0.21549164 0.76805636 false false 0.72329672 0.44801899 0.85517612 false false 0.9450175 0.90905692 0.51972572 false false 0.030194625 0.48106695 0.29231288 true true 0.90263984 0.66784151 0.41227804 false false 0.15694849 0.83328163 0.96440416 false false 0.74078991 0.45609886 0.65356142 false false 0.40682695 0.5405386 0.83228094 false false 0.14575576 0.71712832 0.77565076 false false 0.36226162 0.53111085 0.37997675 false false 0.26928526 0.87741782 0.7612848 false false 0.913675 0.13579409 0.29119523 false false 0.11821097 0.77178084 0.32063292 false false 0.87741295 0.67947576 0.94917554 false false 0.79336118 0.021366233 0.1022783 true true 0.99140616 0.56325963 0.70452753 false false 0.99414555 0.60433427 0.046145179 false false 0.56202901 0.021515389 0.60913481 false false 0.72878851 0.74840659 0.4696338 false false 0.13519381 0.20234784 0.86012023 false false 0.040624381 0.77397251 0.15594072 true true 0.8957272 0.48712731 0.1486817 false false 0.89334475 0.44520732 0.59934722 false false 0.22868878 0.57229961 0.63961837 false false 0.065984537 0.0021199146 0.62940518 true true 0.41284158 0.62839709 0.46987913 false false 0.25850863 0.75449328 0.76851336 false false 0.40397812 0.66023587 0.58429849 false false 0.30473519 0.68434467 0.78080031 false false 0.91087828 0.13123077 0.59555485 false false 0.49032273 0.8541589 0.84857995 false false 0.083142974 0.38397163 0.41111234 true true 0.56502614 0.39439151 0.53803625 false false 0.77524304 0.50980575 0.30532421 false false 0.58407567 0.55977837 0.19502922 false false 0.85610338 0.52950225 0.34429286 false false 0.53010092 0.40624102 0.69281382 false false 0.1219051 0.85897081 0.72238234 false false 0.079995959 0.49208465 0.46664356 false false 0.87835927 0.5842312 0.17377787 false false 0.68473125 0.2781112 0.21491455 false false 0.068821287 0.67937532 0.26101204 false false 0.82938312 0.44215812 0.35152215 false false 0.032761876 0.62885028 0.08672083 true true 0.51698762 0.011002505 0.91910495 false false 0.39691029 0.87122759 0.72204768 false false 0.45540351 0.96680422 0.078531014 false false 0.87074958 0.68818572 0.33742109 false false 0.036307152 0.21431001 0.90833914 false false 0.4559097 0.47434153 0.25806522 false false 0.30216186 0.43434113 0.97134143 false false 0.33541731 0.35869672 0.61584009 false false 0.4244283 0.36648057 0.43886941 false false 0.078172747 0.84935238 0.065508649 true true 0.0038679335 0.0083588124 0.4865605 true true 0.62227634 0.59839891 0.2905304 false false 0.94441749 0.82473318 0.29047652 false false 0.038914392 0.034182799 0.51030388 true true 0.67730098 0.39758145 0.15140491 false false 0.66224958 0.4287045 0.23654602 false false 0.62888212 0.621841 0.28171413 false false 0.76930227 0.66322508 0.82400111 false false 0.98663358 0.35063673 0.15155467 false false 0.17925689 0.77059807 0.44179587 false false 0.2632095 0.76199618 0.86979236 false false 0.60014454 0.62935824 0.6238966 false false 0.83012553 0.91976994 0.57330995 false false 0.62035871 0.36877637 0.024396001 false false 0.023587244 0.43081173 0.65266698 false false 0.37392122 0.49399763 0.61819808 false false 0.055056939 0.34197255 0.53263339 true true 0.96934761 0.82522074 0.48505298 false false 0.28537633 0.31997114 0.75498393 false false 0.01493168 0.95674872 0.075678435 false false TEST083 For a polyhedron in 3D: POLYHEDRON_VOLUME_3D computes the volume; POLYHEDRON_VOLUME_3D_2 computes the volume; Number of faces is 4 Order of each face: 0: 3 1: 3 2: 3 3: 3 Nodes per face: 0 2 1 0 1 0 1 3 2 0 3 2 3 1 2 3 Nodal coordinates: 0 0 0 0 1 1 0 0 2 0 1 0 3 0 0 1 Volume (method 1) = 0.16666667 Volume (method 2) = 0.16666667 Volume (exact) = 0.16666667 TEST084 POLYLINE_INDEX_POINT_ND finds a point on a polyline with given arclength. POLYLINE_ARCLENGTH_ND computes the arclength of the polyline, and its nodes. The line we examine is defined by these points: P Arclength(X,Y) 0 0 0 1 1 1.4142136 2 0 2.8284271 0 0 4.8284271 We search for the point with coordinate 2 The computed point: 0: 1.4142136 1: 0.58578644 POLYLINE_POINTS_ND_TEST POLYLINE_POINTS_ND computes points on a polyline. The defining points: Row: 1 2 Col 1: 0 1 2: 0 0 3: 1 0 4: 1 2 The computed points: Row: 1 2 Col 1: 0 1 2: 0 0.66666667 3: 0 0.33333333 4: 0 0 5: 0.33333333 0 6: 0.66666667 0 7: 1 0 8: 1 0.33333333 9: 1 0.66666667 10: 1 1 11: 1 1.3333333 12: 1 1.6666667 13: 1 2 TEST0845 POLYLOOP_ARCLENGTH_ND computes the arclength of the nodes of a polyloop. P Arclength(P) 0 0 0 1 1 1.4142136 2 0 2.8284271 0 0 4.8284271 0 0 0 TEST0846 POLYLOOP_POINTS_ND computes points on a polyloop. The defining points: Row: 1 2 Col 1: 0 2 2: 0 0 3: 1 0 4: 1 2 The computed points: Row: 1 2 Col 1: 0 2 2: 0 1.4545455 3: 0 0.90909091 4: 0 0.36363636 5: 0.18181818 0 6: 0.72727273 0 7: 1 0.27272727 8: 1 0.81818182 9: 1 1.3636364 10: 1 1.9090909 11: 0.54545455 2 12: 0 2 PLANE_EXP_PRO3_TEST PLANE_EXP_PRO3 projects an object point orthographically into a plane. PO PP 0 2 2 -1 1 1 4 5 -8 4 5 -8 0.25 0.25 0.25 0.33333333 0.33333333 0.33333333 5 -2 -3 5.3333333 -1.6666667 -2.6666667 -2 0 0 -1 1 1 TEST170 PROVEC projects a vector onto a subspace. Base vectors Row: 1 2 3 4 Col 1: 4 3 2 1 2: 1 2 3 4 Vector to be projected: 0: 1 1: 1 2: 1 3: 2 Projected vector in BASE coordinates: 0: 2.008316 1: 1.6329932 Projected vector in original coordinates: 0: 2.0629515 1: 1.3981424 2: 0.066666667 3: 0.36666667 TEST171 For a quadrilateral in 2D: QUAD_AREA_2D finds the area; QUAD_AREA2_2D finds the area; The vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 1 1 4: 0 1 QUAD_AREA_2D area is 1 QUAD_AREA2_2D area is 1 TEST1712 For a quadrilateral in 3D: QUAD_AREA_3D finds the area. The vertices: Row: 1 2 3 Col 1: 2 2 0 2: 0 0 0 3: 1 1 1 4: 3 3 1 QUAD_AREA_3D area is 2.8284271 Sum of TRIANGLE_AREA_3D: 2.8284271 TEST1715 For a quadrilateral in 2D: QUAD_AREA_2D finds the area; QUAD_CONTAINS_POINT_2D tells if a point is inside; QUAD_POINT_DIST_2D computes the distance. QUAD_POINT_DIST_SIGNED_2D computes signed distance. The vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 1 1 4: 0 1 P Contains Dist Dist Signed Unsigned 0.25 0.25 true -0.25 0.25 0.75 0.25 true -0.25 0.25 1 1 true 0 0 11 0.5 false 10 10 0 0.5 true 0 0 0.5 -10 false 10 10 2 2 false 1 1.4142136 R8_ACOS_TEST R8_ACOS computes an angle with a given cosine; X R8_ACOS(X) (Degrees) 5 0 0 1.2 0 0 1 0 0 0.9 0.45102681 25.841933 0.5 1.0471976 60 0 1.5707963 90 -0.9 2.6905658 154.15807 -1 3.1415927 180 -1.01 3.1415927 180 R8_ASIN_TEST R8_ASIN computes an angle with a given sine; X R8_ASIN(X) (Degrees) 5 1.5707963 90 1.2 1.5707963 90 1 1.5707963 90 0.9 1.1197695 64.158067 0.5 0.52359878 30 0 0 0 -0.9 -1.1197695 -64.158067 -1 -1.5707963 -90 -1.01 -1.5707963 -90 R8_ATAN_TEST R8_ATAN computes an angle with a given tangent. X, Y, ATAN(Y/X), ATAN2(Y,X), R8_ATAN(Y,X) 1 0 0 0 0 1 1 0.78539816 0.78539816 0.78539816 1 2 1.1071487 1.1071487 1.1071487 1 0 0 0 0 1 -1 -0.78539816 -0.78539816 5.4977871 -1 -1 0.78539816 -2.3561945 3.9269908 -1 -1 0.78539816 -2.3561945 3.9269908 0 -1 inf -1.5707963 4.712389 Repeat, but display answers in degrees. 1 0 0 0 0 1 1 45 45 45 1 2 63.434949 63.434949 63.434949 1 0 0 0 0 1 -1 -45 -45 315 -1 -1 45 -135 225 -1 -1 45 -135 225 0 -1 inf -90 270 TEST0243 R8VEC_ANY_NORMAL computes a vector V2 that is normal to a given vector V1. Test ||V1|| ||V2|| V1.V2 0 1.6201726 1 0 1 1.5842377 1 0 2 1.8015916 1 0 3 1.9335884 1 0 4 1.7309549 1 0 TEST0245 R8VEC_NORMAL_01 computes a vector of normally distributed random numbers. Using initial random number seed = 123456789 Test #1: Call 5 times, 1 value each time. 1 1.6790403 2 -0.4727688 3 -0.56605981 4 -0.23112413 5 1.2129342 Test #2: Restore the random number seed. call 5 times, 1 value each time. The results should be identical. 1 1.6790403 2 -0.4727688 3 -0.56605981 4 -0.23112413 5 1.2129342 Test #3: Restore the random number seed. call 1 time for 5 values. The results should be identical. 1 1.6790403 2 -0.4727688 3 -0.56605981 4 -0.23112413 5 1.2129342 Test #4: Restore the random number seed. call for 2, 1, and 2 values. The results should be identical. 1 1.6790403 2 -0.4727688 3 -0.56605981 4 -0.23112413 5 1.2129342 Test #5: Number of samples was 1000 Minimum value was -3.0297543 Maximum value was 3.3285812 Average value was -0.015155925 Variance was 0.99967392 Expected average 0 Expected variance 1 TEST173 RADEC_DISTANCE_3D computes the angular separation between two points on a sphere described in terms of right ascension and declination. RA1 DEC1 RA2 DEC2 Radians Degrees 0 0 6 0 0 0 0 0 0 90 0 0 0 0 3 35.26439 0 0 0 0 22.546573 -10.519735 0 0 0 0 15 -35.26439 0 0 6 0 0 90 0 0 6 0 3 35.26439 0 0 6 0 22.546573 -10.519735 0 0 6 0 15 -35.26439 0 0 0 90 3 35.26439 0 0 0 90 22.546573 -10.519735 0 0 0 90 15 -35.26439 0 0 3 35.26439 22.546573 -10.519735 0 0 3 35.26439 15 -35.26439 0 0 22.546573 -10.519735 15 -35.26439 0 0 TEST174 RADEC_TO_XYZ converts XYZ to RADEC coordinates. XYZ_TO_RADEC converts RADEC to XYZ coordinates. P1 RA DEC P2 1 0 0 0 0 1 0 0 0 1 0 6 0 6.123234e-17 1 0 0 0 1 0 90 6.123234e-17 0 1 1 1 1 335.26439 0.57735027 0.57735027 0.57735027 5 -2 -122.546573-10.519735 0.91287093 -0.36514837 -0.18257419 -2 -2 -2 15-35.26439 -0.57735027 -0.57735027 -0.57735027 TEST1745 R8MAT_SOLVE solves linear systems. The linear system: Col: 1 2 3 4 5 Row 1: 1 2 3 14 7 2: 4 5 6 32 16 3: 7 8 0 23 7 The computed solutions: 1 1 2 0 3 2 TEST1746 R8MAT_INVERSE_3D inverts a 3 by 3 matrix. Matrix A: 3 2 1 2 2 1 0 1 1 Inverse matrix B: 1 -1 0 -2 3 -1 2 -3 2 TEST1787 DGE_FA factors a general linear system, DGE_SL solves a factored system. Matrix order N = 5 Matrix A: Col: 1 2 3 4 5 Row 1: 0.2184183 0.066118735 0.061727229 0.0018383712 0.85909686 2: 0.95631758 0.25757779 0.44953896 0.89750406 0.84084745 3: 0.82950923 0.10995679 0.40130628 0.35075234 0.12310392 4: 0.56169544 0.043828998 0.75467349 0.09454475 0.0075123641 5: 0.41530708 0.63396571 0.79728695 0.013616892 0.260303 Desired solution vector: 0: 1 1: 2 2: 3 3: 4 4: 5 Right hand side vector: 0: 4.8386752 1: 10.614344 2: 4.2718706 3: 3.3291147 4: 5.4310819 Factored matrix ALU: Col: 1 2 3 4 5 Row 1: 0.95631758 0.25757779 0.44953896 0.89750406 0.84084745 2: -0.22839515 0.52210551 0.60206236 -0.37614881 -0.10485802 3: -0.86739934 0.21732392 0.61455238 -0.51002551 -0.50794334 4: -0.58735242 0.20582036 -0.2314189 -0.39145868 -0.51148708 5: -0.43427737 -0.013961194 0.080303649 -0.61016051 0.93981483 Solution: (Should be 1, 2, 3,...) 0: 1 1: 2 2: 3 3: 4 4: 5 Solution: (Should be 1, 1, 1,...) 0: 1 1: 1 2: 1 3: 1 4: 1 Solution of transposed system: (Should be 1, 2, 3,...) 0: 1 1: 2 2: 3 3: 4 4: 5 TEST1893 RTP_TO_XYZ converts XYZ to (R,Theta,Phi) coordinates. XYZ_TO_RTP converts (R,Theta,Phi) to XYZ coordinates. X1 Y1 Z1 R THETA PHI X2 Y2 Z2 -0.90790852 2.7815879 2.7815879 3.6295294 1.8862934 0.93764619 -0.90790852 2.7815879 2.1475462 0.80847721 0.076535407 0.076535407 1.8564511 0.09438485 2.6888393 0.80847721 0.076535407 -1.6694063 -0.71211104 -1.450216 -1.450216 2.404511 4.2559367 2.4048051 -0.71211104 -1.450216 -1.780855 1.1698286 -1.6913639 -1.6913639 2.0713675 5.3174876 1.4509292 1.1698286 -1.6913639 0.2476948 0.0065314075 1.7733674 1.7733674 2.6628552 1.5671133 0.72879225 0.0065314075 1.7733674 1.9864348 TEST036 SEGMENT_CONTAINS_POINT_1D determines if a point lies within a line segment in 1D. P1 P T 2 6 3 0.25 10 -10 7.5 0.125 8 10 20 6 88 88 5 -inf TEST0365 SEGMENT_POINT_DIST_2D computes the distance between a line segment and point in 2D TEST = 1 P1 = 0.2184183 0.95631758 P2 = 0.82950923 0.56169544 P = 0.41530708 0.066118735 DIST = 0.64101543 TEST = 2 P1 = 0.25757779 0.10995679 P2 = 0.043828998 0.63396571 P = 0.061727229 0.44953896 DIST = 0.05308483 TEST = 3 P1 = 0.40130628 0.75467349 P2 = 0.797286950.0018383712 P = 0.89750406 0.35075234 DIST = 0.25112166 SEGMENT_POINT_DIST_3D_TEST SEGMENT_POINT_DIST_3D computes the distance between a line segment and point in 3D TEST = 1 P1 = 0.2184183 0.95631758 0.82950923 P2 = 0.56169544 0.41530708 0.066118735 P = 0.25757779 0.10995679 0.043828998 DIST = 0.43153583 TEST = 2 P1 = 0.63396571 0.061727229 0.44953896 P2 = 0.40130628 0.75467349 0.79728695 P = 0.0018383712 0.89750406 0.35075234 DIST = 0.61592885 TEST = 3 P1 = 0.09454475 0.013616892 0.85909686 P2 = 0.84084745 0.123103920.0075123641 P = 0.260303 0.91248371 0.11366405 DIST = 0.90757949 SEGMENT_POINT_NEAR_2D_TEST SEGMENT_POINT_NEAR_2D computes the nearest point on a line segment to a point in 2D TEST = 1 P1 = 0.2184183 0.95631758 P2 = 0.82950923 0.56169544 P = 0.41530708 0.066118735 PN = 0.7630489 0.60461331 DIST = 0.64101543 T = 0.89124314 TEST = 2 P1 = 0.25757779 0.10995679 P2 = 0.043828998 0.63396571 P = 0.061727229 0.44953896 PN = 0.11088004 0.46958891 DIST = 0.05308483 T = 0.68630916 TEST = 3 P1 = 0.40130628 0.75467349 P2 = 0.797286950.0018383712 P = 0.89750406 0.35075234 PN = 0.67525172 0.23385073 DIST = 0.25112166 T = 0.69181517 SEGMENT_POINT_NEAR_3D_TEST SEGMENT_POINT_NEAR_3D computes the nearest point on a line segment to a point in 3D TEST = 1 P1 = 0.2184183 0.95631758 0.82950923 P2 = 0.56169544 0.41530708 0.066118735 P = 0.25757779 0.10995679 0.043828998 PN = 0.56169544 0.41530708 0.066118735 DIST = 0.43153583 T = 1 TEST = 2 P1 = 0.63396571 0.061727229 0.44953896 P2 = 0.40130628 0.75467349 0.79728695 P = 0.0018383712 0.89750406 0.35075234 PN = 0.40130628 0.75467349 0.79728695 DIST = 0.61592885 T = 1 TEST = 3 P1 = 0.09454475 0.013616892 0.85909686 P2 = 0.84084745 0.123103920.0075123641 P = 0.260303 0.91248371 0.11366405 PN = 0.58870726 0.086113457 0.29522227 DIST = 0.90757949 T = 0.66214755 SEGMENT_POINT_NEAR_3D_TEST2 SEGMENT_POINT_NEAR_3D computes the nearest point on a line segment, to a given point, in 3 space. Case T Distance PN 1 1 5 8 6 0 2 0.33333333 1 4 4 0 3 0.66666667 0 6 5 0 TEST1788 SIMPLEX_LATTICE_LAYER_POINT_NEXT returns the next point in an N-dimensional simplex lattice layer defined by: C(N+1) - 1 <= X[0]/C[0] + X(2)/C(2) + ... + X(N)/C(N) <= C(N+1). N = 1 C = 2 Layer 0 1 0 No more. Layer 1 1 1 2 2 No more. Layer 2 1 3 2 4 No more. N = 2 C = 2 3 Layer 0 1 0 0 No more. Layer 1 1 1 0 2 2 0 3 0 1 4 1 1 5 0 2 6 0 3 No more. Layer 2 1 3 0 2 4 0 3 2 1 4 3 1 5 1 2 6 2 2 7 1 3 8 2 3 9 0 4 10 1 4 11 0 5 12 0 6 No more. N = 3 C = 2 3 4 Layer 0 1 0 0 0 No more. Layer 1 1 1 0 0 2 2 0 0 3 0 1 0 4 1 1 0 5 0 2 0 6 0 3 0 7 0 0 1 8 1 0 1 9 0 1 1 10 0 2 1 11 0 0 2 12 1 0 2 13 0 1 2 14 0 0 3 15 0 0 4 No more. Layer 2 1 3 0 0 2 4 0 0 3 2 1 0 4 3 1 0 5 1 2 0 6 2 2 0 7 1 3 0 8 2 3 0 9 0 4 0 10 1 4 0 11 0 5 0 12 0 6 0 13 2 0 1 14 3 0 1 15 1 1 1 16 2 1 1 17 1 2 1 18 2 2 1 19 0 3 1 20 1 3 1 21 0 4 1 22 0 5 1 23 2 0 2 24 3 0 2 25 1 1 2 26 2 1 2 27 0 2 2 28 1 2 2 29 0 3 2 30 1 3 2 31 0 4 2 32 1 0 3 33 2 0 3 34 0 1 3 35 1 1 3 36 0 2 3 37 1 2 3 38 0 3 3 39 1 0 4 40 2 0 4 41 0 1 4 42 1 1 4 43 0 2 4 44 0 3 4 45 0 0 5 46 1 0 5 47 0 1 5 48 0 2 5 49 0 0 6 50 1 0 6 51 0 1 6 52 0 0 7 53 0 0 8 No more. N = 4 C = 2 3 4 5 Layer 0 1 0 0 0 0 No more. Layer 1 1 1 0 0 0 2 2 0 0 0 3 0 1 0 0 4 1 1 0 0 5 0 2 0 0 6 0 3 0 0 7 0 0 1 0 8 1 0 1 0 9 0 1 1 0 10 0 2 1 0 11 0 0 2 0 12 1 0 2 0 13 0 1 2 0 14 0 0 3 0 15 0 0 4 0 16 0 0 0 1 17 1 0 0 1 18 0 1 0 1 19 0 2 0 1 20 0 0 1 1 21 1 0 1 1 22 0 1 1 1 23 0 0 2 1 24 0 0 3 1 25 0 0 0 2 26 1 0 0 2 27 0 1 0 2 28 0 0 1 2 29 0 1 1 2 30 0 0 2 2 31 0 0 0 3 32 0 1 0 3 33 0 0 1 3 34 0 0 0 4 35 0 0 0 5 No more. Layer 2 1 3 0 0 0 2 4 0 0 0 3 2 1 0 0 4 3 1 0 0 5 1 2 0 0 6 2 2 0 0 7 1 3 0 0 8 2 3 0 0 9 0 4 0 0 10 1 4 0 0 11 0 5 0 0 12 0 6 0 0 13 2 0 1 0 14 3 0 1 0 15 1 1 1 0 16 2 1 1 0 17 1 2 1 0 18 2 2 1 0 19 0 3 1 0 20 1 3 1 0 21 0 4 1 0 22 0 5 1 0 23 2 0 2 0 24 3 0 2 0 25 1 1 2 0 26 2 1 2 0 27 0 2 2 0 28 1 2 2 0 29 0 3 2 0 30 1 3 2 0 31 0 4 2 0 32 1 0 3 0 33 2 0 3 0 34 0 1 3 0 35 1 1 3 0 36 0 2 3 0 37 1 2 3 0 38 0 3 3 0 39 1 0 4 0 40 2 0 4 0 41 0 1 4 0 42 1 1 4 0 43 0 2 4 0 44 0 3 4 0 45 0 0 5 0 46 1 0 5 0 47 0 1 5 0 48 0 2 5 0 49 0 0 6 0 50 1 0 6 0 51 0 1 6 0 52 0 0 7 0 53 0 0 8 0 54 2 0 0 1 55 3 0 0 1 56 1 1 0 1 57 2 1 0 1 58 1 2 0 1 59 2 2 0 1 60 0 3 0 1 61 1 3 0 1 62 0 4 0 1 63 0 5 0 1 64 2 0 1 1 65 3 0 1 1 66 1 1 1 1 67 2 1 1 1 68 0 2 1 1 69 1 2 1 1 70 0 3 1 1 71 1 3 1 1 72 0 4 1 1 73 1 0 2 1 74 2 0 2 1 75 0 1 2 1 76 1 1 2 1 77 0 2 2 1 78 1 2 2 1 79 0 3 2 1 80 1 0 3 1 81 2 0 3 1 82 0 1 3 1 83 1 1 3 1 84 0 2 3 1 85 0 3 3 1 86 0 0 4 1 87 1 0 4 1 88 0 1 4 1 89 0 2 4 1 90 0 0 5 1 91 1 0 5 1 92 0 1 5 1 93 0 0 6 1 94 0 0 7 1 95 2 0 0 2 96 3 0 0 2 97 1 1 0 2 98 2 1 0 2 99 0 2 0 2 100 1 2 0 2 101 0 3 0 2 102 1 3 0 2 103 0 4 0 2 104 1 0 1 2 105 2 0 1 2 106 1 1 1 2 107 2 1 1 2 108 0 2 1 2 109 1 2 1 2 110 0 3 1 2 111 0 4 1 2 112 1 0 2 2 113 2 0 2 2 114 0 1 2 2 115 1 1 2 2 116 0 2 2 2 117 0 3 2 2 118 0 0 3 2 119 1 0 3 2 120 0 1 3 2 121 1 1 3 2 122 0 2 3 2 123 0 0 4 2 124 1 0 4 2 125 0 1 4 2 126 0 0 5 2 127 0 1 5 2 128 0 0 6 2 129 1 0 0 3 130 2 0 0 3 131 1 1 0 3 132 2 1 0 3 133 0 2 0 3 134 1 2 0 3 135 0 3 0 3 136 0 4 0 3 137 1 0 1 3 138 2 0 1 3 139 0 1 1 3 140 1 1 1 3 141 0 2 1 3 142 0 3 1 3 143 0 0 2 3 144 1 0 2 3 145 0 1 2 3 146 1 1 2 3 147 0 2 2 3 148 0 0 3 3 149 1 0 3 3 150 0 1 3 3 151 0 0 4 3 152 0 1 4 3 153 0 0 5 3 154 1 0 0 4 155 2 0 0 4 156 0 1 0 4 157 1 1 0 4 158 0 2 0 4 159 1 2 0 4 160 0 3 0 4 161 0 0 1 4 162 1 0 1 4 163 0 1 1 4 164 1 1 1 4 165 0 2 1 4 166 0 0 2 4 167 1 0 2 4 168 0 1 2 4 169 0 2 2 4 170 0 0 3 4 171 0 1 3 4 172 0 0 4 4 173 1 0 0 5 174 2 0 0 5 175 0 1 0 5 176 1 1 0 5 177 0 2 0 5 178 0 3 0 5 179 0 0 1 5 180 1 0 1 5 181 0 1 1 5 182 0 2 1 5 183 0 0 2 5 184 1 0 2 5 185 0 1 2 5 186 0 0 3 5 187 0 0 4 5 188 0 0 0 6 189 1 0 0 6 190 0 1 0 6 191 0 2 0 6 192 0 0 1 6 193 1 0 1 6 194 0 1 1 6 195 0 0 2 6 196 0 0 3 6 197 0 0 0 7 198 1 0 0 7 199 0 1 0 7 200 0 0 1 7 201 0 1 1 7 202 0 0 2 7 203 0 0 0 8 204 0 1 0 8 205 0 0 1 8 206 0 0 0 9 207 0 0 0 10 No more. TEST1789 SIMPLEX_LATTICE_POINT_NEXT returns the next lattice point in an N-dimensional simplex defined by: 0 <= X(1)/C(1) + X(2)/C(2) + ... + X(N)/C(N) <= C(N+1). N = 1 C = 2 1 1 0 2 1 3 2 No more. N = 2 C = 3 2 1 1 0 0 2 1 0 3 2 0 4 3 0 5 0 1 6 1 1 7 0 2 No more. N = 3 C = 4 3 2 1 1 0 0 0 2 1 0 0 3 2 0 0 4 0 1 0 5 1 1 0 No more. N = 4 C = 5 4 3 2 1 1 0 0 0 0 2 1 0 0 0 3 2 0 0 0 4 3 0 0 0 5 0 1 0 0 6 1 1 0 0 7 0 2 0 0 8 0 0 1 0 9 1 0 1 0 No more. TEST179 For the truncated icosahedron, or soccer ball, SOCCER_SIZE_3D returns dimension information; SOCCER_SHAPE_3D returns face and order information. SHAPE_PRINT_3D prints this information. Number of vertices: 60 Number of edges : 90 Number of faces : 32 Maximum face order: 6 SHAPE_PRINT_3D Information about a polytope. The number of vertices is 60 Vertices: Index X Y Z 1 -1.00714 0.153552 0.067258 2 -0.960284 0.0848813 -0.33629 3 -0.95172 -0.153552 0.33629 4 -0.860021 0.529326 0.150394 5 -0.858 -0.290893 -0.470806 6 -0.849436 -0.529326 0.201774 7 -0.802576 -0.597996 -0.201774 8 -0.7842 0.418215 -0.502561 9 -0.749174 -0.0848813 0.688458 10 -0.722234 0.692896 -0.201774 11 -0.657475 0.597996 0.502561 12 -0.602051 0.290893 0.771593 13 -0.583675 -0.692896 0.470806 14 -0.579632 -0.333333 -0.771593 15 -0.52171 -0.418215 0.771593 16 -0.505832 0.375774 -0.803348 17 -0.489955 -0.830237 -0.33629 18 -0.403548 0 -0.937864 19 -0.381901 0.925138 -0.201774 20 -0.352168 -0.666667 -0.688458 21 -0.317142 0.830237 0.502561 22 -0.271054 -0.925138 0.33629 23 -0.227464 0.333333 0.937864 24 -0.224193 -0.993808 -0.067258 25 -0.179355 0.993808 0.150394 26 -0.165499 0.608015 -0.803348 27 -0.147123 -0.375774 0.937864 28 -0.103533 0.882697 -0.502561 29 -0.0513806 0.666667 0.771593 30 0 0 1.021 31 0 0 -1.021 32 0.0513806 -0.666667 -0.771593 33 0.103533 -0.882697 0.502561 34 0.147123 0.375774 -0.937864 35 0.165499 -0.608015 0.803348 36 0.179355 -0.993808 -0.150394 37 0.224193 0.993808 0.067258 38 0.227464 -0.333333 -0.937864 39 0.271054 0.925138 -0.33629 40 0.317142 -0.830237 -0.502561 41 0.352168 0.666667 0.688458 42 0.381901 -0.925138 0.201774 43 0.403548 0 0.937864 44 0.489955 0.830237 0.33629 45 0.505832 -0.375774 0.803348 46 0.52171 0.418215 -0.771593 47 0.579632 0.333333 0.771593 48 0.583675 0.692896 -0.470806 49 0.602051 -0.290893 -0.771593 50 0.657475 -0.597996 -0.502561 51 0.722234 -0.692896 0.201774 52 0.749174 0.0848813 -0.688458 53 0.7842 -0.418215 0.502561 54 0.802576 0.597996 0.201774 55 0.849436 0.529326 -0.201774 56 0.858 0.290893 0.470806 57 0.860021 -0.529326 -0.150394 58 0.95172 0.153552 -0.33629 59 0.960284 -0.0848813 0.33629 60 1.00714 -0.153552 -0.067258 The number of faces is 32 The maximum order of any face is 6 Index Order Indices of Nodes in Face 1 2 3 4 5 6 1 6 30 43 47 41 29 23 2 6 30 23 12 9 15 27 3 5 30 27 35 45 43 4 6 43 45 53 59 56 47 5 5 23 29 21 11 12 6 6 27 15 13 22 33 35 7 5 47 56 54 44 41 8 6 45 35 33 42 51 53 9 6 12 11 4 1 3 9 10 6 29 41 44 37 25 21 11 5 15 9 3 6 13 12 6 56 59 60 58 55 54 13 5 53 51 57 60 59 14 6 11 21 25 19 10 4 15 5 33 22 24 36 42 16 6 13 6 7 17 24 22 17 6 54 55 48 39 37 44 18 6 51 42 36 40 50 57 19 5 4 10 8 2 1 20 6 3 1 2 5 7 6 21 5 25 37 39 28 19 22 5 55 58 52 46 48 23 6 60 57 50 49 52 58 24 6 10 19 28 26 16 8 25 6 36 24 17 20 32 40 26 5 7 5 14 20 17 27 6 48 46 34 26 28 39 28 5 50 40 32 38 49 29 6 8 16 18 14 5 2 30 6 46 52 49 38 31 34 31 5 16 26 34 31 18 32 6 32 20 14 18 31 38 TEST180 SORT_HEAP_EXTERNAL sorts objects externally. Unsorted array: 0: 5 1: 20 2: 17 3: 12 4: 9 5: 2 6: 6 7: 3 8: 1 9: 13 10: 2 11: 9 12: 9 13: 16 14: 16 15: 1 16: 18 17: 8 18: 2 19: 1 Sorted array: 0: 1 1: 1 2: 1 3: 2 4: 2 5: 2 6: 3 7: 5 8: 6 9: 8 10: 9 11: 9 12: 9 13: 12 14: 13 15: 16 16: 16 17: 17 18: 18 19: 20 TEST1805 For an N-dimensional simplex, SIMPLEX_VOLUME_ND computes the volume. Here, we check the routine by comparing it with TETRAHEDRON_VOLUME_3D. Simplex vertices: Row: 1 2 3 Col 1: 0 0.942809 -0.333333 2: -0.816496 -0.816496 -0.333333 3: 0.816496 -0.816496 -0.333333 4: 0 0 1 Volume computed by TETRAHEDRON_VOLUME_3D: 0.63842895 Volume computed by SIMPLEX_VOLUME_ND: 0.63842895 TEST0125 SPHERE_CAP_VOLUME_2D computes the volume (area) of a spherical cap, defined by a plane that cuts the sphere to a thickness of H units. SPHERE_CAP_VOLUME_ND does the same operation, but in N dimensions. The two routines should get the same results if THETA1, THETA2 and H correspond. Using a radius R = 1 Theta1 Theta2 H Cap Cap vol_3d vol_nd -0.58568554 0.58568554 0.16666667 0.12504321 0.12504321 -0.84106867 0.84106867 0.33333333 0.34416468 0.34416468 -1.0471976 1.0471976 0.5 0.61418485 0.61418485 -1.2309594 1.2309594 0.66666667 0.91668974 0.91668974 -1.4033482 1.4033482 0.83333333 1.2390127 1.2390127 -1.5707963 1.5707963 1 1.5707963 1.5707963 -1.7382444 1.7382444 1.1666667 1.90258 1.90258 -1.9106332 1.9106332 1.3333333 2.2249029 2.2249029 -2.0943951 2.0943951 1.5 2.5274078 2.5274078 -2.300524 2.300524 1.6666667 2.797428 2.797428 -2.5559071 2.5559071 1.8333333 3.0165494 3.0165494 -3.1415927 3.1415927 2 3.1415927 3.1415927 TEST0126 SPHERE_CAP_VOLUME_3D computes the volume of a spherical cap, defined by a plane that cuts the sphere to a thickness of H units. SPHERE_CAP_VOLUME_ND does the same operation, but in N dimensions. Using a radius R = 1 H Cap Cap volume_3d volume_nd 0 0 0 0.16666667 0.082418326 0.082418326 0.33333333 0.31028076 0.31028076 0.5 0.65449847 0.65449847 0.66666667 1.0859826 1.0859826 0.83333333 1.5756445 1.5756445 1 2.0943951 2.0943951 1.1666667 2.6131457 2.6131457 1.3333333 3.1028076 3.1028076 1.5 3.5342917 3.5342917 1.6666667 3.8785094 3.8785094 1.8333333 4.1063719 4.1063719 2 4.1887902 4.1887902 TEST0127 SPHERE_CAP_AREA_3D computes the volume of a 3D spherical cap, defined by a plane that cuts the sphere to a thickness of H units. SPHERE_CAP_AREA_ND computes the volume of an ND spherical cap, defined by a plane that cuts the sphere to a thickness of H units. R H Cap Cap area_3d area_nd 1 0 0 0 1 0.16666667 1.0471976 1.0471976 1 0.33333333 2.0943951 2.0943951 1 0.5 3.1415927 3.1415927 1 0.66666667 4.1887902 4.1887902 1 0.83333333 5.2359878 5.2359878 1 1 6.2831853 6.2831853 1 1.1666667 7.3303829 7.3303829 1 1.3333333 8.3775804 8.3775804 1 1.5 9.424778 9.424778 1 1.6666667 10.471976 10.471976 1 1.8333333 11.519173 11.519173 1 2 12.566371 12.566371 SPHERE_DIA2IMP_3D_TEST SPHERE_DIA2IMP_3D converts a sphere from diameter to implicit form. Point P1: 0: -1 1: -1 2: 4 Point P2: 0: 5 1: 7 2: 4 Radius: 5 The center: 0: 2 1: 3 2: 4 TEST182 SPHERE_EXP_CONTAINS_POINT_3D determines if a point is within an explicit sphere; SPHERE_IMP_CONTAINS_POINT_3D determines if a point is within an implicit sphere; SPHERE_EXP_CONTAINS_POINT_3D: Inside P true 1 2 3 false 7 2 3 true 1 5 3 true 2.5 3.5 4.5 SPHERE_IMP_CONTAINS_POINT_3D: Inside P true 1 2 3 false 7 2 3 true 1 5 3 true 2.5 3.5 4.5 TEST183 SPHERE_EXP_POINT_NEAR_3D determines if a point is within an explicit sphere; SPHERE_IMP_POINT_NEAR_3D determines if a point is within an implicit sphere; Sphere radius 3 Sphere center: 0: 1 1: 2 2: 3 SPHERE_EXP_POINT_NEAR_3D: P PN 1 2 3 4 2 3 7 2 3 4 2 3 1 5 3 1 5 3 2.5 3.5 4.5 2.7320508 3.7320508 4.7320508 SPHERE_IMP_POINT_NEAR_3D: P PN 1 2 3 4 2 3 7 2 3 4 2 3 1 5 3 1 5 3 2.5 3.5 4.5 2.7320508 3.7320508 4.7320508 TEST1835 SPHERE_EXP2IMP_3D: explicit sphere => implicit form; SPHERE_IMP2EXP_3D: implicit sphere => explicit form. Initial form of explicit sphere: P1: 4 2 3 P2: 1 5 3 P3: 1 2 6 P4: -2 2 3 Computed form of implicit sphere: Imputed radius = 3 Imputed center: 0: 1 1: 2 2: 3 Computed form of explicit sphere: P1: 1 2 6 P2: 3.5980762 2 1.5 P3: -0.29903811 4.25 1.5 P4: -0.29903811 -0.25 1.5 TEST1836 SPHERE_EXP2IMP_ND: explicit sphere => implicit form; Initial form of explicit sphere: Row: 1 2 3 Col 1: 4 2 3 2: 1 5 3 3: 1 2 6 4: -2 2 3 Computed form of implicit sphere: Imputed radius = 3 True radius = 3 Imputed center 0: 1 1: 2 2: 3 True center 0: 1 1: 2 2: 3 TEST187 SPHERE_IMP_GRIDFACES_3D computes gridfaces on a sphere in 3D. Number of intermediate latitudes is 3 Number of longitudes is 4 The number of triangles is 32 Triangle vertices: Row: 1 2 3 Col 1: 2 3 1 2: 3 4 1 3: 4 5 1 4: 5 2 1 5: 6 7 2 6: 3 2 7 7: 7 8 3 8: 4 3 8 9: 8 9 4 10: 5 4 9 11: 9 6 5 12: 2 5 6 13: 10 11 6 14: 7 6 11 15: 11 12 7 16: 8 7 12 17: 12 13 8 18: 9 8 13 19: 13 10 9 20: 6 9 10 21: 14 15 10 22: 11 10 15 23: 15 16 11 24: 12 11 16 25: 16 17 12 26: 13 12 17 27: 17 14 13 28: 10 13 14 29: 15 14 18 30: 16 15 18 31: 17 16 18 32: 14 17 18 TEST188 SPHERE_IMP_POINT_PROJECT_3D projects a 3D point onto a sphere. P1 projection P2 2 0 0 2 2 0 0 4 0 0 4 0 2 4 10 2 4 2 3 5 0 3.4142136 5.4142136 0 TEST189 For a implicit sphere in N dimensions: SPHERE_IMP_AREA_ND computes the area; SPHERE_IMP_VOLUME_ND computes the volume. We use a radius of R = 1 DIM_NUM Area Volume 2 6.2831853 3.1415927 3 12.566371 4.1887902 4 19.739209 4.9348022 5 26.318945 5.263789 6 31.006277 5.1677128 7 33.073362 4.724766 8 32.469697 4.0587121 9 29.68658 3.2985089 10 25.50164 2.550164 TEST1892 For a polygon on the surface of a unit sphere in 3D, SPHERE01_POLYGON_AREA and SPHERE01_POLYGON_AREA_KARNEY compute the area. I N AREA AREA1 ERROR1 AREA2 ERROR2 0 3 2.4674011e-17 12.566371 12.566371 2.467401e-17 8.0620973e-25 1 3 2.4674011e-16 12.566371 12.566371 2.4674011e-16 1.4446524e-24 2 3 2.4674011e-15 4.6644154e-08 4.6644151e-08 2.4674011e-15 2.7681414e-23 3 3 2.4674011e-14 5.9499262e-08 5.9499237e-08 2.4674011e-14 1.2116342e-23 4 3 2.4674011e-13 1.3904566e-07 1.3904541e-07 2.4674011e-13 1.4353437e-22 5 3 2.4674011e-12 6.3941477e-07 6.394123e-07 2.4674011e-12 4.7048078e-22 6 3 2.4674011e-11 1.3311007e-06 1.331076e-06 2.4674011e-11 1.6563646e-22 7 3 2.4674011e-10 1.0308499e-06 1.0306031e-06 2.4674011e-10 3.8577636e-22 8 3 2.4674011e-09 8.3603902e-09 5.8929891e-09 2.4674011e-09 8.2718061e-25 9 3 2.4674011e-08 12.566353 12.566353 2.4674011e-08 1.5484821e-21 10 3 2.4674011e-07 12.566304 12.566304 2.4674011e-07 3.6845933e-20 11 3 2.4674011e-06 12.565819 12.565817 2.4674011e-06 2.0159384e-19 12 3 2.4674011e-05 12.564018 12.563993 2.4674011e-05 2.134523e-19 13 3 0.00024674011 12.556951 12.556704 0.00024674011 2.1141942e-18 14 3 0.0024674011 12.531483 12.529016 0.0024674011 4.3368087e-19 TEST1895: SPHERE_UNIT_AREA_ND evaluates the area of the unit sphere in N dimensions. SPHERE_UNIT_AREA_VALUES returns some test values. DIM_NUM Exact Computed Area Area 1 2 2 2 6.2831853 6.2831853 3 12.566371 12.566371 4 19.739209 19.739209 5 26.318945 26.318945 6 31.006277 31.006277 7 33.073362 33.073362 8 32.469697 32.469697 9 29.68658 29.68658 10 25.50164 25.50164 11 20.725143 20.725143 12 16.023153 16.023153 13 11.838174 11.838174 14 8.3897034 8.3897034 15 5.7216492 5.7216492 16 3.7652901 3.7652901 17 2.3966788 2.3966788 18 1.478626 1.478626 19 0.88581042 0.88581042 20 0.51613783 0.51613783 TEST190 For the unit sphere in 2 dimensions (the circle): SPHERE_UNIT_SAMPLE_2D samples; A few sample values: 0.197134 0.98037655 0.9625704 -0.27103177 0.47904923 -0.87778803 -0.92580225 -0.37800818 -0.86172259 0.50737971 Number of sample points = 1000 Now average the points, which should get a value close to zero, and closer as sample_num increases. Average: -0.019486613 -0.015738368 Now choose a random direction, sample the same number of points, and compute the dot product with the direction. Take the absolute value of each dot product and sum and average. We expect a value near 2 / PI = 0.6366... V: 0.80563448 -0.59241293 Average |(XdotV)| 0.64957331 V: 0.91851731 -0.39538076 Average |(XdotV)| 0.62319409 V: -0.63085867 -0.77589777 Average |(XdotV)| 0.64876773 V: 0.57245901 -0.81993334 Average |(XdotV)| 0.63881379 V: -0.98037717 -0.19713092 Average |(XdotV)| 0.64339392 TEST191 For the unit sphere in 3 dimensions: SPHERE_UNIT_SAMPLE_3D samples; A few sample values: 0.79541577 -0.2239659 -0.56316341 -0.69632065 -0.28431007 0.65901847 0.90171928 0.39775719 -0.16938584 0.67404252 0.55730832 -0.48484442 -0.27275033 -0.30535115 -0.912342 Now average the points, which should get a value close to zero, and closer as sample_num increases. Average: 0.011230974 0.018262003 -0.0017271676 Now choose a random direction, sample the same number of points, and compute the dot product with the direction. Take the absolute value of each dot product and sum and average. V: -0.15923822 -0.83532898 -0.52618314 Average |(XdotV)| 0.50379848 V: 0.32652353 -0.25371317 0.91050097 Average |(XdotV)| 0.50972882 V: -0.093654839 -0.98353592 -0.1545505 Average |(XdotV)| 0.49774376 V: 0.51520352 0.51838271 0.68252817 Average |(XdotV)| 0.50514788 V: 0.85729767 0.25725194 -0.44593962 Average |(XdotV)| 0.49838034 TEST192 For the unit sphere in 3 dimensions: SPHERE_UNIT_SAMPLE_3D_2 samples; Warning: SPHERE_UNIT_SAMPLE_3D_2 is NOT a good code! I only implemented it for comparison. A few sample values: 0.60987248 -0.17172232 0.77367112 -0.47249974 -0.19292324 -0.85995617 0.88274499 0.38938744 0.26294239 0.55777528 0.46117685 0.69007438 -0.09143763 -0.10236682 0.99053531 Now average the points, which should get a value close to zero, and closer as sample_num increases. Average: 0.014670761 0.017092991 -0.0014343674 Now choose a random direction, sample the same number of points, and compute the dot product with the direction. Take the absolute value of each dot product and sum and average. V: -0.12685461 -0.66545165 0.73558277 Average |(XdotV)| 0.56023736 V: 0.11064668 -0.085973959 -0.99013423 Average |(XdotV)| 0.63914634 V: -0.092014107 -0.96630542 0.24038975 Average |(XdotV)| 0.42389861 V: 0.33714604 0.33922648 -0.87821293 Average |(XdotV)| 0.60696897 V: 0.73227476 0.21973593 0.64458498 Average |(XdotV)| 0.5151078 TEST193 For the unit sphere in N dimensions: SPHERE_UNIT_SAMPLE_ND samples; A few sample values: -0.56316341 0.54457698 0.6215166 -0.16938584 0.47783832 0.86196228 -0.912342 -0.35888312 -0.19706591 -0.19738744 0.582876 -0.7882219 0.79500812 0.49189732 0.35496353 Spatial dimension = 3 Number of sample points = 1000 Now average the points, which should get a value close to zero, and closer as N increases. Average: 0.030880045 0.010030744 -0.0073651604 Now choose a random direction, sample the same number of points, and compute the dot product with the direction. Take the absolute value of each dot product and sum and average. V: -0.33961871 0.91941825 -0.19831594 Average |(XdotV)| 0.40812979 V: -0.85997092 -0.32106705 0.3966938 Average |(XdotV)| 0.51103384 V: -0.078837406 -0.001259712 0.99688669 Average |(XdotV)| 0.61662474 V: -0.090849263 0.23449452 -0.96786297 Average |(XdotV)| 0.60420316 V: 0.029874722 -0.45794573 -0.88847803 Average |(XdotV)| 0.57180571 SPHERE_UNIT_SAMPLE_ND_2_TEST For the unit sphere in N dimensions: SPHERE_UNIT_SAMPLE_ND_2 samples; A few sample values: -0.59553231 0.77326298 -0.21772832 -0.41673318 -0.17015356 0.89296205 0.30894855 0.73298333 0.60604145 -0.49599173 -0.55527575 -0.66757849 0.4782142 0.025785363 -0.87786462 Spatial dimension = 3 Number of sample points = 1000 Now average the points, which should get a value close to zero, and closer as N increases. Average: 0.029972653 -0.012539991 0.0044392397 Now choose a random direction, sample the same number of points, and compute the dot product with the direction. Take the absolute value of each dot product and sum and average. V: 0.35567593 0.88044924 -0.31353432 Average |(XdotV)| 0.49516759 V: 0.67742066 -0.65481305 -0.33514343 Average |(XdotV)| 0.50154416 V: -0.16120377 0.95744349 0.23940618 Average |(XdotV)| 0.50908426 V: 0.023796444 0.20111765 -0.97927801 Average |(XdotV)| 0.48759441 V: 0.27033896 -0.75081241 0.60265875 Average |(XdotV)| 0.50110526 TEST195 For the unit sphere in N dimensions: SPHERE_UNIT_SAMPLE_ND_3 samples; A few sample values: 0.13822078 -0.1897437 -0.97205573 0.29056038 -0.95057682 -0.10944576 -0.24446926 0.63083893 0.73639461 -0.34923217 0.76000282 -0.54811732 0.46423674 0.14904206 0.87308116 Spatial dimension = 3 Number of sample points = 1000 Now average the points, which should get a value close to zero, and closer as N increases. Average: 0.010651614 -0.025062545 0.023124965 Now choose a random direction, sample the same number of points, and compute the dot product with the direction. Take the absolute value of each dot product and sum and average. V: 0.34474009 0.21530787 0.91367215 Average |(XdotV)| 0.49508552 V: -0.7258157 -0.57066596 0.38409887 Average |(XdotV)| 0.51242228 V: 0.61410443 0.67890199 0.40245228 Average |(XdotV)| 0.5176173 V: -0.3037338 -0.34413602 0.88843468 Average |(XdotV)| 0.49625336 V: 0.69787248 0.71465059 -0.047418837 Average |(XdotV)| 0.49276926 TEST1955: SPHERE_UNIT_VOLUME_ND evaluates the area of the unit sphere in N dimensions. SPHERE_UNIT_VOLUME_VALUES returns some test values. DIM_NUM Exact Computed Volume Volume 1 2 2 2 3.1415927 3.1415927 3 4.1887902 4.1887902 4 4.9348022 4.9348022 5 5.263789 5.263789 6 5.1677128 5.1677128 7 4.724766 4.724766 8 4.0587121 4.0587121 9 3.2985089 3.2985089 10 2.550164 2.550164 11 1.8841039 1.8841039 12 1.3352628 1.3352628 13 0.91062875 0.91062875 14 0.59926453 0.59926453 15 0.38144328 0.38144328 16 0.23533063 0.23533063 17 0.14098111 0.14098111 18 0.082145887 0.082145887 19 0.046621601 0.046621601 20 0.025806891 0.025806891 TEST196 For a shape in 2D, SHAPE_POINT_DIST_2D computes the distance to a point; Number of sides: 4 Center of square: 0: 3 1: 0 Square vertex #1 0: 5 1: 0 TEST X Y DIST 0 3 0 1.4142136 1 5 0 0 2 4 0 0.70710678 3 10 0 5 4 8 5 5.6568542 5 6 6 5 6 1 2 1.4142136 7 2.5 -0.5 0.70710678 8 4 -1 0 TEST197 For a shape in 2D, SHAPE_POINT_DIST_2D computes the distance to a point; Number of sides: 6 Center of hexagon: 0: 3 1: 0 Hexagon vertex #1 0: 5 1: 0 TEST X Y DIST 0 3 0 1.7320508 1 5 0 0 2 4 0 0.8660254 3 10 0 5 4 4 1.7320508 3.7844387e-09 5 5 3.4641016 2 6 3 1.7320508 7.5688775e-09 7 3 0.86602539 0.86602542 TEST198 For a shape in 2D, SHAPE_POINT_NEAR_2D computes the nearest point to a point; Number of sides: 6 Hexagon center: 0: 3 1: 0 Hexagon vertex #1 0: 5 1: 0 TEST X Y PN Dist 0 3 0 4.5 -0.8660254 1.7320508 1 5 0 5 0 0 2 4 0 4.75 0.4330127 0.8660254 3 10 0 5 0 5 4 4 1.7320508 4 1.7320508 3.7844387e-09 5 5 3.4641016 4 1.7320508 2 6 3 1.7320508 3 1.7320508 7.5688775e-09 7 3 0.86602539 3 1.7320508 0.86602542 TEST199 For a shape in 2D, SHAPE_RAY_INT_2D computes the intersection of a shape and a ray whose origin is within the shape. Number of sides = 6 Hexagon center: 0: 3 1: 0 Hexagon vertex #1: 5 0 TEST XA YA XB YB XI YI 0 3 0 4 0 5 0 1 3 0 3 1 3 1.7320508 2 3 -1 3 1 3 1.7320508 3 3 -1 7 5 4.3811978 1.0717968 TEST200 SPHERE_TRIANGLE_SIDES_TO_ANGLES takes the sides of a spherical triangle and determines the angles. A = 2.0588666 (radians) = 117.96437 ( degrees ) Correct = 117.96667 (degrees) B = 1.6271361 (radians) = 93.228029 ( degrees ) Correct = 93.23 (degrees) C = 1.2277398 (radians) = 70.344308 ( degrees ) Correct = 70.343333 (degrees) TEST201 STRING_2D takes a set of line segments, and strings them together. I P1 P2 0 0 0 1 0 1 3 4 2 4 2 2 2 1 2 3 3 2 2 2 4 2 1 2 1 5 1 1 1 1 6 0 5 1 5 7 1 2 1 2 8 3 2 3 2 9 0 0 1 0 10 5 5 6 5 11 3 3 3 3 12 2 4 2 4 13 7 4 5 4 14 1 0 2 0 Found 4 groups of segments. STRING, ORDER, P1, P2 1 -3 2 2 2 1 1 -2 2 1 1 0 1 -1 1 0 0 0 1 0 0 0 1 1 1 1 1 1 1 2 1 2 1 2 1 3 1 3 1 3 2 2 2 -2 3 2 3 3 2 -1 3 3 3 4 2 0 3 4 2 4 2 1 2 4 2 3 2 2 2 3 3 2 3 0 0 5 1 6 4 -1 7 4 5 5 4 0 5 5 6 6 TEST202 SUPER_ELLIPSE_POINTS_2D returns points on a super ellipse; Superellipse center: 0: 5 1: -2 radii R1 = 3 R2 = 1 exponent EXPO = 1.5 and angle PSI = 0.52359878 Sample points: Row: 1 2 Col 1: 7.5980762 -0.5 2: 7.4005868 -0.46197851 3: 6.9170842 -0.48492261 4: 6.2475236 -0.59315288 5: 5.5155949 -0.77171627 6: 4.8674313 -0.9803506 7: 4.5 -1.1339746 8: 4.1832421 -1.3753674 9: 3.6784776 -1.8323764 10: 3.1578729 -2.3769636 11: 2.7293624 -2.902705 12: 2.4677409 -3.3099584 13: 2.4019238 -3.5 14: 2.5994132 -3.5380215 15: 3.0829158 -3.5150774 16: 3.7524764 -3.4068471 17: 4.4844051 -3.2282837 18: 5.1325687 -3.0196494 19: 5.5 -2.8660254 20: 5.8167579 -2.6246326 21: 6.3215224 -2.1676236 22: 6.8421271 -1.6230364 23: 7.2706376 -1.097295 24: 7.5322591 -0.69004158 TEST203 For a tetrahedron in 3D, TETRAHEDRON_CENTROID_3D computes the centroid; Tetrahedron vertices: Row: 1 2 3 Col 1: 0 0.942809 -0.333333 2: -0.816496 -0.816496 -0.333333 3: 0.816496 -0.816496 -0.333333 4: 0 0 1 Centroid: 0: 0 1: -0.17254575 2: 2.5e-07 TEST2031 For a tetrahedron in 3D, TETRAHEDRON_CONTAINS_POINT_3D finds if a point is inside; Tetrahedron vertices: Row: 1 2 3 Col 1: 0 0.942809 -0.333333 2: -0.816496 -0.816496 -0.333333 3: 0.816496 -0.816496 -0.333333 4: 0 0 1 P Inside_Tetra? 0.0816496 -0.2449488 0.6000001 true -1.4696928 -3.0219429 -0.1999997 false -0.8981456 0.6725976 -0.1999997 false TEST2032 For a tetrahedron in 3D, TETRAHEDRON_CIRCUMSPHERE_3D computes the circumsphere; Tetrahedron vertices: Row: 1 2 3 Col 1: 0.57735027 0 0 2: -0.28867513 0.5 0 3: -0.28867513 -0.5 0 4: 0 0 0.81649658 Circumsphere center: 0: 1.110223e-16 1: 0 2: 0.20412415 Circumsphere radius is 0.61237244 TEST20321 For a tetrahedron in 3D, TETRAHEDRON_EDGE_LENGTH_3D computes the edge lengths; Tetrahedron vertices: Row: 1 2 3 Col 1: 0.57735027 0 0 2: -0.28867513 0.5 0 3: -0.28867513 -0.5 0 4: 0 0 0.81649658 Edge lengths: 0: 1 1: 1 2: 1 3: 1 4: 1 5: 1 TEST20322 For a tetrahedron in 3D, TETRAHEDRON_INSPHERE_3D computes the insphere; Tetrahedron vertices: Row: 1 2 3 Col 1: 0.57735027 0 0 2: -0.28867513 0.5 0 3: -0.28867513 -0.5 0 4: 0 0 0.81649658 Insphere center: 0: -3.2049378e-17 1: 0 2: 0.20412415 Insphere radius is 0.20412415 TETRAHEDRON_LATTICE_LAYER_POINT_NEXT_TEST TETRAHEDRON_LATTICE_LAYER_POINT_NEXT returns the next point in a tetrahedron lattice layer defined by: C[3] - 1 < X[0]/C[0] + X[1]/C[1] +X[2]/C[2] <= C[3]. N = 3 C = 2 3 4 Layer 0 1 0 0 0 No more. Layer 1 1 1 0 0 2 2 0 0 3 0 1 0 4 1 1 0 5 0 2 0 6 0 3 0 7 0 0 1 8 1 0 1 9 0 1 1 10 0 2 1 11 0 0 2 12 1 0 2 13 0 1 2 14 0 0 3 15 0 0 4 No more. Layer 2 1 3 0 0 2 4 0 0 3 2 1 0 4 3 1 0 5 1 2 0 6 2 2 0 7 1 3 0 8 2 3 0 9 0 4 0 10 1 4 0 11 0 5 0 12 0 6 0 13 2 0 1 14 3 0 1 15 1 1 1 16 2 1 1 17 1 2 1 18 2 2 1 19 0 3 1 20 1 3 1 21 0 4 1 22 0 5 1 23 2 0 2 24 3 0 2 25 1 1 2 26 2 1 2 27 0 2 2 28 1 2 2 29 0 3 2 30 1 3 2 31 0 4 2 32 1 0 3 33 2 0 3 34 0 1 3 35 1 1 3 36 0 2 3 37 1 2 3 38 0 3 3 39 1 0 4 40 2 0 4 41 0 1 4 42 1 1 4 43 0 2 4 44 0 3 4 45 0 0 5 46 1 0 5 47 0 1 5 48 0 2 5 49 0 0 6 50 1 0 6 51 0 1 6 52 0 0 7 53 0 0 8 No more. TEST203225 TETRAHEDRON_LATTICE_POINT_NEXT returns the next lattice point in a tetrahedron defined by: 0 <= X(1)/C(1) + X(2)/C(2) + X(3)/C(3) <= C(4). N = 3 C = 4 3 2 1 1 0 0 0 2 1 0 0 3 2 0 0 4 0 1 0 5 1 1 0 No more. TEST20323 For a tetrahedron in 3D, TETRAHEDRON_QUALITY1_3D computes quality measure #1; Tetrahedron vertices: Row: 1 2 3 Col 1: 0.57735027 0 0 2: -0.28867513 0.5 0 3: -0.28867513 -0.5 0 4: 0 0 0.81649658 Tetrahedron quality is 1 Tetrahedron vertices: Row: 1 2 3 Col 1: 0.57735027 0 0 2: -0.28867513 0.5 0 3: -0.28867513 -0.5 0 4: 0 0 0.40824829 Tetrahedron quality is 0.73205081 TEST203232 For a tetrahedron in 3D, TETRAHEDRON_QUALITY2_3D computes quality measure #2; Tetrahedron vertices: Row: 1 2 3 Col 1: 0.57735027 0 0 2: -0.28867513 0.5 0 3: -0.28867513 -0.5 0 4: 0 0 0.81649658 Tetrahedron quality is 1 Tetrahedron vertices: Row: 1 2 3 Col 1: 0.57735027 0 0 2: -0.28867513 0.5 0 3: -0.28867513 -0.5 0 4: 0 0 0.40824829 Tetrahedron quality is 0.73205081 TEST203233 For a tetrahedron in 3D, TETRAHEDRON_QUALITY3_3D computes quality measure #3; Tetrahedron vertices: Row: 1 2 3 Col 1: 0.57735027 0 0 2: -0.28867513 0.5 0 3: -0.28867513 -0.5 0 4: 0 0 0.81649658 Tetrahedron quality is 1 Tetrahedron vertices: Row: 1 2 3 Col 1: 0.57735027 0 0 2: -0.28867513 0.5 0 3: -0.28867513 -0.5 0 4: 0 0 0.40824829 Tetrahedron quality is 0.83994737 TEST203234 For a tetrahedron in 3D, TETRAHEDRON_QUALITY4_3D computes quality measure #4; Tetrahedron vertices: Row: 1 2 3 Col 1: 0.57735027 0 0 2: -0.28867513 0.5 0 3: -0.28867513 -0.5 0 4: 0 0 0.81649658 Tetrahedron quality is 1 Tetrahedron vertices: Row: 1 2 3 Col 1: 0.57735027 0 0 2: -0.28867513 0.5 0 3: -0.28867513 -0.5 0 4: 0 0 0.40824829 Tetrahedron quality is 0.62132034 TEST203235 For the rhombic tetrahedron, TETRAHEDRON_RHOMBIC_SIZE_3D returns dimension information; TETRAHEDRON_RHOMBIC_SHAPE_3D returns face and order information. SHAPE_PRINT_3D prints this information. Number of vertices: 10 Number of edges : 6 Number of faces : 4 Maximum face order: 6 SHAPE_PRINT_3D Information about a polytope. The number of vertices is 10 Vertices: Index X Y Z 1 -0.81649658 0 0 2 0 -0.57735027 0 3 0 0.57735027 0 4 0 0 0.81649658 5 -0.40824829 -0.28867513 0 6 -0.40824829 0.28867513 0 7 -0.40824829 0 0.40824829 8 0 0 0 9 0 -0.28867513 0.40824829 10 0 0.28867513 0.40824829 The number of faces is 4 The maximum order of any face is 6 Index Order Indices of Nodes in Face 1 2 3 4 5 6 1 6 1 5 2 9 4 7 2 6 2 8 3 10 4 9 3 6 3 6 1 7 4 10 4 6 1 6 3 8 2 5 TEST20324 TETRAHEDRON_SAMPLE_3D samples a tetrahedron. TETRAHEDRON_BARYCENTRIC_3D converts Cartesian to barycentric coordinates. We are computing the barycentric coordinates just to verify that the points are inside the tetrahedron. Tetrahedron vertices Row: 1 2 3 Col 1: 1 4 3 2: 2 4 3 3: 1 6 3 4: 1 4 4 P Barycentric: 1.0133003 4.9770466 3.1004072 0.39776914 0.013300321 0.48852332 0.10040722 1.2933656 4.0703136 3.4965656 0.17491194 0.29336564 0.035156813 0.4965656 1.4252794 4.0184943 3.2017357 0.36373778 0.42527936 0.0092471672 0.20173569 1.6456245 4.1918923 3.1174862 0.14094311 0.6456245 0.095946172 0.11748621 1.0968335 5.0217615 3.1298932 0.26239251 0.096833516 0.51088073 0.12989324 1.0064477 4.0814129 3.0753482 0.87749766 0.006447677 0.040706446 0.075348221 1.4024003 4.0913391 3.0074904 0.54443977 0.40240025 0.04566957 0.0074904081 1.6126931 4.0049756 3.3286751 0.056144008 0.6126931 0.0024878162 0.32867508 1.0285791 4.1386518 3.5405933 0.36150173 0.028579099 0.069325881 0.54059329 1.0655487 4.342075 3.4692352 0.29417871 0.065548659 0.17103748 0.46923515 TEST20325 For the tetrahedron, TETRAHEDRON_SIZE_3D returns dimension information; TETRAHEDRON_SHAPE_3D returns face and order information. SHAPE_PRINT_3D prints this information. Number of vertices: 4 Number of edges : 12 Number of faces : 4 Maximum face order: 3 SHAPE_PRINT_3D Information about a polytope. The number of vertices is 4 Vertices: Index X Y Z 1 0.942809 0 -0.333333 2 -0.471405 0.816497 -0.333333 3 -0.471405 -0.816497 -0.333333 4 0 0 1 The number of faces is 4 The maximum order of any face is 3 Index Order Indices of Nodes in Face 1 2 3 1 3 1 3 2 2 3 1 2 4 3 3 1 4 3 4 3 2 3 4 TETRAHEDRON_SOLID_ANGLES_3D_TEST TETRAHEDRON_SOLID_ANGLES_3D computes the solid angles associated with the vertices of a tetrahedron in 3D. Tetrahedron #1 Row: 1 2 3 Col 1: 0 0.942809 -0.333333 2: -0.816496 -0.816496 -0.333333 3: 0.816496 -0.816496 -0.333333 4: 0 0 1 Solid angles for tetrahedron #1 0: 0.45508702 1: 0.53565626 2: 0.53565626 3: 0.64102502 Tetrahedron #2 Row: 1 2 3 Col 1: 0 0 0 2: 1 0 0 3: 0 1 0 4: 0 0 1 Solid angles for tetrahedron #2 0: 1.5707963 1: 0.33983691 2: 0.33983691 3: 0.33983691 Tetrahedron #3 Row: 1 2 3 Col 1: 0 0 0 2: 1 0 0 3: 0 2 0 4: 0 0 4 Solid angles for tetrahedron #3 0: 1.5707963 1: 0.89917491 2: 0.2897517 3: 0.058106238 Tetrahedron #4 Row: 1 2 3 Col 1: 0 0 0 2: 1 0 0 3: 0 1 0 4: 1 1 1 Solid angles for tetrahedron #4 0: 0.52359878 1: 0.44556125 2: 0.44556125 3: 0.18376187 TEST2033 For a tetrahedron in 3D, TETRAHEDRON_VOLUME_3D computes the volume; Tetrahedron vertices Row: 1 2 3 Col 1: 0 0.942809 -0.333333 2: -0.816496 -0.816496 -0.333333 3: 0.816496 -0.816496 -0.333333 4: 0 0 1 Volume = 0.63842895 TEST204 TMAT geometric transformation matrix routines: TMAT_INIT initializes, TMAT_ROT_AXIS for rotation about an axis, TMAT_ROT_VECTOR for rotation about a vector, TMAT_SCALE for scaling, TMAT_SHEAR for shear, TMAT_TRANS for translation. Initial transformation matrix: 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 Transformation matrix for rotation about x by 30 degrees. 1 0 0 0 0 0.8660254 -0.5 0 0 0.5 0.8660254 0 0 0 0 1 Transformation matrix for rotation about 1 2 3 by 30 degrees. 1 -1.2320508 1.4019238 0 1.7679492 1.4019238 0.30384758 0 -0.59807621 1.3038476 2.0717968 0 0 0 0 1 Transformation matrix for scaling by 2 0.5 10 2 0 0 0 0 0.5 0 0 0 0 10 0 0 0 0 1 Transformation matrix for xy shear coefficient of 0.5 1 0.5 0 0 0 1 0 0 0 0 1 0 0 0 0 1 Transformation matrix for translation by 1 2 3 1 0 0 1 0 1 0 2 0 0 1 3 0 0 0 1 TEST205 TMAT_MXP2 applies a geometric transformation matrix to a set of points. Points: Row: 1 2 3 Col 1: 1 0 0 2: 0 1 0 3: 0 0 1 4: 1 1 1 Rotation about x by 30 degrees. Transformed points: Row: 1 2 3 Col 1: 1 0 0 2: 0 0.8660254 0.5 3: 0 -0.5 0.8660254 4: 1 0.3660254 1.3660254 Rotation about 1 2 3 by 30 degrees. Transformed points: Row: 1 2 3 Col 1: 1 1.7679492 -0.59807621 2: -1.2320508 1.4019238 1.3038476 3: 1.4019238 0.30384758 2.0717968 4: 1.169873 3.4737206 2.7775681 Scaling by 2 0.5 10 Transformed points: Row: 1 2 3 Col 1: 2 0 0 2: 0 0.5 0 3: 0 0 10 4: 2 0.5 10 xy shear coefficient of 0.5: Transformed points: Row: 1 2 3 Col 1: 1 0 0 2: 0.5 1 0 3: 0 0 1 4: 1.5 1 1 Translation by 1 2 3 Transformed points: Row: 1 2 3 Col 1: 2 2 3 2: 1 3 3 3: 1 2 4 4: 2 3 4 TRIANGLE_ANGLES_2D_TEST For a triangle in 2D, TRIANGLE_ANGLES_2D computes the angles; Triangle vertices: Row: 1 2 Col 1: 0 1 2: 0 0 3: 1 0 Radians Degrees 0.78539816 45 1.5707963 90 0.78539816 45 TEST206 For a triangle in 3D, TRIANGLE_ANGLES_3D computes the angles; Triangle vertices: Row: 1 2 3 Col 1: 1 2 3 2: 2.4142137 3.4142137 3 3: 1.7071068 2.7071068 4 Radians Degrees 0.78539815 44.999999 0.78539808 44.999995 1.5707964 90.000006 TEST2061 For a triangle in 2D, TRIANGLE_AREA_2D computes the area; Triangle vertices: Row: 1 2 Col 1: 0 1 2: 0 0 3: 1 0 Area is 0.5 TEST2062 For a triangle in 2D, TRIANGLE_AREA_HERON computes the area; Triangle vertices: Row: 1 2 Col 1: 0 1 2: 0 0 3: 1 0 Side lengths: 0: 1 1: 1 2: 1.4142136 Area is 0.5 TEST209 For a triangle in 3D: TRIANGLE_AREA_3D computes the area; TRIANGLE_AREA_3D_2 computes the area; TRIANGLE_AREA_3D_3 computes the area; Triangle (vertices are columns) Col: 1 2 3 Row 1: 1 2.4142137 1.7071068 2: 2 3.4142137 2.7071068 3: 3 3 4 Area #1 1.0000001 Area #2 1.0000001 Area #3 1.0000001 TEST20655 For a triangle in 2D, TRIANGLE_BARYCENTRIC_2D converts XY coordinates to barycentric XSI coordinates; Triangle vertices: Row: 1 2 Col 1: 0 1 2: 0 0 3: 1 0 P XSI 0.25 0.25 0.5 0.25 0.25 0.75 0.25 0 0.75 0.25 1 1 -1 1 1 11 0.5 -10.5 11 0.5 0 1 -0 0 1 0.5 -10 10.5 0.5 -10 0.6 0.6 -0.2 0.6 0.6 TEST2066 For a triangle in 2D: TRIANGLE_CENTROID_2D computes the centroid. Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 0 1 Centroid: 0: 0.33333333 1: 0.33333333 Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 0.5 0.86602539 Centroid: 0: 0.5 1: 0.28867513 Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 0.5 10 Centroid: 0: 0.5 1: 3.3333333 Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 10 2 Centroid: 0: 3.6666667 1: 0.66666667 TEST2094 For a triangle in 3D: TRIANGLE_CENTROID_3D computes the centroid. Triangle vertices: Row: 1 2 3 Col 1: 1 2 3 2: 2.4142137 3.4142137 3 3: 1.7071068 2.7071068 4 Centroid: 0: 1.7071068 1: 2.7071068 2: 3.3333333 TEST2101 For a triangle in 2D, the circumcenter can be computed by: TRIANGLE_CIRCUMCENTER_2D; TRIANGLE_CIRCUMCENTER_2D_2; TRIANGLE_CIRCUMCENTER (any dimension); Triangle vertices: Row: 1 2 Col 1: 10 5 2: 11 5 3: 10 6 Circumcenter by TRIANGLE_CIRCUMCENTER_2D: 0: 10.5 1: 5.5 Circumcenter by TRIANGLE_CIRCUMCENTER_2D_2: 0: 10.5 1: 5.5 Circumcenter by TRIANGLE_CIRCUMCENTER: 0: 10.5 1: 5.5 Triangle vertices: Row: 1 2 Col 1: 10 5 2: 11 5 3: 10.5 5.8660254 Circumcenter by TRIANGLE_CIRCUMCENTER_2D: 0: 10.5 1: 5.2886751 Circumcenter by TRIANGLE_CIRCUMCENTER_2D_2: 0: 10.5 1: 5.2886751 Circumcenter by TRIANGLE_CIRCUMCENTER: 0: 10.5 1: 5.2886751 Triangle vertices: Row: 1 2 Col 1: 10 5 2: 11 5 3: 10.5 15 Circumcenter by TRIANGLE_CIRCUMCENTER_2D: 0: 10.5 1: 9.9875 Circumcenter by TRIANGLE_CIRCUMCENTER_2D_2: 0: 10.5 1: 9.9875 Circumcenter by TRIANGLE_CIRCUMCENTER: 0: 10.5 1: 9.9875 Triangle vertices: Row: 1 2 Col 1: 10 5 2: 11 5 3: 20 7 Circumcenter by TRIANGLE_CIRCUMCENTER_2D: 0: 10.5 1: 28.5 Circumcenter by TRIANGLE_CIRCUMCENTER_2D_2: 0: 10.5 1: 28.5 Circumcenter by TRIANGLE_CIRCUMCENTER: 0: 10.5 1: 28.5 TEST21011 For a triangle in M dimensions, the circumenter can be computed by: TRIANGLE_CIRCUMCENTER; M2 = 2 Circumcenter by TRIANGLE_CIRCUMCENTER: 0: 7.1175872 1: 11.187213 Distances from circumcenter to vertices: 1.3980498 1.3980498 1.3980498 Circumcenter by TRIANGLE_CIRCUMCENTER: 0: 6.3693133 1: 11.358115 Distances from circumcenter to vertices: 1.1448309 1.1448309 1.1448309 Circumcenter by TRIANGLE_CIRCUMCENTER: 0: 11.880525 1: 10.099381 Distances from circumcenter to vertices: 5.8027584 5.8027584 5.8027584 Circumcenter by TRIANGLE_CIRCUMCENTER: 0: 36.3752 1: 4.504916 Distances from circumcenter to vertices: 30.835484 30.835484 30.835484 M2 = 3 Circumcenter by TRIANGLE_CIRCUMCENTER: 0: -8.2944776 1: 4.3463263 2: 9.0692909 Distances from circumcenter to vertices: 16.208178 16.208178 16.208178 Circumcenter by TRIANGLE_CIRCUMCENTER: 0: 5.1041417 1: 12.74478 2: 9.121214 Distances from circumcenter to vertices: 0.64397063 0.64397063 0.64397063 Circumcenter by TRIANGLE_CIRCUMCENTER: 0: 9.2024719 1: 13.439223 2: 7.2414779 Distances from circumcenter to vertices: 4.5612103 4.5612103 4.5612103 Circumcenter by TRIANGLE_CIRCUMCENTER: 0: 76.745214 1: 24.884028 2: -23.73761 Distances from circumcenter to vertices: 79.70285 79.70285 79.70285 M2 = 4 Circumcenter by TRIANGLE_CIRCUMCENTER: 0: -20.433049 1: 13.504996 2: -0.019933613 3: 4.2507339 Distances from circumcenter to vertices: 27.470689 27.470689 27.470689 Circumcenter by TRIANGLE_CIRCUMCENTER: 0: 4.080267 1: 10.925792 2: 10.30181 3: 7.1968544 Distances from circumcenter to vertices: 0.75804138 0.75804138 0.75804138 Circumcenter by TRIANGLE_CIRCUMCENTER: 0: 7.2509695 1: 9.69448 2: 10.9608 3: 7.0870929 Distances from circumcenter to vertices: 3.158838 3.158838 3.158838 Circumcenter by TRIANGLE_CIRCUMCENTER: 0: 114.31091 1: -31.881223 2: 33.211845 3: 3.380955 Distances from circumcenter to vertices: 120.13504 120.13504 120.13504 M2 = 5 Circumcenter by TRIANGLE_CIRCUMCENTER: 0: 1.5094042 1: 6.5501149 2: 9.1796047 3: 6.5835523 4: -12.025089 Distances from circumcenter to vertices: 21.573872 21.573872 21.573872 Circumcenter by TRIANGLE_CIRCUMCENTER: 0: 3.0183467 1: 12.062091 2: 10.068589 3: 6.1349448 4: 8.2778463 Distances from circumcenter to vertices: 0.70147519 0.70147519 0.70147519 Circumcenter by TRIANGLE_CIRCUMCENTER: 0: 3.0246849 1: 11.822808 2: 8.9116598 3: 5.0952787 4: 12.542414 Distances from circumcenter to vertices: 4.4524005 4.4524005 4.4524005 Circumcenter by TRIANGLE_CIRCUMCENTER: 0: 3.1580685 1: 6.7872669 2: -15.435129 3: -16.78378 4: 102.28733 Distances from circumcenter to vertices: 100.06235 100.06235 100.06235 TEST2067 For a triangle in 2D: TRIANGLE_CIRCUMCIRCLE_2D computes the circumcenter. TRIANGLE_CIRCUMCIRCLE_2D_2 computes the circumcenter. Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 0 1 Circumcenter 0: 0.5 1: 0.5 Circumradius: 0.70710678 Circumcenter2 0: 0.5 1: 0.5 Circumradius2: 0.70710678 Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 0.5 0.86602539 Circumcenter 0: 0.5 1: 0.28867513 Circumradius: 0.57735026 Circumcenter2 0: 0.5 1: 0.28867513 Circumradius2: 0.57735026 Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 0.5 10 Circumcenter 0: 0.5 1: 4.9875 Circumradius: 5.0125 Circumcenter2 0: 0.5 1: 4.9875 Circumradius2: 5.0125 Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 10 2 Circumcenter 0: 0.5 1: 23.5 Circumradius: 23.505319 Circumcenter2 0: 0.5 1: 23.5 Circumradius2: 23.505319 TEST21015 For a triangle in 2D: TRIANGLE_CIRCUMRADIUS_2D computes the circumradius. Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 0 1 Circumradius: 0.70710678 Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 0.5 0.86602539 Circumradius: 0.57735026 Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 0.5 10 Circumradius: 5.0125 Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 10 2 Circumradius: 23.505319 TRIANGLE_CONTAINS_LINE_EXP_3D_TEST TRIANGLE_CONTAINS_LINE_EXP_3D determines whether a triangle contains an explicit line in 3D. Triangle vertices: Row: 1 2 3 Col 1: 8 4 2 2: 9 0 5 3: 2 1 2 Line point P1: 0: 3 1: 0 2: -7 Line point P2: 0: 5 1: 1 2: -2 The triangle contains the line. Intersection point: 0: 7 1: 2 2: 3 Expected answer: The triangle contains the line, and the intersection point is at: 7, 2, 3. TRIANGLE_CONTAINS_LINE_PAR_3D_TEST TRIANGLE_CONTAINS_LINE_PAR_3D determines whether a triangle 'contains' a parametric line in 3D. Triangle vertices: Row: 1 2 3 Col 1: 8 4 2 2: 9 0 5 3: 2 1 2 Parametric base point P0: 0: 3 1: 0 2: -7 Parametric direction PD: 0: 0.36514837 1: 0.18257419 2: 0.91287093 The triangle contains the line. Intersection point: 0: 7 1: 2 2: 3 Expected answer: The triangle contains the line, and the intersection point is at: ( 7, 2, 3 ). TEST207 For a triangle in 2D, TRIANGLE_CONTAINS_POINT_2D_1 reports if a point is inside a triangle (and doesn't care about the ordering of the vertices); TRIANGLE_CONTAINS_POINT_2D_2 reports if a point is inside a triangle (and DOES care about the ordering of the vertices); TRIANGLE_CONTAINS_POINT_2D_3 reports if a point is inside a triangle (and doesn't care about the ordering of the vertices); Triangle vertices: Row: 1 2 Col 1: 0 1 2: 0 0 3: 1 0 X Y In1 In2 In3 0.25 0.25 true true true 0.75 0.25 true true true 1 1 false false false 11 0.5 false false false 0 1 true true true 0.5 -10 false false false 0.6 0.6 false false false Repeat the test, but reverse the triangle vertex ordering. Triangle vertices (reversed): Row: 1 2 Col 1: 1 0 2: 0 0 3: 0 1 X Y In1 In2 In3 0.25 0.25 true false true 0.75 0.25 true false true 1 1 false false false 11 0.5 false false false 0 1 true false true 0.5 -10 false false false 0.6 0.6 false false false TEST2075 TRIANGLE_DIAMETER_2D computes the diameter of the SMALLEST circle around the triangle. Triangle vertices: Row: 1 2 Col 1: 4 2 2: 1 5 3: -2 2 Diameter = 2.5618388 Triangle vertices: Row: 1 2 Col 1: 4 2 2: 5 4 3: 6 6 Diameter = 2.1147425 Triangle vertices: Row: 1 2 Col 1: 4 2 2: 1 5 3: 4 2 Diameter = 2.0597671 TEST208 For a triangle in 2D, TRIANGLE_GRIDPOINTS_2D produces a set of gridpoints in or on the triangle. Triangle vertices: Row: 1 2 Col 1: 0 1 2: 0 0 3: 1 0 Number of grid points is 10 Grid points: Col: 1 2 3 4 5 Row 1: 1 0.66666667 0.33333333 0 0.66666667 2: 0 0 0 0 0.33333333 Col: 6 7 8 9 10 Row 1: 0.33333333 0 0.33333333 0 0 2: 0.33333333 0.33333333 0.66666667 0.66666667 1 TEST2102 For a triangle in 2D: TRIANGLE_INCENTER_2D computes the incenter. Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 0 1 Incenter 0: 0.29289322 1: 0.29289322 Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 0.5 0.86602539 Incenter 0: 0.5 1: 0.28867513 Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 0.5 10 Incenter 0: 0.5 1: 0.47562461 Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 10 2 Incenter 0: 0.98924728 1: 0.097954785 TEST2070 For a triangle in 2D, TRIANGLE_INCIRCLE_2D computes the incircle; Triangle vertices: Row: 1 2 Col 1: 0 1 2: 0 0 3: 1 0 Incircle center is (0.29289322 0.29289322). Incircle radius is 0.29289322 TEST20701 For a triangle in 2D, TRIANGLE_INRADIUS_2D computes the inradius; Triangle vertices: Row: 1 2 Col 1: 0 1 2: 0 0 3: 1 0 Incircle radius is 0.29289322 TEST2104 TRIANGLE_LATTICE_LAYER_POINT_NEXT returns the next point in a triangle lattice layer defined by: C[2] - 1 < X[0]/C[0] + X[1]/C[1] <= C[2]. N = 2 C = 2 3 Layer 0 1 0 0 No more. Layer 1 1 1 0 2 2 0 3 0 1 4 1 1 5 0 2 6 0 3 No more. Layer 2 1 3 0 2 4 0 3 2 1 4 3 1 5 1 2 6 2 2 7 1 3 8 2 3 9 0 4 10 1 4 11 0 5 12 0 6 No more. Layer 3 1 5 0 2 6 0 3 4 1 4 5 1 5 3 2 6 4 2 7 3 3 8 4 3 9 2 4 10 3 4 11 1 5 12 2 5 13 1 6 14 2 6 15 0 7 16 1 7 17 0 8 18 0 9 No more. Layer 4 1 7 0 2 8 0 3 6 1 4 7 1 5 5 2 6 6 2 7 5 3 8 6 3 9 4 4 10 5 4 11 3 5 12 4 5 13 3 6 14 4 6 15 2 7 16 3 7 17 1 8 18 2 8 19 1 9 20 2 9 21 0 10 22 1 10 23 0 11 24 0 12 No more. TEST2105 TRIANGLE_LATTICE_POINT_NEXT returns the next lattice point in a triangle defined by: 0 <= X(1)/C(1) + X(2)/C(2) <= C(3). N = 2 C = 3 2 1 1 0 0 2 1 0 3 2 0 4 3 0 5 0 1 6 1 1 7 0 2 No more. TEST211 TRIANGLE_ORIENTATION_2D determines orientation of a triangle. Triangle vertices: Row: 1 2 Col 1: 4 2 2: 1 5 3: -2 2 The points are counterclockwise. Triangle vertices: Row: 1 2 Col 1: 1 5 2: 4 2 3: 1 -1 The points are clockwise. Triangle vertices: Row: 1 2 Col 1: 1 5 2: 2 7 3: 3 9 The points are colinear. Triangle vertices: Row: 1 2 Col 1: 1 5 2: 4 2 3: 1 5 The points are not distinct. TEST2103 For a triangle in 2D: TRIANGLE_ORTHOCENTER_2D computes the orthocenter. Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 0 1 Orthocenter 0: -0 1: 0 Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 0.5 0.86602539 Orthocenter 0: 0.5 1: 0.28867514 Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 0.5 10 Orthocenter 0: 0.5 1: 0.025 Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 10 2 Orthocenter 0: 10 1: -45 TEST2071 For a triangle in 2D, TRIANGLE_POINT_DIST_2D computes the distance to a point; Triangle vertices: Row: 1 2 Col 1: 0 1 2: 0 0 3: 1 0 P DIST 0.25 0.25 0.25 0.75 0.25 0 1 1 0.70710678 11 0.5 10.012492 0 1 0 0.5 -10 10 0.6 0.6 0.14142136 TEST20715 For a triangle in 2D, TRIANGLE_POINT_DIST_SIGNED_2D computes signed distance to a point; Triangle vertices: Row: 1 2 Col 1: 0 1 2: 0 0 3: 1 0 P DIST_SIGNED 0.25 0.25 -0.25 0.75 0.25 0 1 1 0.70710678 11 0.5 10.012492 0 1 0 0.5 -10 10 0.6 0.6 0.14142136 TRIANGLE_POINT_DIST_3D_TEST For a triangle in 3D: TRIANGLE_POINT_DIST_3D computes the distance to a point; Triangle vertices: Row: 1 2 3 Col 1: 1 2 3 2: 2.4142137 3.4142137 3 3: 1.7071068 2.7071068 4 P DIST 1 2 3 0 1.3535534 2.3535534 3 0 0 0 0 3.7416574 TRIANGLE_POINT_NEAR_2D_TEST For a triangle in 2D, TRIANGLE_POINT_NEAR_2D computes the nearest point to a point. Triangle vertices: Row: 1 2 Col 1: 0 1 2: 0 0 3: 1 0 P PN 0.25 0.25 0 0.25 0.75 0.25 0.75 0.25 1 1 0.5 0.5 11 0.5 1 0 0 1 0 1 0.5 -10 0.5 0 0.6 0.6 0.5 0.5 TRIANGLE_QUALITY_2D_TEST For a triangle in 2D: TRIANGLE_QUALITY_2D computes the quality. Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 0 1 Quality = 0.82842712 Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 0.5 0.86602539 Quality = 1 Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 0.5 10 Quality = 0.18977541 Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 10 2 Quality = 0.0083346911 TEST212 TRIANGLE_SAMPLE samples a triangle. TRIANGLE_XY_TO_XSI_2D converts XY to XSI coordinates. We are computing the XSI coordinates just to verify that the points are inside the triangle. Triangle vertices: Row: 1 2 Col 1: 4 2 2: 1 5 3: -2 2 Sample points (X,Y) and (XSI1,XSI2,XSI3) coordinates: 1.2571307 2.0612453 0.53264757 0.020415087 0.44693735 -0.2670547 3.1975892 0.089226025 0.39919638 0.51157759 1.938841 3.8055004 0.35555677 0.60183346 0.042609771 2.3100201 3.3551475 0.49247878 0.45171582 0.055805406 2.9737694 2.229892 0.79064624 0.076630655 0.13272311 2.9195877 2.4102856 0.75155035 0.13676185 0.1116878 0.66530938 2.4662338 0.3665126 0.15541125 0.47807614 1.3163477 4.6738033 0.10709074 0.89126777 0.0016414986 0.1610258 3.8452273 0.052633091 0.61507575 0.33229116 3.0649953 2.9098831 0.6925187 0.30329436 0.0041869395 TEST213 TRIANGLE_SAMPLE samples a triangle. TRIANGLE_XY_TO_XSI_2D converts XY to XSI coordinates. TRIANGLE_XSI_TO_XY_2D converts XSI to XY coordinates. We verify that (X,Y) -> (XSI1,XSI2,XSI3) -> (X,Y) works properly. Triangle vertices: Row: 1 2 Col 1: 4 2 2: 1 5 3: -2 2 Sample points: 1.2571307 2.0612453 0.53264757 0.020415087 0.44693735 1.2571307 2.0612453 1 3 0.33333333 0.33333333 0.33333333 1 3 3 0 1.1666667 -0.66666667 0.5 3 2.220446e-16 -0.2670547 3.1975892 0.089226025 0.39919638 0.51157759 -0.2670547 3.1975892 1.938841 3.8055004 0.35555677 0.60183346 0.042609771 1.938841 3.8055004 2.3100201 3.3551475 0.49247878 0.45171582 0.055805406 2.3100201 3.3551475 2.9737694 2.229892 0.79064624 0.076630655 0.13272311 2.9737694 2.229892 2.9195877 2.4102856 0.75155035 0.13676185 0.1116878 2.9195877 2.4102856 0.66530938 2.4662338 0.3665126 0.15541125 0.47807614 0.66530938 2.4662338 1.3163477 4.6738033 0.10709074 0.89126777 0.0016414986 1.3163477 4.6738033 TUBE_2D_TEST TUBE_2D computes corners of a tube of radius DIST surrounding a sequence of points. Test 0 Number of points N = 4 Tube radius DIST = 0.5 Points to surround: Row: 1 2 Col 1: 0 0 2: 4 3 3: 4 0 4: 0 0 P1: Row: 1 2 Col 1: -0.1 -0.7 2: 4.5 2.75 3: 4.5 -0.5 4: -0.5 -0.5 P2: Row: 1 2 Col 1: -0.7 0.1 2: 3.5 3.25 3: 3.5 0.5 4: -0.5 0.5 Test 1 Number of points N = 5 Tube radius DIST = 0.5 Points to surround: Row: 1 2 Col 1: 0 0 2: 2 0 3: 2 1 4: 0 1 5: 0 0 P1: Row: 1 2 Col 1: -0.5 -0.5 2: 2.5 -0.5 3: 2.5 1.5 4: -0.5 1.5 5: -0.5 -0.5 P2: Row: 1 2 Col 1: -0.5 0.5 2: 1.5 0.5 3: 1.5 0.5 4: 0.5 0.5 5: 0.5 -0.5 Test 2 Number of points N = 5 Tube radius DIST = 1 Points to surround: Row: 1 2 Col 1: 10 20 2: 20 20 3: 10 10 4: 20 10 5: 10 20 P1: Row: 1 2 Col 1: 9 19 2: 20.414214 19 3: 10.414214 9 4: 19.585786 9 5: 8.5857864 20 P2: Row: 1 2 Col 1: 9 21 2: 19.585786 21 3: 9.5857864 11 4: 20.414214 11 5: 10 21.414214 Test 3 Number of points N = 5 Tube radius DIST = 1 Points to surround: Row: 1 2 Col 1: 0 0 2: 10 0 3: 10 10 4: 10 0 5: 0 0 P1: Row: 1 2 Col 1: -1 -1 2: 11 -1 3: 11 11 4: 11 -1 5: -1 -1 P2: Row: 1 2 Col 1: -1 1 2: 9 1 3: 9 11 4: 9 1 5: -1 1 VECTOR_DIRECTIONS_ND_TEST VECTOR_DIRECTIONS_ND computes the angles that a vector makes with the axes. X Y Z AX AY AZ AX AY AZ (_____Radians_______) (_______Degrees_______) 1 0 0 0 1.5707963 1.5707963 0 90 90 1 2 3 1.3002466 1.0068537 0.64052231 74.49864 57.688467 36.699225 0 0 1 1.5707963 1.5707963 0 90 90 0 VECTOR_ROTATE_2D_TEST VECTOR_ROTATE_2D rotates a vector through a given angle around the origin. X1 Y1 Angle X2 Y2 1 0 30 0.8660254 0.5 0 2 -45 1.4142136 1.4142136 1 1 270 1 -1 VECTOR_ROTATE_3D_TEST VECTOR_ROTATE_3D rotates a vector through a given angle around the origin. Rotations will be about the following axis: 1 1 1 V1 Angle V2 ---------------------- ------ ---------------------- 1 0 0 0.5236 0.9107 0.3333 -0.244 0 2 0 -0.7854 1.012 1.609 -0.6212 0 0 3 1.571 2.732 -0.7321 1 1 1 1 4.712 1 1 1 1 1 -2 0.5236 2.719e-16 1.732 -1.732 Rotations will be about the following axis: 0 0 2 V1 Angle V2 ---------------------- ------ ---------------------- 1 1 1 90 -1 1 1 VECTOR_ROTATE_BASE_2D_TEST VECTOR_ROTATE_BASE_2D rotates a vector (X1,Y1) through an angle around a base point (XB,YB). P1 PB Angle P2 11 5 10 5 30 10.87 5.5 10 7 10 5 -45 11.41 6.414 11 6 10 5 270 11 4 10 5 10 5 20 10 5 VECTOR_SEPARATION_ND_TEST VECTOR_SEPARATION_ND computes the separation angle between two vectors. -----Vector 1----- -----Vector 2----- Radians Degrees 1 0 0 1 2 3 1.3 74.5 1 0 0 0 0 1 1.571 90 1 0 0 -3 2 -1 2.501 143.3 1 0 0 -2 -4 -6 1.841 105.5 1 2 3 0 0 1 0.6405 36.7 1 2 3 -3 2 -1 1.714 98.21 1 2 3 -2 -4 -6 3.142 180 0 0 1 -3 2 -1 1.841 105.5 0 0 1 -2 -4 -6 2.501 143.3 -3 2 -1 -2 -4 -6 1.427 81.79 VOXELS_DIST_L1_ND_TEST VOXELS_DIST_L1_ND prints the voxels on a line in 3D. P1: 1 1 5 P2: 9 4 4 L1 distance = 12 VOXELS_LINE_3D_TEST VOXELS_LINE_3D computes the voxels on a line in 3D starting at the first voxel, and heading towards the second one. Starting voxel: 1 1 5 Heading voxel: 9 4 4 Number of voxels we will compute is 13 The voxels: Row: 1 2 3 Col 1: 1 1 5 2: 2 1 5 3: 2 2 5 4: 3 2 5 5: 4 2 5 6: 5 2 5 7: 5 3 5 8: 5 3 4 9: 6 3 4 10: 7 3 4 11: 8 3 4 12: 8 4 4 13: 9 4 4 VOXELS_REGION_3D_TEST VOXELS_REGION_3D groups voxels into regions. Number of regions found = 3 The nonzero ISHOW array elements are: 2 4 1 2 2 5 1 2 2 7 1 2 3 3 1 2 3 4 1 2 3 5 1 2 3 6 1 2 3 7 1 2 4 4 1 2 4 5 1 2 4 7 1 2 5 7 1 2 6 2 1 1 6 3 1 1 6 6 1 2 6 7 1 2 7 3 1 1 8 8 1 3 The stack-based list of regions is: Region 3 includes 1 voxels: 8 8 1 Region 2 includes 14 voxels: 6 7 1 6 6 1 5 7 1 4 7 1 3 7 1 2 7 1 2 5 1 3 6 1 4 5 1 3 5 1 4 4 1 3 4 1 2 4 1 3 3 1 Region 1 includes 3 voxels: 7 3 1 6 3 1 6 2 1 VOXELS_STEP_3D_TEST VOXELS_STEP_3D steps along a line from one voxel to another. 0 1 1 5 1 2 1 5 2 2 2 5 3 3 2 5 4 4 2 5 5 5 3 4 6 6 3 4 7 7 3 4 8 7 4 4 9 8 4 4 10 9 4 4 Now, as a check, reverse direction and return. 0 9 4 4 1 8 4 4 2 8 3 4 3 7 3 4 4 6 3 4 5 5 2 5 6 4 2 5 7 3 2 5 8 3 1 5 9 2 1 5 10 1 1 5 WEDGE01_VOLUME_TEST WEDGE01_VOLUME returns the volume of the unit wedge. Volume = 1 GEOMETRY_PRB Normal end of execution. 06 August 2018 12:15:40 PM