29 October 2007 11:15:41 AM GEOMETRY_PRB C++ version Test the routines in the GEOMETRY library. TEST0005 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 TEST001 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 TEST002 ANGLE_DEG_2D computes an angle; ANGLE_RAD_ND computes an angle. X Y Theta atan2 ANGLE_RAD_ND, ANGLE_DEG_2D 1 0 0 0 0 0 0.866025 0.5 30 30 0.523599 30 0.5 0.866025 60 60 1.0472 60 6.12323e-17 1 90 90 1.5708 90 -0.5 0.866025 120 120 2.0944 120 -0.866025 0.5 150 150 2.61799 150 -1 1.22465e-16 180 180 3.14159 180 -0.866025 -0.5 210 -150 2.61799 210 -0.5 -0.866025 240 -120 2.0944 240 -1.83697e-16 -1 270 -90 1.5708 270 0.5 -0.866025 300 -60 1.0472 300 0.866025 -0.5 330 -30 0.523599 330 1 -2.44929e-16 360 -1.40334e-14 0 360 TEST0023 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 TEST0025 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 TEST003 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 TEST0032 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 TEST0035 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 TEST004 ARC_COSINE computes an angle with a given cosine; X ARC_COSINE(X) (Degrees) 5 0 0 1.2 0 0 1 0 0 0.9 0.451027 25.8419 0.5 1.0472 60 0 1.5708 90 -0.9 2.69057 154.158 -1 3.14159 180 -1.01 3.14159 180 TEST0045 ARC_SINE computes an angle with a given sine; X ARC_SINE(X) (Degrees) 5 1.5708 90 1.2 1.5708 90 1 1.5708 90 0.9 1.11977 64.1581 0.5 0.523599 30 0 0 0 -0.9 -1.11977 -64.1581 -1 -1.5708 -90 -1.01 -1.5708 -90 TEST005 ATAN4 computes an angle with a given tangent. X, Y, ATAN(Y/X), ATAN2(Y,X), ATAN4(Y,X) 1 0 0 0 0 1 1 0.785398 0.785398 0.785398 1 2 1.10715 1.10715 1.10715 1 0 0 0 0 1 -1 -0.785398 -0.785398 5.49779 -1 -1 0.785398 -2.35619 3.92699 -1 -1 0.785398 -2.35619 3.92699 0 -1 inf -1.5708 4.71239 Repeat, but display answers in degrees. 1 0 0 0 0 1 1 45 45 45 1 2 63.4349 63.4349 63.4349 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 TEST006 For the unit ball in 2 dimensions (the disk): BALL_UNIT_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 TEST007 For the unit ball in 3 dimensions: BALL_UNIT_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 TEST0075 For the unit ball in N dimensions: BALL_UNIT_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 TEST008 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 TEST0085 BOX_01_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. ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- TEST0087 BOX_CONTAINS_POINT_2D reports if a box contains a point. We will call the function repeatedly, and draw a sketch of the box. ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ------*************************************--- ------*************************************--- ------*************************************--- ------*************************************--- ------*************************************--- ------*************************************--- ------*************************************--- ------*************************************--- ------*************************************--- ------*************************************--- ------*************************************--- ------*************************************--- ------*************************************--- ------*************************************--- ------*************************************--- ------*************************************--- ------*************************************--- ------*************************************--- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- TEST009 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. TEST010 For a box with coordinate line sides in 2D, BOX_RAY_INT_2D computes the intersection of a shape and a ray whose origin is within the shape. 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 TEST011 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) TEST012 CIRCLE_LUNE_AREA_2D computes the area of a circular lune, defined by joining the endpoints of a circular arc. CIRCLE_SECTOR_AREA_2D computes the area of a circular sector, defined by joining the endpoints of a circular arc to the center. 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 Sector Triangle Lune 1 0 0 0 0 0 1 0 0.523599 0.261799 0.25 0.0117994 1 0 1.0472 0.523599 0.433013 0.0905861 1 0 1.5708 0.785398 0.5 0.285398 1 0 2.0944 1.0472 0.433013 0.614185 1 0 2.61799 1.309 0.25 1.059 1 0 3.14159 1.5708 6.12323e-17 1.5708 1 0 3.66519 1.8326 -0.25 2.0826 1 0 4.18879 2.0944 -0.433013 2.52741 1 0 4.71239 2.35619 -0.5 2.85619 1 0 5.23599 2.61799 -0.433013 3.05101 1 0 5.75959 2.87979 -0.25 3.12979 1 0 6.28319 3.14159 -1.22465e-16 3.14159 TEST0125 CIRCLE_LUNE_AREA_2D computes the area of a circular lune, defined by joining the endpoints of a circular arc (THETA1,THETA2). 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 Lune Cap Cap area vol_3d vol_nd -0.585686 0.585686 0.166667 0.125043 0.125043 0.125043 -0.841069 0.841069 0.333333 0.344165 0.344165 0.344165 -1.0472 1.0472 0.5 0.614185 0.614185 0.614185 -1.23096 1.23096 0.666667 0.91669 0.91669 0.91669 -1.40335 1.40335 0.833333 1.23901 1.23901 1.23901 -1.5708 1.5708 1 1.5708 1.5708 1.5708 -1.73824 1.73824 1.16667 1.90258 1.90258 1.90258 -1.91063 1.91063 1.33333 2.2249 2.2249 2.2249 -2.0944 2.0944 1.5 2.52741 2.52741 2.52741 -2.30052 2.30052 1.66667 2.79743 2.79743 2.79743 -2.55591 2.55591 1.83333 3.01655 3.01655 3.01655 -3.14159 3.14159 2 3.14159 3.14159 3.14159 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.166667 0.0824183 0.0824183 0.333333 0.310281 0.310281 0.5 0.654498 0.654498 0.666667 1.08598 1.08598 0.833333 1.57564 1.57564 1 2.0944 2.0944 1.16667 2.61315 2.61315 1.33333 3.10281 3.10281 1.5 3.53429 3.53429 1.66667 3.87851 3.87851 1.83333 4.10637 4.10637 2 4.18879 4.18879 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.166667 1.0472 1.0472 1 0.333333 2.0944 2.0944 1 0.5 3.14159 3.14159 1 0.666667 4.18879 4.18879 1 0.833333 5.23599 5.23599 1 1 6.28319 6.28319 1 1.16667 7.33038 7.33038 1 1.33333 8.37758 8.37758 1 1.5 9.42478 9.42478 1 1.66667 10.472 10.472 1 1.83333 11.5192 11.5192 1 2 12.5664 12.5664 TEST013 CIRCLE_LUNE_CENTROID_2D computes the centroid of a circular lune, defined by joining the endpoints of a circular arc. 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 lune and sector is always 0. Lune Sector THETA2 X Y X Y 0 7 3 6.33333 3 0.523599 6.69667 3.97958 6.14156 3.65908 1.0472 5.91994 4.59337 5.63662 4.10266 1.5708 5 4.65174 5 4.20042 2.0944 4.29498 4.22113 4.44867 3.95493 2.61799 4.01733 3.56734 4.14793 3.49194 3.14159 4.15117 3 4.15117 3 3.66519 4.50032 2.71151 4.39138 2.64861 4.18879 4.82867 2.70325 4.72434 2.52254 4.71239 5 2.83495 5 2.59986 5.23599 5.02731 2.95269 5.12732 2.77947 5.75959 5.0064 2.99631 5.10378 2.94008 6.28319 5 3 5 3 TEST014 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 TEST015 CIRCLE_EXP2IMP_2D computes the radius and center of the circle through three points. TRIANGLE_CIRCUMCIRCLE_2D computes the radius and center of the circle through the vertices of a triangle. The triangle: Row: 1 2 Col 1 4 2 2 1 5 3 -2 2 The implicit circle: Radius = 3 Center = (1, 2) The triangle's circumcircle: Radius = 3 Center = (1, 2) The triangle: Row: 1 2 Col 1 4 2 2 5 4 3 6 6 The implicit circle: Radius = -1 Center = (0, 0) The triangle's circumcircle: Radius = -1 Center = (0, 0) The triangle: Row: 1 2 Col 1 4 2 2 1 5 3 4 2 The implicit circle: Radius = 2.12132 Center = (2.5, 3.5) The triangle's circumcircle: Radius = -1 Center = (0, 0) 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 TEST017 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 TEST018 CIRCLE_IMP_POINT_DIST_2D finds the distance from a point to a circle. 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 Dist 1 Dist 2 3.53533 3.53574 0 0 3.53574 3.53533 0 0 The second circle: Radius = 3 Center = (4, 0) The circles intersect at two points: P Dist 1 Dist 2 4 3 0 0 4 -3 0 0 The second circle: Radius = 3 Center = (6, 0) The circles intersect at two points: P Dist 1 Dist 2 4.33333 2.49444 0 4.21468e-08 4.33333 -2.49444 0 4.21468e-08 The second circle: Radius = 5 Center = (0, 0) The circles coincide (infinite intersection). TEST0183 CIRCLE_LLR2IMP_3D 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 TEST0185 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 TEST019 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 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 TEST0201 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 TEST02015 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 = 1836396779 Base vector: 1 0 0 Using sigma = 0.99 0.97729731 0.048949359 0.20614057 0.99731326 -0.021694963 -0.069968556 0.9939987 -0.0036874801 0.10932975 0.99246424 0.049561653 0.11206414 0.99184621 0.031756749 0.12342042 0.99656787 -0.058702067 0.058365672 0.94495444 0.16503119 0.28253463 0.9815507 -0.13403165 -0.13635888 0.96205637 0.20770724 0.17693286 0.94591607 -0.29374309 0.13768726 0.99483109 -0.067672816 -0.075706604 0.99671733 -0.0090240229 -0.080455728 0.97050958 -0.1139368 -0.21243719 0.96467188 0.14483496 -0.22007043 0.99974264 0.01369718 -0.01808402 0.99934579 0.0086654076 -0.035112833 0.96843833 0.13295046 -0.21083496 0.99860926 -0.036759921 0.037792186 0.97853154 0.003903275 -0.20606016 0.99180642 0.10982938 -0.065249797 Using sigma = 0.5 0.79371778 -0.56676538 -0.22088251 0.086468679 -0.93666076 -0.3393962 -0.26218259 0.85793774 0.44181798 0.81747428 0.56931687 0.087258827 0.50591595 -0.71803771 0.4779863 -0.078821202 0.12132773 0.98947804 -0.2614197 0.34536578 -0.90132248 0.79502518 -0.088482166 0.60008822 -0.39611625 0.90633189 0.1471544 0.094350741 0.19080947 -0.97708223 0.87468661 -0.40960715 -0.25912414 -0.5231185 -0.23799337 0.81835579 0.46348049 0.84880191 -0.25440353 0.80292215 -0.32828269 -0.49754045 0.87362845 0.43255196 -0.22287247 -0.37977885 0.870102 0.31415049 0.50807903 0.2661946 -0.81914354 0.36291962 -0.23018428 -0.90294216 0.11879818 0.72465718 0.67879228 -0.021279441 -0.8735795 -0.48621605 Using sigma = 0.1 0.61334576 -0.24831414 -0.74976467 0.088184642 -0.55587291 0.82657654 -0.676438 -0.57363211 -0.46192838 0.44833756 0.55286879 0.70237421 0.50026138 0.33201273 -0.79969126 0.32805365 -0.21188662 -0.92058941 0.76249536 -0.17169951 0.62379492 0.9619482 0.13101835 -0.23977041 0.50012001 -0.84609306 -0.18440852 -0.36579097 0.32398446 -0.87248555 -0.80179277 0.48196218 0.3533282 0.82088404 0.35373522 -0.44835341 0.60043778 0.72403706 0.33947727 0.11238877 0.44955458 -0.8861543 0.66404874 0.030842808 -0.74705287 -0.17492398 -0.66983718 -0.72160914 0.27342673 -0.93480932 0.22664809 0.97097548 0.23206697 -0.057892399 0.63884029 -0.39249729 0.66168645 0.29591377 -0.56835822 0.7677265 TEST022 DIRECTION_UNIFORM_3D picks a random direction vector. We use SEED = 1836396779 -0.907185 0.21541672 -0.36140145 0.6334588 -0.19641488 0.74843246 -0.87629268 -0.029555651 0.4808717 -0.84922838 0.37558099 0.37114699 -0.91445226 0.23529358 0.3292628 -0.51409085 -0.51705385 0.68437264 -0.41448158 0.24210268 -0.87726354 0.69751992 -0.68561536 -0.20832077 -0.45961101 0.53955232 -0.70543675 -0.20847793 -0.44476847 -0.87104418 TEST023 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 TEST0232 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 TEST0238 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 TEST024 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 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 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 2.220446e-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 TEST0255: 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; ELLIPSE_AREA_2D returns the area of 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 TEST027 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 TEST028 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_3D returns dimension information; ICOS_SHAPE_3D 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 TEST033 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 TEST0335 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 TEST035 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 TEST038 LINES_EXP_ANGLE_3D finds the angle between two explicit lines in 3D; Angle between lines is 1.8925469 LINES_EXP_ANGLE_3D - Fatal error! One of the lines is degenerate! Angle between lines is -1 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. TEST039 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 TEST048 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 TEST0485 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. --------------------------------------------------- ---------------------------------------*----------- --------------------------------------**----------- -------------------------------------**------------ ------------------------------------***------------ -----------------------------------****------------ ----------------------------------****------------- ---------------------------------*****------------- --------------------------------******------------- -------------------------------******-------------- -------------------------------******-------------- -----------------------------********-------------- ----------------------------********--------------- ---------------------------*********--------------- --------------------------**********--------------- --------------------------**********--------------- -------------------------**********---------------- -----------------------************---------------- ----------------------************----------------- ----------------------************----------------- --------------------**************----------------- --------------------*************------------------ --------------------*************------------------ --------------------*************------------------ -------------------*************------------------- -------------------*************------------------- -------------------*************------------------- ------------------**************------------------- ------------------*************-------------------- -----------------**************-------------------- -----------------**************-------------------- -----------------*************--------------------- ----------------************----------------------- ----------------***********------------------------ ----------------**********------------------------- ----------------*********-------------------------- ---------------**********-------------------------- ---------------********---------------------------- --------------********----------------------------- --------------********----------------------------- --------------******------------------------------- -------------******-------------------------------- -------------******-------------------------------- -------------****---------------------------------- -------------***----------------------------------- ------------****----------------------------------- ------------**------------------------------------- ------------*-------------------------------------- -----------**-------------------------------------- -----------*--------------------------------------- ----------*---------------------------------------- TEST049 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 TEST050 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 TEST055 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 TEST056 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. 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 TEST065 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 TEST066 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 POINTS_DIST_SPHERE_3D measures 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 to South Pole 8507.3709 to Timbuktu 4995.7635 to San Antonio, Texas 974.43026 to Savannah, Georgia 114.22379 Distance from North Pole to South Pole 12431.282 to Timbuktu 5054.237 to San Antonio, Texas 4184.0473 to Savannah, Georgia 3999.8801 Distance from South Pole to Timbuktu 7377.0451 to San Antonio, Texas 8247.2349 to Savannah, Georgia 8431.402 Distance from Timbuktu to San Antonio, Texas 5969.4411 to Savannah, Georgia 4922.9356 Distance from San Antonio, Texas to Savannah, Georgia 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 TEST0757 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 TEST0786 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 TEST079 POLYGON_CONTAINS_POINT_2D determines if a point is in a polygon. POLYGON_CONTAINS_POINT_2D_2 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 In1 In2 1 1 1 1 3 4 0 0 0 2 1 1 0.5 -0.25 0 0 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 TEST0807 For a polygon in 3D: POLYGON_SOLID_ANGLE_3D computes the solid angle subtended by a planar polygon 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 TEST081 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 TEST082 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 0 0 0.56169544 0.41530708 0.066118735 0 0 0.25757779 0.10995679 0.043828998 1 1 0.63396571 0.061727229 0.44953896 0 0 0.40130628 0.75467349 0.79728695 0 0 0.0018383712 0.89750406 0.35075234 0 0 0.09454475 0.013616892 0.85909686 1 1 0.84084745 0.12310392 0.0075123641 1 1 0.260303 0.91248371 0.11366405 0 0 0.35162866 0.82288732 0.26713227 0 0 0.6920665 0.56166247 0.86121579 0 0 0.45379378 0.91197703 0.59791688 0 0 0.18895469 0.76149206 0.39698848 0 0 0.18531412 0.57436586 0.36702667 0 0 0.61720483 0.3615287 0.21293 0 0 0.71447121 0.11770687 0.29932915 0 0 0.82500295 0.82466007 0.061861771 0 0 0.71078052 0.088283334 0.77799401 0 0 0.74530307 0.30867492 0.89937309 0 0 0.76353672 0.76173065 0.40696964 0 0 0.93874945 0.56208829 0.017820022 0 0 0.50110323 0.041909255 0.36885058 1 1 0.2717236 0.85857256 0.029036559 0 0 0.017442279 0.15238379 0.11431867 1 1 0.35390726 0.11930783 0.20665276 1 1 0.21292396 0.61294755 0.80951907 0 0 0.58708963 0.21549164 0.76805636 0 0 0.72329672 0.44801899 0.85517612 0 0 0.9450175 0.90905692 0.51972572 0 0 0.030194625 0.48106695 0.29231288 1 1 0.90263984 0.66784151 0.41227804 0 0 0.15694849 0.83328163 0.96440416 0 0 0.74078991 0.45609886 0.65356142 0 0 0.40682695 0.5405386 0.83228094 0 0 0.14575576 0.71712832 0.77565076 0 0 0.36226162 0.53111085 0.37997675 0 0 0.26928526 0.87741782 0.7612848 0 0 0.913675 0.13579409 0.29119523 0 0 0.11821097 0.77178084 0.32063292 0 0 0.87741295 0.67947576 0.94917554 0 0 0.79336118 0.021366233 0.1022783 1 1 0.99140616 0.56325963 0.70452753 0 0 0.99414555 0.60433427 0.046145179 0 0 0.56202901 0.021515389 0.60913481 0 0 0.72878851 0.74840659 0.4696338 0 0 0.13519381 0.20234784 0.86012023 0 0 0.040624381 0.77397251 0.15594072 1 1 0.8957272 0.48712731 0.1486817 0 0 0.89334475 0.44520732 0.59934722 0 0 0.22868878 0.57229961 0.63961837 0 0 0.065984537 0.0021199146 0.62940518 1 1 0.41284158 0.62839709 0.46987913 0 0 0.25850863 0.75449328 0.76851336 0 0 0.40397812 0.66023587 0.58429849 0 0 0.30473519 0.68434467 0.78080031 0 0 0.91087828 0.13123077 0.59555485 0 0 0.49032273 0.8541589 0.84857995 0 0 0.083142974 0.38397163 0.41111234 1 1 0.56502614 0.39439151 0.53803625 0 0 0.77524304 0.50980575 0.30532421 0 0 0.58407567 0.55977837 0.19502922 0 0 0.85610338 0.52950225 0.34429286 0 0 0.53010092 0.40624102 0.69281382 0 0 0.1219051 0.85897081 0.72238234 0 0 0.079995959 0.49208465 0.46664356 0 0 0.87835927 0.5842312 0.17377787 0 0 0.68473125 0.2781112 0.21491455 0 0 0.068821287 0.67937532 0.26101204 0 0 0.82938312 0.44215812 0.35152215 0 0 0.032761876 0.62885028 0.08672083 1 1 0.51698762 0.011002505 0.91910495 0 0 0.39691029 0.87122759 0.72204768 0 0 0.45540351 0.96680422 0.078531014 0 0 0.87074958 0.68818572 0.33742109 0 0 0.036307152 0.21431001 0.90833914 0 0 0.4559097 0.47434153 0.25806522 0 0 0.30216186 0.43434113