geometry_test 08-Apr-2019 08:41:42 geometry_test MATLAB version Test geometry. 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. P1: 0.000000 0.000000 P2: 3.000000 0.000000 P3: 4.000000 2.000000 DIST = 1.000000 P4: 2.381966 1.000000 P5: 3.618034 -1.000000 P1: 0.000000 0.000000 P2: 3.000000 0.000000 P3: 2.000000 -2.000000 DIST = 1.000000 P4: 3.618034 -1.000000 P5: 2.381966 1.000000 P1: 3.000000 0.000000 P2: 3.000000 0.000000 P3: 2.000000 -2.000000 DIST = 1.000000 P4: 2.105573 0.447214 P5: 3.894427 -0.447214 ANGLE_CONTAINS_POINT_2D_TEST ANGLE_CONTAINS_POINT_2D sees if a point lies within an angle. Vertex P1 1: 1 2: 0 Vertex P2 1: 0 2: 0 Vertex P3 1: 1 2: 1 X Y Inside? 1.000000 0.000000 1 0.866025 0.500000 0 0.500000 0.866025 1 0.000000 1.000000 1 -0.500000 0.866025 1 -0.866025 0.500000 1 -1.000000 0.000000 1 -0.866025 -0.500000 1 -0.500000 -0.866025 1 -0.000000 -1.000000 1 0.500000 -0.866025 1 0.866025 -0.500000 1 1.000000 -0.000000 1 Vertex P1 1: 1 2: 0 Vertex P2 1: 0 2: 0 Vertex P3 1: 0 2: 1 X Y Inside? 1.000000 0.000000 1 0.866025 0.500000 0 0.500000 0.866025 0 0.000000 1.000000 1 -0.500000 0.866025 1 -0.866025 0.500000 1 -1.000000 0.000000 1 -0.866025 -0.500000 1 -0.500000 -0.866025 1 -0.000000 -1.000000 1 0.500000 -0.866025 1 0.866025 -0.500000 1 1.000000 -0.000000 1 Vertex P1 1: 1 2: -1 Vertex P2 1: 0 2: 0 Vertex P3 1: 0 2: 1 X Y Inside? 1.000000 0.000000 0 0.866025 0.500000 0 0.500000 0.866025 0 0.000000 1.000000 1 -0.500000 0.866025 1 -0.866025 0.500000 1 -1.000000 0.000000 1 -0.866025 -0.500000 1 -0.500000 -0.866025 1 -0.000000 -1.000000 1 0.500000 -0.866025 1 0.866025 -0.500000 0 1.000000 -0.000000 0 Vertex P1 1: 1 2: 0 Vertex P2 1: 0 2: 0 Vertex P3 1: -1 2: 0 X Y Inside? 1.000000 0.000000 1 0.866025 0.500000 0 0.500000 0.866025 0 0.000000 1.000000 0 -0.500000 0.866025 0 -0.866025 0.500000 0 -1.000000 0.000000 1 -0.866025 -0.500000 1 -0.500000 -0.866025 1 -0.000000 -1.000000 1 0.500000 -0.866025 1 0.866025 -0.500000 1 1.000000 -0.000000 1 Vertex P1 1: 1 2: 0 Vertex P2 1: 0 2: 0 Vertex P3 1: 0 2: -1 X Y Inside? 1.000000 0.000000 1 0.866025 0.500000 0 0.500000 0.866025 0 0.000000 1.000000 0 -0.500000 0.866025 0 -0.866025 0.500000 0 -1.000000 0.000000 0 -0.866025 -0.500000 0 -0.500000 -0.866025 0 -0.000000 -1.000000 0 0.500000 -0.866025 1 0.866025 -0.500000 1 1.000000 -0.000000 1 Vertex P1 1: 1 2: 0 Vertex P2 1: 0 2: 0 Vertex P3 1: 1 2: -0.01 X Y Inside? 1.000000 0.000000 1 0.866025 0.500000 0 0.500000 0.866025 0 0.000000 1.000000 0 -0.500000 0.866025 0 -0.866025 0.500000 0 -1.000000 0.000000 0 -0.866025 -0.500000 0 -0.500000 -0.866025 0 -0.000000 -1.000000 0 0.500000 -0.866025 0 0.866025 -0.500000 0 1.000000 -0.000000 1 ANGLE_DEG_2D_TEST ANGLE_DEG_2D computes an angle; X, Y, Theta, atan2(y, x), ANGLE_DEG_2D 1.000000 0.000000 0.000000 0.000000 0.000000 0.866025 0.500000 30.000000 30.000000 330.000000 0.500000 0.866025 60.000000 60.000000 300.000000 0.000000 1.000000 90.000000 90.000000 270.000000 -0.500000 0.866025 120.000000 120.000000 240.000000 -0.866025 0.500000 150.000000 150.000000 210.000000 -1.000000 0.000000 180.000000 180.000000 180.000000 -0.866025 -0.500000 210.000000 -150.000000 150.000000 -0.500000 -0.866025 240.000000 -120.000000 120.000000 -0.000000 -1.000000 270.000000 -90.000000 90.000000 0.500000 -0.866025 300.000000 -60.000000 60.000000 0.866025 -0.500000 330.000000 -30.000000 30.000000 1.000000 -0.000000 360.000000 -0.000000 0.000000 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: 1: 5.77646 2: 5.89778 Point P2: 1: 5 2: 3 Point P3: 1: 6.93185 2: 3.51764 End point of unit ray from P2, defining half angle, P4: 1: 5.70711 2: 3.70711 Expected value of P4: 1: 5.70711 2: 3.70711 ANGLE_RAD_2D_TEST ANGLE_RAD_2D computes the angle between two rays; Angle = 5.497787 Angle = 4.712389 Angle = 3.926991 Angle = 3.141593 Angle = 1.570796 Angle = 0.010000 ANGLE_RAD_3D_TEST ANGLE_RAD_3D computes an angle; P, ANGLE_RAD_3D, (Degrees) 1.000000 0.000000 0.000000 1.570796 90.000000 1.000000 2.000000 3.000000 0.640522 36.699225 0.000000 0.000000 1.000000 0.000000 0.000000 ANGLE_RAD_ND_TEST ANGLE_RAD_ND computes an angle. X, Y, Theta, atan2(y, x), ANGLE_RAD_ND 1.000000 0.000000 0.000000 0.000000 0.000000 0.866025 0.500000 30.000000 30.000000 0.523599 0.500000 0.866025 60.000000 60.000000 1.047198 0.000000 1.000000 90.000000 90.000000 1.570796 -0.500000 0.866025 120.000000 120.000000 2.094395 -0.866025 0.500000 150.000000 150.000000 2.617994 -1.000000 0.000000 180.000000 180.000000 3.141593 -0.866025 -0.500000 210.000000 -150.000000 2.617994 -0.500000 -0.866025 240.000000 -120.000000 2.094395 -0.000000 -1.000000 270.000000 -90.000000 1.570796 0.500000 -0.866025 300.000000 -60.000000 1.047198 0.866025 -0.500000 330.000000 -30.000000 0.523599 1.000000 -0.000000 360.000000 -0.000000 0.000000 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 Angle 1 0.000000 3.141593 2 30.000000 2.617994 3 60.000000 2.094395 4 90.000000 1.570796 5 120.000000 1.047198 6 150.000000 0.523599 7 180.000000 0.000000 8 210.000000 -0.523599 9 240.000000 -1.047198 10 270.000000 -1.570796 11 300.000000 -2.094395 12 330.000000 -2.617994 13 360.000000 -3.141593 ANNULUS_AREA_2D_TEST ANNULUS_AREA_2D computes the centroid of a circular annulus. The circle has center 5.000000 3.000000 The inner radius is R1 = 2.000000 The outer radius is R2 = 3.000000 Area: 15.707963 ANNULUS_SECTOR_AREA_2D_TEST ANNULUS_SECTOR_AREA_2D computes the centroid of a circular annulus. The circle has center 5.000000 3.000000 The inner radius is R1 = 2.000000 The outer radius is R2 = 3.000000 The first angle is THETA1 = 0.523599 The second angle is THETA2 = 1.047198 Area: 1.308997 ANNULUS_SECTOR_CENTROID_2D_TEST ANNULUS_SECTOR_CENTROID_2D computes the centroid of a circular annulus. The circle has center 5.000000 3.000000 The inner radius is R1 = 2.000000 The outer radius is R2 = 3.000000 The first angle is THETA1 = 0.523599 The second angle is THETA2 = 1.047198 Centroid: 6.770944 4.770944 BALL01_SAMPLE_2D_TEST BALL01_SAMPLE_2D samples the unit ball in 2d; A few sample values: 0.449860 -0.126667 -0.843197 -0.344280 0.589627 0.260090 0.391140 0.323400 -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_SAMPLE increases. Average: -0.000091 0.019733 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.215980 BALL01_SAMPLE_3D_TEST BALL01_SAMPLE_3D samples the unit ball in 3d; A few sample values: 0.747368 -0.210437 -0.529145 -0.345789 0.203599 0.049895 0.237652 0.196494 -0.170945 0.683223 0.279121 0.205248 0.026689 -0.908632 -0.183031 Number of sample points = 1000 Now average the points, which should get a value close to zero, and closer as N_SAMPLE increases. Average: 0.008976 0.005202 0.016862 Now average the distance of the points from the center, which should be the 1/2**(1/dim_num) = 0.793701 Average: 0.756237 Now average the angle THETA, which should be PI. Average: 3.128960 Now average the angle PHI, which should be PI/2. Average: 1.585480 BALL01_SAMPLE_ND_TEST BALL_UNIT_SAMPLE_ND samples the unit ball in N dimensions; A few sample values: -0.358320 0.064876 -0.521755 -0.710225 0.499314 0.274178 0.565223 0.228155 0.729504 0.481155 0.247561 -0.453197 0.626242 -0.091314 -0.734782 Number of sample points = 1000 Now average the points, which should get a value close to zero, and closer as N increases. Average: -0.017521 0.012085 -0.021175 Now average the distance of the points from the center, which should be the 1/2**(1/dim_num) = 0.793701 Average: 0.742079 Now average the angle THETA, which should be PI. Average: 3.116587 Now average the angle PHI, which should be PI/2. Average: 1.570236 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 TEST009 BOX_SEGMENT_CLIP_2D clips a line with respect to a box. The lower left box corner is: -10.000000 10.000000 The upper right box corner is: 10.000000 20.000000 We list the points PA and PB, and then the clipped values. 1.000000 2.000000 8.000000 16.000000 5.000000 10.000000 -3.000000 12.000000 5.000000 12.000000 Line is inside the box. -20.000000 20.000000 7.000000 20.000000 -10.000000 20.000000 -20.000000 40.000000 0.000000 0.000000 -10.000000 20.000000 -5.000000 10.000000 10.000000 40.000000 20.000000 30.000000 Line is outside the box. TEST010 For a box with coordinate line sides in 2D, BOX_RAY_INT_2D computes the intersection of the box and a ray whose origin is within the box. Lower left box corner: 0.000000 0.000000 Upper right box corner: 5.000000 3.000000 Origin: 3.000000 1.000000 Point 2: 5.000000 5.000000 Intersection: 4.000000 3.000000 Correct: 4.000000 3.000000 Origin: 4.000000 1.000000 Point 2: 3.000000 1.000000 Intersection: -0.000000 1.000000 Correct: 0.000000 1.000000 Origin: 3.000000 1.000000 Point 2: 4.000000 2.000000 Intersection: 5.000000 3.000000 Correct: 5.000000 3.000000 CIRCLE_AREA_2D_TEST CIRCLE_AREA_2D computes the area of a circle of radius R. R Area 1.000000 3.141593 2.000000 12.566371 4.000000 50.265482 8.000000 201.061930 CIRCLE_DIA2IMP_2D_TEST CIRCLE_DIA2IMP_2D converts a diameter to an implicit circle in 2D. P1: 1: -0.0807342 2: 7.54649 P2: 1: 4.08073 2: -1.54649 The implicit circle: Radius = 5.000000 Center = 2.000000 3.000000 CIRCLE_IMP_POINT_DIST_2D_TEST CIRCLE_IMP_POINT_DIST_2D checks, by finding the distance D from a point (X,Y) to a circle. The circle: Radius = 5.000000 Center = 0.000000 0.000000 X Y D -5.6316 9.1264 5.7241 6.5902 1.2339 1.7047 -1.6939 -8.6776 3.8414 -4.8484 -7.8009 4.1848 -9.1234 2.6793 4.5087 -8.7655 -1.0092 3.8234 -1.9739 5.0935 0.4626 5.9457 -9.9632 6.6025 7.9501 -2.9850 3.4920 -8.1091 -9.7277 7.6643 CIRCLE_IMP_PRINT_2D_TEST CIRCLE_IMP_PRINT_2D prints a circle definition. An example circle: Radius = 2.000000 Center = 5.000000 -2.000000 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.000000 -2.000000 6.283185 2.000000 -1.666667 5.111814 2.000000 -1.333333 4.601048 2.000000 -1.000000 4.188790 2.000000 -0.666667 3.821266 2.000000 -0.333333 3.476489 2.000000 0.000000 3.141593 2.000000 0.333333 2.806696 2.000000 0.666667 2.461919 2.000000 1.000000 2.094395 2.000000 1.333333 1.682137 2.000000 1.666667 1.171371 2.000000 2.000000 0.000000 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 2.000000 0.000000 0.000000 0.000000 2.000000 0.000000 0.523599 0.047198 2.000000 0.000000 1.047198 0.362344 2.000000 0.000000 1.570796 1.141593 2.000000 0.000000 2.094395 2.456739 2.000000 0.000000 2.617994 4.235988 2.000000 0.000000 3.141593 6.283185 2.000000 0.000000 3.665191 8.330383 2.000000 0.000000 4.188790 10.109631 2.000000 0.000000 4.712389 11.424778 2.000000 0.000000 5.235988 12.204026 2.000000 0.000000 5.759587 12.519173 2.000000 0.000000 6.283185 12.566371 CIRCLE_LUNE_AREA_BY_HEIGHT_2D_TEST CIRCLE_LUNE_AREA_BY_HEIGHT_2D computes the area of a circular lune based on the "height" of the circular triangle. R H Area 2.000000 -2.000000 12.566371 2.000000 -1.666667 12.066198 2.000000 -1.333333 11.189712 2.000000 -1.000000 10.109631 2.000000 -0.666667 8.899612 2.000000 -0.333333 7.610320 2.000000 0.000000 6.283185 2.000000 0.333333 4.956051 2.000000 0.666667 3.666759 2.000000 1.000000 2.456739 2.000000 1.333333 1.376659 2.000000 1.666667 0.500173 2.000000 2.000000 0.000000 CIRCLE_LUNE_CENTROID_2D_TEST0 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.000000 Center = 5.000000 3.000000 The first angle of our lune is always 0. THETA2 X Y 0.00000000 7.00000000 3.00000000 0.52359878 6.69667470 3.97957560 1.04719755 5.91993537 4.59337480 1.57079633 5.00000000 4.65174336 2.09439510 4.29497984 4.22113074 2.61799388 4.01733385 3.56734257 3.14159265 4.15117364 3.00000000 3.66519143 4.50031567 2.71150712 4.18879020 4.82867320 2.70325327 4.71238898 5.00000000 2.83495363 5.23598776 5.02731339 2.95269182 5.75958653 5.00639650 2.99630698 6.28318531 5.00000000 3.00000000 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.000000 0.000000 2.000000 2.000000 0.523599 1.931852 2.000000 1.047198 1.732051 2.000000 1.570796 1.414214 2.000000 2.094395 1.000000 2.000000 2.617994 0.517638 2.000000 3.141593 0.000000 2.000000 3.665191 -0.517638 2.000000 4.188790 -1.000000 2.000000 4.712389 -1.414214 2.000000 5.235988 -1.732051 2.000000 5.759587 -1.931852 2.000000 6.283185 -2.000000 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. R Theta1 Theta2 Area 2.000000 0.000000 0.000000 0.000000 2.000000 0.000000 0.523599 1.047198 2.000000 0.000000 1.047198 2.094395 2.000000 0.000000 1.570796 3.141593 2.000000 0.000000 2.094395 4.188790 2.000000 0.000000 2.617994 5.235988 2.000000 0.000000 3.141593 6.283185 2.000000 0.000000 3.665191 7.330383 2.000000 0.000000 4.188790 8.377580 2.000000 0.000000 4.712389 9.424778 2.000000 0.000000 5.235988 10.471976 2.000000 0.000000 5.759587 11.519173 2.000000 0.000000 6.283185 12.566371 CIRCLE_TRIANGLE_AREA_2D_TEST CIRCLE_TRIANGLE_AREA_2D computes the area of a circular triangle. R Theta1 Theta2 Area 2.000000 0.000000 0.000000 0.000000 2.000000 0.000000 0.523599 1.000000 2.000000 0.000000 1.047198 1.732051 2.000000 0.000000 1.570796 2.000000 2.000000 0.000000 2.094395 1.732051 2.000000 0.000000 2.617994 1.000000 2.000000 0.000000 3.141593 0.000000 2.000000 0.000000 3.665191 -1.000000 2.000000 0.000000 4.188790 -1.732051 2.000000 0.000000 4.712389 -2.000000 2.000000 0.000000 5.235988 -1.732051 2.000000 0.000000 5.759587 -1.000000 2.000000 0.000000 6.283185 -0.000000 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.000000 0.500000 1.500000 0.000000 1.000000 0.500000 1.000000 0.350767 1.000000 0.500000 0.500000 0.785398 1.000000 1.000000 1.500000 0.453312 1.000000 1.000000 1.000000 1.228370 1.000000 1.000000 0.000000 3.141593 CIRCLES_INTERSECT_POINTS_2D_TEST CIRCLES_INTERSECT_POINTS_2D determines the intersections of two circles in 2D. The first circle: Radius = 5.000000 Center = 0.000000 0.000000 The second circle: Radius = 0.500000 Center = 5.000000 5.000000 The circles do not intersect. The second circle: Radius = 5.000000 Center = 7.071068 7.071068 The circles intersect at two points: X Y 3.535329 3.535739 3.535739 3.535329 The second circle: Radius = 3.000000 Center = 4.000000 0.000000 The circles intersect at two points: X Y 4.000000 3.000000 4.000000 -3.000000 The second circle: Radius = 3.000000 Center = 6.000000 0.000000 The circles intersect at two points: X Y 4.333333 2.494438 4.333333 -2.494438 The second circle: Radius = 5.000000 Center = 0.000000 0.000000 The circles coincide (infinite intersection). 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.000000 H Cap Cap volume_3d volume_nd 0.000000 0.000000 0.000000 0.166667 0.082418 0.082418 0.333333 0.310281 0.310281 0.500000 0.654498 0.654498 0.666667 1.085983 1.085983 0.833333 1.575644 1.575644 1.000000 2.094395 2.094395 1.166667 2.613146 2.613146 1.333333 3.102808 3.102808 1.500000 3.534292 3.534292 1.666667 3.878509 3.878509 1.833333 4.106372 4.106372 2.000000 4.188790 4.188790 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.000000 0.000000 0.000000 0.000000 1.000000 0.166667 1.047198 1.047198 1.000000 0.333333 2.094395 2.094395 1.000000 0.500000 3.141593 3.141593 1.000000 0.666667 4.188790 4.188790 1.000000 0.833333 5.235988 5.235988 1.000000 1.000000 6.283185 6.283185 1.000000 1.166667 7.330383 7.330383 1.000000 1.333333 8.377580 8.377580 1.000000 1.500000 9.424778 9.424778 1.000000 1.666667 10.471976 10.471976 1.000000 1.833333 11.519173 11.519173 1.000000 2.000000 12.566371 12.566371 TEST013 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.000000 Center = 5.000000 3.000000 The first angle of our lune and sector is always 0. THETA2 X Y 0.00000000 6.33333333 3.00000000 0.52359878 6.14155535 3.65907729 1.04719755 5.63661977 4.10265779 1.57079633 5.00000000 4.20042175 2.09439510 4.44867110 3.95492966 2.61799388 4.14793149 3.49194198 3.14159265 4.15117364 3.00000000 3.66519143 4.39137964 2.64861287 4.18879020 4.72433555 2.52253517 4.71238898 5.00000000 2.59985942 5.23598776 5.12732395 2.77946844 5.75958653 5.10377776 2.94008388 6.28318531 5.00000000 3.00000000 TEST014 CIRCLE_EXP_CONTAINS_POINT_2D determines if a point lies inside a circle. P1: 1: 4 2: 2 P2: 1: 1 2: 5 P3: 1: -2 2: 2 P: 1: 2 2: 3 INSIDE = -1 The point is inside the circle. P1: 1: 4 2: 2 P2: 1: 1 2: 5 P3: 1: -2 2: 2 P: 1: 1 2: -1 INSIDE = 0 The point is on the circle. P1: 1: 4 2: 2 P2: 1: 1 2: 5 P3: 1: -2 2: 2 P: 1: 4 2: 6 INSIDE = 1 The point is outside the circle 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. P1: 1: 4 2: 2 P2: 1: 4 2: 2 P3: 1: 4 2: 2 The implicit circle: Radius = 0.000000 Center = 4.000000 2.000000 The triangle's circumcircle: Radius = -1.000000 Center = 0.000000 0.000000 P1: 1: 1 2: 5 P2: 1: 5 2: 4 P3: 1: 1 2: 5 The implicit circle: Radius = 2.061553 Center = 3.000000 4.500000 The triangle's circumcircle: Radius = -1.000000 Center = 0.000000 0.000000 P1: 1: -2 2: 2 P2: 1: 6 2: 6 P3: 1: 4 2: 2 The implicit circle: Radius = 5.000000 Center = 1.000000 6.000000 The triangle's circumcircle: Radius = 5.000000 Center = 1.000000 6.000000 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.000000 2.000000 2 30.000000 1.931852 3 60.000000 1.732051 4 90.000000 1.414214 5 120.000000 1.000000 6 150.000000 0.517638 7 180.000000 0.000000 8 210.000000 0.517638 9 240.000000 1.000000 10 270.000000 1.414214 11 300.000000 1.732051 12 330.000000 1.931852 13 360.000000 2.000000 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.000000 Center = 10.000000 5.000000 P1: 1: 13 2: 5 P2: 1: 8.5 2: 7.59808 P3: 1: 8.5 2: 2.40192 The recovered implicit circle: Radius = 3.000000 Center = 10.000000 5.000000 GEOMETRY_TEST016 CIRCLE_IMP_POINTS_2D gets points on a circle; POLYGON_AREA_2D finds the area of a polygon. The implicit circle: Radius = 2.000000 Center = 5.000000 -2.000000 The area = 12.566371 Sample results: Col: 1 2 3 4 5 Row 1 : 7 6.41421 5 3.58579 3 2 : -2 -0.585786 0 -0.585786 -2 Col: 6 7 8 Row 1 : 3.58579 5 6.41421 2 : -3.41421 -4 -3.41421 For any N, the sampled points define a polygon whose area approximates the circle area. N Area 3 5.196152 4 8.000000 5 9.510565 6 10.392305 7 10.945641 8 11.313708 9 11.570177 10 11.755705 11 11.894098 12 12.000000 13 12.082802 14 12.148745 15 12.202099 16 12.245870 17 12.282217 18 12.312725 19 12.338580 20 12.360680 21 12.379717 22 12.396233 23 12.410651 24 12.423314 TEST0165 CIRCLE_IMP_POINTS_3D gets points on a circle in 3D; The implicit circle: Radius = 2.000000 Center = 5.000000 -2.000000 1.000000 Normal = 1.000000 1.000000 1.000000 Points on the circle: Row: 1 2 3 Col 1: 4.1835 -2.8165 2.63299 2: 3.58579 -2 2.41421 3: 3.36701 -1.1835 1.8165 4: 3.58579 -0.585786 1 5: 4.1835 -0.367007 0.183503 6: 5 -0.585786 -0.414214 7: 5.8165 -1.1835 -0.632993 8: 6.41421 -2 -0.414214 9: 6.63299 -2.8165 0.183503 10: 6.41421 -3.41421 1 11: 5.8165 -3.63299 1.8165 12: 5 -3.41421 2.41421 TEST017 CIRCLE_IMP_POINTS_ARC_2D returns points on a circular arc. The implicit circle: Radius = 2.000000 Center = 5.000000 -2.000000 The arc extends from THETA1 = 1.570796 to THETA2 = 4.712389 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 TEST0183 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.175316 Point #P1: -5.631634 9.126352 Point #P2: 6.590185 1.233909 Point #Q1: -1.693858 -8.677625 Point #Q2: -4.848444 -7.800864 Center #1: 39.307969 -21.293222 Center #2: 32.675277 -17.010051 Center #1: 46.915076 -23.407483 Center #2: 40.282384 -19.124311 1.175316 1.175316 1.175316 1.175316 1.175316 1.175316 1.175316 1.175316 Radius R = 2.403009 Point #P1: 2.679314 -8.765455 Point #P2: -1.009221 -1.973874 Point #Q1: 5.093470 5.945739 Point #Q2: -9.963233 7.950081 Center #1: -1.754341 4.433109 Center #2: -4.592746 9.659372 Center #1: -7.649634 5.217888 Center #2: -10.488038 10.444151 2.403009 2.403009 2.403009 2.403009 2.403009 2.403009 2.403009 2.403009 Radius R = 1.454656 Point #P1: -8.109105 -9.727662 Point #P2: 7.181937 6.816949 Point #Q1: -7.537922 -9.849753 Point #Q2: -4.793940 8.249674 Center #1: -9.552352 -13.432406 Center #2: -6.032401 -9.623888 Center #1: -8.775002 -8.304971 Center #2: -5.255051 -4.496452 1.454656 1.454656 1.454656 1.454656 1.454656 1.454656 1.454656 1.454656 Radius R = 3.391668 Point #P1: -2.967427 6.457746 Point #P2: -4.657355 3.841330 Point #Q1: 1.233249 7.224316 Point #Q2: -0.924124 8.239541 Center #1: -6.561754 7.144073 Center #2: -2.848264 12.893452 Center #1: -0.368831 4.229786 Center #2: 3.344658 9.979165 3.391668 3.391668 3.391668 3.391668 3.391668 3.391668 3.391668 3.391668 Radius R = 1.851720 Point #P1: -6.220906 5.229841 Point #P2: -2.060230 -6.293718 Point #Q1: 1.487317 -2.659467 Point #Q2: 2.344097 -2.769426 Center #1: -6.379737 0.217101 Center #2: -4.966107 -3.698140 Center #1: -2.250974 -0.312786 Center #2: -0.837344 -4.228027 1.851720 1.851720 1.851720 1.851720 1.851720 1.851720 1.851720 1.851720 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.102682 Point #1: -5.631634 9.126352 6.590185 Point #2: 1.233909 -1.693858 -8.677625 Point #3: -4.848444 -7.800864 -9.123420 Center #1: -18.454343 -9.197675 0.798629 Center #2: 14.056617 16.630168 -2.886070 39.399808 24.448785 12.010052 27.642816 12.860624 9.808229 21.625966 25.547923 15.544639 30.485163 34.832444 7.206782 -0.584386 -9.327108 -7.824667 -4.651576 -2.917149 1.220077 -0.584386 -9.327108 -7.824667 -4.651576 -2.917149 1.220077 Radius R = 17.511453 Point #1: -8.765455 -1.009221 -1.973874 Point #2: 5.093470 5.945739 -9.963233 Point #3: 7.950081 -2.984953 -8.109105 Center #1: 5.592796 -10.698651 -4.544198 Center #2: -9.264781 15.635170 -7.392909 17.521429 13.181200 6.076318 15.568041 22.955776 15.241041 11.025467 34.387566 8.485358 20.928620 29.330712 18.450901 8.319610 -3.643021 -2.155212 -13.055351 -14.369827 10.166971 8.319610 -3.643021 -2.155212 -13.055351 -14.369827 10.166971 Radius R = 27.299856 Point #1: 7.181937 6.816949 -7.537922 Point #2: -9.849753 -4.793940 8.249674 Point #3: -7.726719 -2.967427 6.457746 Center #1: -3.717272 21.417517 12.792174 Center #2: 1.049456 -19.394508 -12.080421 15.632016 35.415332 21.920101 13.489786 42.872774 29.026928 12.025571 39.165375 27.363906 14.310177 32.687609 21.711321 -8.755807 -8.365034 7.003973 9.479129 4.066136 -9.898977 -8.755807 -8.365034 7.003973 9.479129 4.066136 -9.898977 Radius R = 10.902953 Point #1: 3.841330 1.233249 7.224316 Point #2: -0.924124 8.239541 1.958338 Point #3: -6.220906 5.229841 -2.060230 Center #1: -4.328564 -2.052790 0.795540 Center #2: 7.245769 11.525580 8.387113 15.203617 11.471853 7.127242 14.459343 11.103833 7.728032 6.909491 13.545503 8.555349 9.782213 16.041363 11.315921 -2.215817 -2.834409 -1.413430 -3.346101 -1.172636 -2.662430 -2.215817 -2.834409 -1.413430 -3.346101 -1.172636 -2.662430 Radius R = 9.727092 Point #1: 1.487317 -2.659467 2.344097 Point #2: -2.769426 -5.741400 4.289424 Point #3: -7.645863 -4.013417 6.500059 Center #1: -5.314776 3.579080 5.414664 Center #2: 4.032667 -11.979946 1.218857 10.581940 6.694782 9.489152 9.944922 11.299533 13.881759 7.356272 21.758142 4.047176 11.910784 19.709022 8.589527 0.767138 6.270984 -0.370028 6.416928 10.361500 -2.951977 0.767138 6.270984 -0.370028 6.416928 10.361500 -2.951977 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.625195 Point #1: -5.631634 9.126352 Point #2: 6.590185 1.233909 Center #1: -7.630503 -7.378243 Center #2: 8.589054 17.738503 16.875653 16.596755 16.757260 16.409940 14.230834 24.906475 7.621918 19.916994 Radius R = 7.533787 Point #1: -8.677625 -4.848444 Point #2: -7.800864 -9.123420 Center #1: -15.303101 -8.434669 Center #2: -1.175388 -5.537195 12.377269 3.594445 9.719672 0.935995 8.353137 3.215071 10.347374 4.240897 Radius R = 13.117065 Point #1: -8.765455 -1.009221 Point #2: -1.973874 5.093470 Center #1: 2.849325 -7.104650 Center #2: -13.588655 11.188899 12.238934 6.317637 5.319722 13.233254 13.472395 23.387399 21.998293 14.505615 Radius R = 17.577906 Point #1: -9.963233 7.950081 Point #2: -2.984953 -8.109105 Center #1: -20.453814 -6.154191 Center #2: 7.505628 5.995167 30.279259 14.609561 21.390487 3.723675 17.474513 16.077693 18.811490 16.720438 Radius R = 23.537818 Point #1: 7.181937 6.816949 Point #2: -7.537922 -9.849753 Center #1: -15.728017 12.217219 Center #2: 15.372032 -15.250023 32.142518 7.383561 10.081252 29.617846 11.843441 31.466555 34.073515 9.414851 CONE_VOLUME_TEST CONE_VOLUME computes the volume of a cone. R H ConeVolume 1.00000000 1.00000000 1.04719755 1.00000000 2.00000000 2.09439510 1.00000000 4.00000000 4.18879020 1.00000000 8.00000000 8.37758041 1.00000000 16.00000000 16.75516082 1.00000000 1.00000000 1.04719755 2.00000000 1.00000000 4.18879020 4.00000000 1.00000000 16.75516082 8.00000000 1.00000000 67.02064328 16.00000000 1.00000000 268.08257311 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 points = 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.577350 -0.577350 -0.577350 2 0.577350 -0.577350 -0.577350 3 0.577350 0.577350 -0.577350 4 -0.577350 0.577350 -0.577350 5 -0.577350 -0.577350 0.577350 6 0.577350 -0.577350 0.577350 7 0.577350 0.577350 0.577350 8 -0.577350 0.577350 0.577350 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 TEST0201 CYLINDER_POINT_DIST_3D computes the distance to a cylinder. Radius R = 1.000000 Center of bottom disk = 0.000000 -2.000000 0.000000 Center of top disk = 0.000000 2.000000 0.000000 P = 4.000000 0.500000 0.000000 DIST (computed) = 3.000000 DIST (exact) = 3.000000 P = -0.500000 -1.000000 0.000000 DIST (computed) = 0.500000 DIST (exact) = 0.500000 P = 4.000000 6.000000 0.000000 DIST (computed) = 5.000000 DIST (exact) = 5.000000 P = 0.750000 -10.000000 0.000000 DIST (computed) = 8.000000 DIST (exact) = 8.000000 P = 0.000000 0.000000 0.000000 DIST (computed) = 1.000000 DIST (exact) = 1.000000 P = 0.250000 1.750000 0.000000 DIST (computed) = 0.250000 DIST (exact) = 0.250000 TEST02015 CYLINDER_POINT_DIST_SIGNED_3D computes the signed distance to a cylinder. Radius R = 1.000000 Center of bottom disk = 0.000000 -2.000000 0.000000 Center of top disk = 0.000000 2.000000 0.000000 P = 4.000000 0.500000 0.000000 Signed distance (computed) = 3.000000 Signed distance (exact) = 3.000000 P = -0.500000 -1.000000 0.000000 Signed distance (computed) = -0.500000 Signed distance (exact) = -0.500000 P = 4.000000 6.000000 0.000000 Signed distance (computed) = 5.000000 Signed distance (exact) = 5.000000 P = 0.750000 -10.000000 0.000000 Signed distance (computed) = 8.000000 Signed distance (exact) = 8.000000 P = 0.000000 0.000000 0.000000 Signed distance (computed) = -1.000000 Signed distance (exact) = -1.000000 P = 0.250000 1.750000 0.000000 Signed distance (computed) = -0.250000 Signed distance (exact) = -0.250000 TEST0202 CYLINDER_POINT_INSIDE_3D determines if a point is inside a cylinder. Radius R = 1.000000 Center of bottom disk = 0.000000 -2.000000 0.000000 Center of top disk = 0.000000 2.000000 0.000000 P = 4.000000 0.500000 0.000000 INSIDE (computed) = 0 INSIDE (exact) = 0 P = -0.500000 -1.000000 0.000000 INSIDE (computed) = 1 INSIDE (exact) = 1 P = 4.000000 6.000000 0.000000 INSIDE (computed) = 0 INSIDE (exact) = 0 P = 0.750000 -10.000000 0.000000 INSIDE (computed) = 0 INSIDE (exact) = 0 P = 0.000000 0.000000 0.000000 INSIDE (computed) = 1 INSIDE (exact) = 1 P = 0.250000 1.750000 0.000000 INSIDE (computed) = 1 INSIDE (exact) = 1 TEST0203 CYLINDER_POINT_NEAR_3D computes the nearest point on a cylinder. Radius R = 1.000000 Center of bottom disk = 0.000000 -2.000000 0.000000 Center of top disk = 0.000000 2.000000 0.000000 P = 4.000000 0.500000 0.000000 PN (computed) = 1.000000 0.500000 0.000000 PN (exact) = 1.000000 0.500000 0.000000 P = -0.500000 -1.000000 0.000000 PN (computed) = -1.000000 -1.000000 0.000000 PN (exact) = -1.000000 -1.000000 0.000000 P = 4.000000 6.000000 0.000000 PN (computed) = 1.000000 2.000000 0.000000 PN (exact) = 1.000000 2.000000 0.000000 P = 0.750000 -10.000000 0.000000 PN (computed) = 0.750000 -2.000000 0.000000 PN (exact) = 0.750000 -2.000000 0.000000 P = 0.000000 0.000000 0.000000 PN (computed) = 1.000000 0.000000 0.000000 PN (exact) = 1.000000 0.000000 0.000000 P = 0.250000 1.750000 0.000000 PN (computed) = 0.250000 2.000000 0.000000 PN (exact) = 0.250000 2.000000 0.000000 (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.000000 Center of bottom disk = 0.000000 -2.000000 0.000000 Center of top disk = 0.000000 2.000000 0.000000 Sample points: Row: 1 2 3 Col 1: -0.361786 0.297463 -0.295853 2: -0.822879 -0.531893 -0.528382 3: 0.636297 0.468819 -0.651641 4: 0.0353627 -0.553885 -0.748629 5: 0.643093 -1.14828 0.0416893 6: -0.134375 0.857885 -0.21923 7: 0.332422 -1.52917 -0.383501 8: 0.266259 -0.802683 0.197643 9: -0.187781 1.30001 -0.0925602 10: 0.791611 1.29864 0.0855438 11: -0.232171 -1.75255 0.0884534 12: -0.253317 0.843122 0.620781 13: -0.485012 -1.64687 -0.407517 14: 0.248681 1.11198 0.832365 15: -0.469043 0.981212 -0.759793 16: -0.0247459 -0.7653 0.0350145 17: 0.87853 1.59749 -0.354527 18: -0.5907 1.05415 -0.0427268 19: 0.185407 1.04692 0.245293 20: 0.107185 -0.372121 -0.0461323 CYLINDER_VOLUME_3D_TEST CYLINDER_VOLUME_3D computes the volume of a cylinder. Radius R = 5.000000 Center of bottom disk = 1.000000 2.000000 3.000000 Center of top disk = 5.000000 6.000000 5.000000 Volume (computed) = 471.238898 Volume (exact) = 471.238898 DEGREES_TO_RADIANS_TEST DEGREES_TO_RADIANS converts an angle from degrees to radians; Degrees Radians Degrees -60.000000 -1.047198 -60.000000 -30.000000 -0.523599 -30.000000 0.000000 0.000000 0.000000 30.000000 0.523599 30.000000 60.000000 1.047198 60.000000 90.000000 1.570796 90.000000 120.000000 2.094395 120.000000 150.000000 2.617994 150.000000 180.000000 3.141593 180.000000 210.000000 3.665191 210.000000 240.000000 4.188790 240.000000 270.000000 4.712389 270.000000 300.000000 5.235988 300.000000 330.000000 5.759587 330.000000 360.000000 6.283185 360.000000 390.000000 6.806784 390.000000 420.000000 7.330383 420.000000 TEST021 DIRECTION_PERT_3D perturbs a direction vector. The base vector: 1: 1 2: 0 3: 0 Using Sigma = 0.990000 0.969803 -0.066101 -0.234759 0.996265 -0.032640 0.079941 0.982502 0.075169 -0.170408 0.973054 0.146926 -0.177701 0.938419 -0.257673 0.230163 0.945068 0.101910 0.310582 0.981823 -0.189720 -0.005573 0.995474 0.001098 -0.095025 0.997838 0.052982 0.038877 0.953378 0.025788 -0.300674 0.996965 -0.065511 -0.042065 0.958541 0.013445 -0.284637 0.973262 -0.120036 -0.195837 0.956979 0.232984 0.172943 0.996105 0.087664 0.009473 0.992652 -0.045717 0.112035 0.997014 0.022105 0.073989 0.998158 -0.035014 0.049543 0.966951 -0.254297 -0.018394 0.981608 0.175355 -0.075472 Using Sigma = 0.500000 0.515739 0.635388 0.574714 0.571248 0.627366 0.529234 -0.077113 -0.972283 0.220725 -0.313831 0.904237 0.289596 0.816593 -0.514859 -0.260950 -0.502559 -0.838426 0.210894 -0.405750 -0.899882 -0.159934 0.726619 0.640878 0.247589 0.896706 -0.441027 -0.037602 0.745544 0.367754 0.555807 0.937782 -0.132047 0.321137 -0.733017 -0.004715 0.680194 -0.590565 0.592245 0.548160 0.042542 -0.775496 -0.629917 -0.659198 0.082246 -0.747458 -0.219273 0.642079 -0.734611 0.189802 0.668985 -0.718634 -0.090818 0.968967 -0.229900 0.565819 -0.767542 -0.301212 0.532435 0.826651 -0.182099 Using Sigma = 0.100000 0.577189 -0.805143 0.136370 -0.029050 -0.789143 -0.613522 0.900754 -0.234895 -0.365332 0.109754 0.187443 -0.976125 0.035178 0.964270 0.262576 0.823866 -0.492928 0.279761 -0.099049 0.829799 -0.549202 0.697238 -0.158992 -0.698986 0.526706 0.231514 0.817913 0.363916 0.514665 0.776328 0.149672 -0.859520 -0.488695 -0.646578 -0.746634 0.156440 0.591218 0.614060 0.522869 0.131610 0.678698 0.722529 -0.385925 -0.642343 -0.662162 0.564669 -0.426020 -0.706863 -0.668394 0.719030 0.190383 -0.707300 -0.700304 -0.096442 -0.281483 -0.668151 -0.688724 0.412494 -0.285986 -0.864905 TEST022 DIRECTION_UNIFORM_3D picks a random direction vector. 0.795416 -0.223966 -0.563163 -0.696321 -0.284310 0.659018 0.901719 0.397757 -0.169386 0.674043 0.557308 -0.484844 -0.272750 -0.305351 -0.912342 -0.457329 0.150061 -0.876546 0.028783 -0.979903 -0.197387 0.803987 0.009287 0.594574 -0.358866 0.489058 0.795008 0.583030 0.050005 -0.810910 TEST023 DIRECTION_UNIFORM_ND picks a random direction vector. 0.908382 -0.255774 -0.306246 -0.125041 0.573676 0.253054 0.600374 0.496398 -0.484504 -0.542415 -0.652117 0.213976 0.026280 -0.894715 0.445834 0.005150 -0.123865 0.168802 0.974259 0.083559 0.140483 -0.218783 0.964532 0.045561 0.527168 -0.323123 -0.468440 0.631070 -0.063218 0.585015 -0.748625 -0.305485 -0.753564 0.225138 -0.504373 -0.356457 0.057864 -0.799979 0.236107 0.548579 TEST0232 DISK_POINT_DIST_3D finds the distance from a disk to a point in 3D. Disk radius = 2.000000 Disk center: 1: 0 2: 1.41421 3: 1.41421 Disk axis: 1: 0 2: 1 3: 1 Point: 1: 0 2: 0 3: 0 Distance = 2.000000, Expected = 2.000000 Point: 1: 0 2: 0.707107 3: 2.12132 Distance = 0.000000, Expected = 0.000000 Point: 1: 2 2: 1.41421 3: 1.41421 Distance = 0.000000, Expected = 0.000000 Point: 1: 10 2: 1.41421 3: 1.41421 Distance = 8.000000, Expected = 8.000000 Point: 1: 10 2: 5.65685 3: 5.65685 Distance = 10.000000, Expected = 10.000000 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.897598 -51 -25 -43 -0.897599 -0.448799 -25 -42 -51 -0.448797 0.000000 0 0 0 0.000000 0.448799 25 42 51 0.448797 0.897598 51 25 43 0.897599 1.346397 77 8 34 1.346395 1.795196 102 51 26 1.795197 2.243995 128 34 17 2.243994 2.692794 154 17 9 2.692796 3.141593 180 0 0 3.141593 3.590392 205 42 51 3.590390 4.039191 231 25 43 4.039191 4.487990 257 8 34 4.487988 4.936788 282 51 26 4.936790 5.385587 308 34 17 5.385587 5.834386 334 17 9 5.834388 6.283185 360 0 0 6.283185 6.731984 385 42 51 6.731982 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 points = 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.577350 0.577350 0.577350 2 0.577350 0.577350 -0.577350 3 0.577350 -0.577350 0.577350 4 0.577350 -0.577350 -0.577350 5 -0.577350 0.577350 0.577350 6 -0.577350 0.577350 -0.577350 7 -0.577350 -0.577350 0.577350 8 -0.577350 -0.577350 -0.577350 9 0.356822 0.934172 0.000000 10 -0.356822 0.934172 0.000000 11 0.356822 -0.934172 0.000000 12 -0.356822 -0.934172 0.000000 13 0.934172 0.000000 0.356822 14 0.934172 0.000000 -0.356822 15 -0.934172 0.000000 0.356822 16 -0.934172 0.000000 -0.356822 17 0.000000 0.356822 0.934172 18 0.000000 -0.356822 0.934172 19 0.000000 0.356822 -0.934172 20 0.000000 -0.356822 -0.934172 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: 6 Number of faces : 4 Maximum face order: 3 The dual of the tetrahedron: Number of vertices: 4 Number of edges: 6 Number of faces : 4 Maximum face order: 3 TEST024 DUAL_SHAPE_3D finds the dual of a polyhedron. Number of points = 20 Number of edges = 30 Number of faces = 12 Maximum face order = 5 Number of points = 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.850651 0.525731 0.000000 2 -0.850651 0.525731 0.000000 3 0.850651 -0.525731 0.000000 4 -0.850651 -0.525731 0.000000 5 0.525731 0.000000 0.850651 6 0.525731 0.000000 -0.850651 7 -0.525731 0.000000 0.850651 8 -0.525731 0.000000 -0.850651 9 0.000000 0.850651 0.525731 10 0.000000 -0.850651 0.525731 11 0.000000 0.850651 -0.525731 12 0.000000 -0.850651 -0.525731 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 ELLIPSE_AREA1_TEST MATLAB 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.72 ELLIPSE_AREA1_TEST Normal end of execution. ELLIPSE_AREA2_TEST MATLAB version ELLIPSE_AREA2 computes the area of an ellipse. Ellipse: 5 * x^2 + 2 * xy + 2 * y^2 = 10 Area = 104.72 ELLIPSE_AREA2_TEST Normal end of execution. ELLIPSE_AREA3_TEST MATLAB version ELLIPSE_AREA3 computes the area of an ellipse. Ellipse: (x/10)^2 + (y/3.33333)^2 = 1 Area = 104.72 ELLIPSE_AREA3_TEST Normal end of execution. ELLIPSE_POINT_DIST_2D_TEST: ELLIPSE_POINT_DIST_2D is given a point P, and finds the distance to an ellipse in 2D. The ellipse is (X/A)^2 + (Y/B)^2 = 1 A = 3.000000 B = 2.000000 P DIST -1.200000 3.900000 2.012360 -0.800000 3.600000 1.652439 -0.400000 3.300000 1.313793 0.000000 3.000000 1.000000 0.400000 2.700000 0.715386 0.800000 2.400000 0.465363 1.200000 2.100000 0.257003 1.600000 1.800000 0.099982 2.000000 1.500000 0.007981 2.400000 1.200000 0.000000 2.800000 0.900000 0.097827 3.200000 0.600000 0.311499 3.600000 0.300000 0.623086 4.000000 0.000000 1.000000 4.400000 -0.300000 1.416401 4.800000 -0.600000 1.856811 5.200000 -0.900000 2.312465 ELLIPSE_POINT_NEAR_2D_TEST: ELLIPSE_POINT_NEAR_2D is given a point P, and finds the nearest point PN on an ellipse in 2D. The ellipse is (X/A)^2 + (Y/B)^2 = 1 A = 3.000000 B = 2.000000 P PN -1.200000 3.900000 -0.823689 1.923138 -0.800000 3.600000 -0.583461 1.961810 -0.400000 3.300000 -0.309401 1.989335 0.000000 3.000000 0.000000 2.000000 0.400000 2.700000 0.344958 1.986734 0.800000 2.400000 0.723898 1.940902 1.200000 2.100000 1.132592 1.851994 1.600000 1.800000 1.562334 1.707384 2.000000 1.500000 1.995923 1.493138 2.400000 1.200000 2.400000 1.200000 2.800000 0.900000 2.719790 0.843996 3.200000 0.600000 2.908697 0.489662 3.600000 0.300000 2.984218 0.204879 4.000000 0.000000 3.000000 0.000000 4.400000 -0.300000 2.992027 -0.145716 4.800000 -0.600000 2.976051 -0.252210 5.200000 -0.900000 2.958199 -0.332704 ELLIPSE_POINTS_2D_TEST MATLAB version ELLIPSE_POINTS_2D returns points along an ellipse. Graphic saved in "ellipse_points_2d_test.png" ELLIPSE_POINTS_2D_TEST Normal end of execution. ELLIPSE_POINTS_ARC_2D_TEST ELLIPSE_POINTS_ARC_2D returns points on an elliptical arc. The ellipse has center 5.000000 -2.000000 radii R1 = 3.000000, R2 = 1.000000 and angle PSI = 0.523599 The arc extends from THETA1 = 1.570796 to THETA2 = 6.283185 Sample points: Row: 1 2 Col 1: 4.5 -1.13397 2: 3.54382 -1.77392 3: 2.80933 -2.44829 4: 2.40835 -3.05441 5: 2.40192 -3.5 6: 2.79103 -3.71723 7: 3.51644 -3.67303 8: 4.4677 -3.37413 9: 5.5 -2.86603 10: 6.45618 -2.22608 11: 7.19067 -1.55171 12: 7.59165 -0.945594 13: 7.59808 -0.5 TEST028 HALFPLANE_CONTAINS_POINT_2D determines whether a halfplane bounded by (XA,YA):(XB,YB) contains the point (X,Y). P1 = 0.000000 0.000000 P2 = 2.000000 0.000000 P = 1.000000 1.000000 Contains? = 1, Correct = 1 P1 = 0.000000 0.000000 P2 = 2.000000 0.000000 P = 1.000000 -1.000000 Contains? = 0, Correct = 0 P1 = -5.000000 -5.000000 P2 = 10.000000 10.000000 P = -1.000000 1.000000 Contains? = 1, Correct = 1 P1 = 3.000000 150.000000 P2 = 1.000000 50.000000 P = 2.000000 200.000000 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.000000 -2.000000 -3.000000 6.000000 Case 1 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 Intersections: (None) Case 2 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 Intersections: Row: 1 2 3 Col 1: -6 0 0 Case 3 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 Intersections: Row: 1 2 3 Col 1: 0 3 0 2: 0 0 2 3: 0 0 1 Case 4 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 Intersections: Row: 1 2 3 Col 1: -6 0 0 2: 0 4 0 3: 0 0 3 Case 5 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 Intersections: Row: 1 2 3 Col 1: -8 0 0 2: -6.4 -0.2 0 3: -7 0 -0.25 Case 6 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 Intersections: Row: 1 2 3 Col 1: 0 3 0 2: 0 4 0 3: 0 0 4 4: 0 0 1.2 TEST030 HALFSPACE_NORMAL_TRIANGLE_INT_3D finds intersection points of a normal form halfspace and a triangle. Plane point P: 1: -6 2: 0 3: 0 Plane normal: 1: 2 2: -4 3: -6 Case 1 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 Intersections: (None) Case 2 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 Intersections: Row: 1 2 3 Col 1: -6 0 0 Case 3 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 Intersections: Row: 1 2 3 Col 1: 0 3 0 2: 0 0 2 Case 4 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 Intersections: Row: 1 2 3 Col 1: -6 0 0 2: 0 4 0 3: 0 0 3 Case 5 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 Intersections: Row: 1 2 3 Col 1: -8 0 0 2: -6.4 -0.2 0 3: -6.85714 0 -0.285714 Case 6 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 Intersections: Row: 1 2 3 Col 1: 0 3 0 2: 0 4 0 3: 0 0 4 4: 0 0 2 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 HEXAGON01_SHAPE_2D: points on a unit hexagon. Angle X Y -10.000000 0.907604 -0.160035 0.000000 1.000000 0.000000 10.000000 0.907604 0.160035 20.000000 0.826352 0.300767 30.000000 0.750000 0.433013 40.000000 0.673648 0.565258 50.000000 0.592396 0.705990 60.000000 0.500000 0.866025 70.000000 0.315207 0.866025 80.000000 0.152704 0.866025 90.000000 0.000000 0.866025 100.000000 -0.152704 0.866025 110.000000 -0.315207 0.866025 120.000000 -0.500000 0.866025 130.000000 -0.592396 0.705990 140.000000 -0.673648 0.565258 150.000000 -0.750000 0.433013 160.000000 -0.826352 0.300767 170.000000 -0.907604 0.160035 180.000000 -1.000000 0.000000 190.000000 -0.907604 -0.160035 200.000000 -0.826352 -0.300767 210.000000 -0.750000 -0.433013 220.000000 -0.673648 -0.565258 230.000000 -0.592396 -0.705990 240.000000 -0.500000 -0.866025 250.000000 -0.315207 -0.866025 260.000000 -0.152704 -0.866025 270.000000 -0.000000 -0.866025 280.000000 0.152704 -0.866025 290.000000 0.315207 -0.866025 300.000000 0.500000 -0.866025 310.000000 0.592396 -0.705990 320.000000 0.673648 -0.565258 330.000000 0.750000 -0.433013 340.000000 0.826352 -0.300767 350.000000 0.907604 -0.160035 360.000000 1.000000 0.000000 370.000000 0.907604 0.160035 TEST0321 HEXAGON01_VERTICES_2D: the vertices of the unit hexagon. Vertices: Row: 1 2 Col 1: 1 0 2: 0.5 0.866025 3: -0.5 0.866025 4: -1 0 5: -0.5 -0.866025 6: 0.5 -0.866025 hyperball01_volume_test MATLAB version HYPERBALL01_VOLUME returns the volume of the unit hyperball in M dimensions. M Volume 1 2 2 3.14159 3 4.18879 4 4.9348 5 5.26379 6 5.16771 7 4.72477 8 4.05871 9 3.29851 10 2.55016 hyperball01_volume_test Normal end of execution. I4_UNIFORM_AB_TEST I4_UNIFORM_AB computes pseudorandom values in an interval [A,B]. The lower endpoint A = -100.000000 The upper endpoint B = 200.000000 The initial seed is 123456789 1 -35 2 187 3 149 4 69 5 25 6 -81 7 -23 8 -67 9 -87 10 90 11 -82 12 35 13 20 14 127 15 139 16 -100 17 170 18 5 19 -72 20 -96 I4_WRAP_TEST I4_WRAP forces an integer to lie within given limits. ILO = 4 IHI = 8 I I4_WRAP(I) -10 5 -9 6 -8 7 -7 8 -6 4 -5 5 -4 6 -3 7 -2 8 -1 4 0 5 1 6 2 7 3 8 4 4 5 5 6 6 7 7 8 8 9 4 10 5 11 6 12 7 13 8 14 4 15 5 16 6 17 7 18 8 19 4 20 5 TEST0322 I4COL_FIND_ITEM finds the first occurrence of an item in an I4COL. 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. GEOMETRY_TEST0323 I4COL_FIND_PAIR_WRAP finds the first occurrence of a pair of item in an I4COL. 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 I4VEC_HEAP_D_TEST For an integer vector, I4VEC_HEAP_D puts into descending heap form. Unsorted array: 1: 2 2: 10 3: 9 4: 6 5: 4 6: 0 7: 2 8: 1 9: 0 10: 6 Descending heap form: 1: 10 2: 6 3: 9 4: 2 5: 6 6: 0 7: 2 8: 1 9: 0 10: 4 I4VEC_INDICATOR1_TEST I4VEC_INDICATOR1 returns an indicator vector. The "indicator1" vector: 1: 1 2: 2 3: 3 4: 4 5: 5 6: 6 7: 7 8: 8 9: 9 10: 10 I4VEC_LCM_TEST I4VEC_LCM computes the least common multiple of the entries in an I4VEC. The I4VEC: 1: 120120 2: 90090 3: 750750 4: 330330 LCM = 99099000 I4VEC_PRINT_TEST I4VEC_PRINT prints an I4VEC The I4VEC: 1: 91 2: 92 3: 93 4: 94 I4VEC_UNIFORM_AB_TEST I4VEC_UNIFORM_AB computes pseudorandom values in an interval [A,B]. The lower endpoint A = -100.000000 The upper endpoint B = 200.000000 The initial seed is 123456789 The random vector: 1: -35 2: 187 3: 149 4: 69 5: 25 6: -81 7: -23 8: -67 9: -87 10: 90 11: -82 12: 35 13: 20 14: 127 15: 139 16: -100 17: 170 18: 5 19: -72 20: -96 TEST0325 For the icosahedron, ICOS_SIZE returns dimension information; ICOS_SHAPE returns face and order information. SHAPE_PRINT_3D prints this information. Number of points = 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.850651 0.525731 0.000000 2 0.850651 -0.525731 0.000000 3 0.525731 0.000000 0.850651 4 0.525731 0.000000 -0.850651 5 0.000000 0.850651 0.525731 6 0.000000 0.850651 -0.525731 7 0.000000 -0.850651 0.525731 8 0.000000 -0.850651 -0.525731 9 -0.525731 0.000000 0.850651 10 -0.525731 0.000000 -0.850651 11 -0.850651 0.525731 0.000000 12 -0.850651 -0.525731 0.000000 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: 1: 1 2: 3 Point 2: 1: 4 2: 0 Normal vector N: 1: 0.707107 2: 0.707107 TEST0335 LINE_EXP_POINT_DIST_2D finds the distance from an explicit line to a point in 2D. Point 1: 1: 1 2: 3 Point 2: 1: 4 2: 0 Point: 1: 0 2: 0 Distance = 2.828427 Point: 1: 5 2: -1 Distance = 0.000000 Point: 1: 5 2: 3 Distance = 2.828427 TEST0336 LINE_EXP_POINT_DIST_3D finds the distance from an explicit line to a point in 3D. Point 1: 1: 1 2: 3 3: 2 Point 2: 1: 4 2: 0 3: 1 Point: 1: 0 2: 5 3: 5 Distance = 2.533980 Point: 1: 0 2: -1 3: 3 Distance = 3.825125 Point: 1: 2 2: 1 3: 3 Distance = 1.622214 TEST0337 LINE_EXP_POINT_DIST_SIGNED_2D finds the signed distance to a point from an explicit line. Point 1: 1: 1 2: 3 Point 2: 1: 4 2: 0 Point: 1: 0 2: 0 Signed distance = 2.828427 Point: 1: 5 2: -1 Signed distance = 0.000000 Point: 1: 5 2: 3 Signed distance = -2.828427 TEST034 LINE_EXP_POINT_NEAR_2D finds the point on a line nearest in point in 2D. The point P1: 1: 1 2: 3 The point P2: 1: 4 2: 0 The point P: 1: 0 2: 0 Nearest point PN: 1: 2 2: 2 Distance = 2.828427 Relative line position T = 0.333333 The point P: 1: 5 2: -1 Nearest point PN: 1: 5 2: -1 Distance = 0.000000 Relative line position T = 1.333333 The point P: 1: 5 2: 3 Nearest point PN: 1: 3 2: 1 Distance = 2.828427 Relative line position T = 0.666667 LINE_EXP2IMP_2D_TEST LINE_EXP2IMP_2D converts explicit to implicit lines. Implicit line A, B, C = 1.000000 2.000000 3.000000 The point P1: 1: -0.6 2: -1.2 The point P2: 1: -1.2 2: -0.9 Recovered A, B, C = 0.238095 0.476190 0.714286 LINE_IMP2EXP_2D_TEST LINE_IMP2EXP_2D converts implicit to explicit lines. Implicit line A, B, C = 1.000000 2.000000 3.000000 The point P1: 1: -0.6 2: -1.2 The point P2: 1: -1.2 2: -0.9 Recovered A, B, C = 0.238095 0.476190 0.714286 TEST0346 LINE_EXP2PAR_2D converts explicit to parametric lines. LINE_PAR2EXP_2D converts parametric to explicit lines. Parametric line: F, G = 1.000000 2.000000 X0, Y0 = 3.000000 4.000000 The point P1: 1: 3 2: 4 The point P2: 1: 4 2: 6 Recovered parametric line: F, G = 0.447214 0.894427 X0, Y0 = 3.000000 4.000000 TEST035 LINE_IMP_POINT_DIST_2D finds the distance from a point X Y to a line A * X + B * Y + C = 0. X Y A B C DIST 0.000000 6.000000 2.000000 5.000000 3.000000 6.127946 0.000000 5.000000 2.000000 5.000000 3.000000 5.199469 0.000000 4.000000 2.000000 5.000000 3.000000 4.270993 GEOMETRY_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: 1: 0 2: 0 Distance = 2.82843 Nearest point PN: 1: 2 2: 2 Distance recomputed = 2.82843 The point P: 1: 5 2: -1 Distance = 0 Nearest point PN: 1: 5 2: -1 Distance recomputed = 0 The point P: 1: 5 2: 3 Distance = 2.82843 Nearest point PN: 1: 3 2: 1 Distance recomputed = 2.82843 GEOMETRY_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: 1: 0 2: 0 3: 2 Distance = 2.84697 Nearest point PN: 1: 1.94737 2: 2.05263 3: 1.68421 Distance recomputed = 2.84697 The point P: 1: 5 2: -1 3: 1 Distance = 0.324443 Nearest point PN: 1: 4.94737 2: -0.947368 3: 0.684211 Distance recomputed = 0.324443 The point P: 1: 5 2: 3 3: 3 Distance = 3.26061 Nearest point PN: 1: 2.73684 2: 1.26316 3: 1.42105 Distance recomputed = 3.26061 TEST038 LINES_EXP_ANGLE_3D finds the angle between two explicit lines in 3D; Angle between lines is 1.892547 Angle between lines is 1.570796 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.000000 0.000000 0.000000 P2 1.000000 2.000000 0.000000 Q1 0.000000 3.000000 3.000000 Q2 3.000000 0.000000 3.000000 LINES_EXP_DIST_3D = 3.000000 LINES_EXP_DIST_3D_2 = 3.000000 P1 4.000000 -3.000000 0.000000 P2 -8.000000 6.000000 0.000000 Q1 3.000000 4.000000 -1.000000 Q2 3.000000 4.000000 3.000000 LINES_EXP_DIST_3D = 5.000000 LINES_EXP_DIST_3D_2 = 5.000000 TEST03855 LINES_EXP_NEAR_3D finds nearest points on two explicit lines in 3D. P1 0.000000 0.000000 0.000000 P2 1.000000 2.000000 0.000000 Q1 0.000000 3.000000 3.000000 Q2 3.000000 0.000000 3.000000 PN 1.000000 2.000000 0.000000 QN 1.000000 2.000000 3.000000 P1 4.000000 -3.000000 0.000000 P2 -8.000000 6.000000 0.000000 Q1 3.000000 4.000000 -1.000000 Q2 3.000000 4.000000 3.000000 PN 0.000000 0.000000 0.000000 QN 3.000000 4.000000 0.000000 TEST0386 LINES_EXP_EQUAL_2D tries to determine if two explicit lines in 2D are equal. P1 0.000000 0.000000 P2 1.000000 2.000000 Q1 0.000000 0.000000 Q2 1.000000 2.000000 The lines are equal. P1 0.000000 0.000000 P2 1.000000 2.000000 Q1 1.000000 2.000000 Q2 0.000000 0.000000 The lines are equal. P1 0.000000 0.000000 P2 1.000000 2.000000 Q1 0.000000 0.000000 Q2 2.000000 4.000000 The lines are equal. P1 0.000000 0.000000 P2 1.000000 2.000000 Q1 7.000000 14.000000 Q2 5.500000 11.000000 The lines are equal. P1 0.000000 0.000000 P2 1.000000 2.000000 Q1 1.000000 2.000000 Q2 3.000000 5.000000 The lines are distinct. P1 0.000000 0.000000 P2 1.000000 2.000000 Q1 0.000000 10.000000 Q2 1.000000 12.000000 The lines are distinct. LINES_EXP_INT_2D_TEST LINES_EXP_INT_2D finds intersections of two explicit lines in 2D. P1 0.000000 2.000000 P2 4.000000 0.000000 Q1 0.000000 -1.000000 Q2 1.000000 0.000000 Intersection at 2.000000 1.000000 P1 0.000000 2.000000 P2 4.000000 0.000000 Q1 0.000000 0.250000 Q2 0.500000 0.000000 Lines are parallel, no intersection. P1 0.000000 2.000000 P2 4.000000 0.000000 Q1 0.000000 2.000000 Q2 4.000000 0.000000 Lines are coincident. TEST040 LINES_IMP_ANGLE_2D finds the angle between two lines written in implicit form. Line 1 coefficients: 1.000000 2.000000 -4.000000 Line 2 coefficients: 1.000000 -1.000000 -1.000000 Angle between lines is 108.434949 Line 1 coefficients: 1.000000 2.000000 -4.000000 Line 2 coefficients: 2.000000 4.000000 -1.000000 Angle between lines is 0.000001 Line 1 coefficients: 1.000000 2.000000 -4.000000 Line 2 coefficients: -3.000000 -6.000000 12.000000 Angle between lines is 179.999999 TEST041 LINES_IMP_DIST_3D finds the distance between two implicit lines in 2D. A1 B1 C1 A2 B2 C2 DIST 4.000000 -1.000000 3.000000 4.000000 -1.000000 12.000000 2.182821 2.000000 -1.000000 0.000000 4.000000 -2.000000 6.000000 1.341641 1.000000 2.000000 2.000000 2.000000 3.000000 1.000000 0.000000 LINES_IMP_INT_2D_TEST LINES_IMP_INT_2D finds the intersection of two lines written in implicit form. Line 1 coefficients: 1.000000 2.000000 -4.000000 Line 2 coefficients: 1.000000 -1.000000 -1.000000 Intersection at 2.000000 1.000000 Line 1 coefficients: 1.000000 2.000000 -4.000000 Line 2 coefficients: 2.000000 4.000000 -1.000000 Lines are parallel, no intersection. Line 1 coefficients: 1.000000 2.000000 -4.000000 Line 2 coefficients: -3.000000 -6.000000 12.000000 Lines are coincident. TEST0416 LINES_PAR_INT_2D finds the intersection of two lines written in parametric form. Line 1 parameters: 0.000000 1.000000 2.000000 1.000000 Line 2 parameters: 10.000000 -2.000000 1.000000 1.000000 Line 1 evaluated at T1: T1 = 13.000000 X(T1)= 26.000000 Y(T1)= 14.000000 Line 2 evaluated at T2: T2 = 16.000000 X(T2)= 26.000000 Y(T2)= 14.000000 Reported intersection: PINT(1) = 26.000000 PINT(2) = 14.000000 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.000000 2.000000 2 30.000000 1.931852 3 60.000000 1.732051 4 90.000000 1.414214 5 120.000000 1.000000 6 150.000000 0.517638 7 180.000000 0.000000 8 210.000000 0.517638 9 240.000000 1.000000 10 270.000000 1.414214 11 300.000000 1.732051 12 330.000000 1.931852 13 360.000000 2.000000 TEST042 SEGMENTS_DIST_2D computes the distance between line segments in 2D. Same slope, different intercepts. P1 = 2.000000 3.000000 P2 = 8.000000 6.000000 Q1 = 8.000000 3.000000 Q2 = 14.000000 6.000000 Distance([P1,P2],[Q1,Q2]) = 2.683282 Same slope, same intercepts, overlapping. Distance should be 0. P1 = 2.000000 3.000000 P2 = 8.000000 6.000000 Q1 = 4.000000 4.000000 Q2 = 14.000000 9.000000 Distance([P1,P2],[Q1,Q2]) = 0.000000 Same slope, same intercepts, disjoint. Distance should be sqrt(45)=6.7082038 P1 = 2.000000 3.000000 P2 = 8.000000 6.000000 Q1 = 14.000000 9.000000 Q2 = 16.000000 10.000000 Distance([P1,P2],[Q1,Q2]) = 6.708204 Different slopes, intersecting. Distance should be 0. P1 = 2.000000 3.000000 P2 = 8.000000 6.000000 Q1 = 0.000000 8.000000 Q2 = 5.000000 3.000000 Distance([P1,P2],[Q1,Q2]) = 0.000000 Different slopes, not intersecting. P1 = 2.000000 3.000000 P2 = 8.000000 6.000000 Q1 = 7.000000 3.000000 Q2 = 9.000000 -1.000000 Distance([P1,P2],[Q1,Q2]) = 2.236068 Simple problem. Distance should be 0 P1 = 57.000000 53.000000 P2 = 58.000000 53.000000 Q1 = 65.000000 45.000000 Q2 = 57.000000 53.000000 Distance([P1,P2],[Q1,Q2]) = 0.000000 Same data, translated by 50. Distance should be 0 P1 = 7.000000 3.000000 P2 = 8.000000 3.000000 Q1 = 15.000000 -5.000000 Q2 = 7.000000 3.000000 Distance([P1,P2],[Q1,Q2]) = 0.000000 Diagonal and horizontal. Distance should be sqrt(2500/2)=35.355339 P1 = 0.000000 0.000000 P2 = 100.000000 100.000000 Q1 = 50.000000 0.000000 Q2 = 60.000000 0.000000 Distance([P1,P2],[Q1,Q2]) = 35.355339 Same data, except first segment extended. Distance should be sqrt(2500/2)=35.355339 P1 = -10.000000 -10.000000 P2 = 100.000000 100.000000 Q1 = 50.000000 0.000000 Q2 = 60.000000 0.000000 Distance([P1,P2],[Q1,Q2]) = 35.355339 TEST043 SEGMENTS_DIST_3D computes the distance between line segments in 3D. Case Computed True 1 5.000000 5.0 1 0.000000 0.0 3 3.000000 3.0 4 0.000000 0.0 5 1.000000 1.0 6 3.000000 3.0 7 1.000000 1.0 8 10.000000 10.0 9 4.000000 4.0 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 1 -1.000000 1.000000 -1.000000 1.000000 -1.000000 1.000000 -2.000000 2 -1.000000 1.000000 3.000000 2.000000 2.000000 1.000000 1.000000 3 -1.000000 1.000000 1.000000 2.000000 1.000000 1.000000 0.000000 4 -1.000000 1.000000 0.500000 -3.000000 -1.000000 0.500000 -1.500000 5 -1.000000 1.000000 0.250000 0.500000 0.250000 0.500000 -0.250000 6 -1.000000 1.000000 0.500000 0.500000 0.500000 0.500000 0.000000 7 -1.000000 1.000000 2.000000 2.000000 2.000000 1.000000 1.000000 TEST045 SEGMENTS_INT_2D searches for an intersection of two line segments in 2D. All tests use the same line segment 1: P1 = -1.000000 3.000000 P2 = 1.000000 1.000000 Q1 = -1.000000 1.000000 Q2 = 1.000000 -1.000000 The line segments do not intersect. Q1 = 3.000000 -1.000000 Q2 = 2.000000 0.000000 The line segments do not intersect. Q1 = 0.000000 0.000000 Q2 = 0.000000 9.000000 The line segments do not intersect. Q1 = 1.000000 2.000000 Q2 = 3.000000 2.000000 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, YMIN = 9.000000 2.000000 The points straddle a minimum. XMIN, YMIN = 7.000000 2.000000 The points straddle a maximum. XMIN, YMIN = 2.000000 5.000000 TEST047 MINQUAD finds the minimum of a function F(X) = A * X * X + B * X + C within an interval, given three data points. The minimum lies in the interval. X1, Y1 = 0.000000 5.000000 X2, Y2 = 2.000000 5.000000 X3, Y3 = 3.000000 8.000000 XMIN, YMIN = 1.000000 4.000000 The minimum is to the left of the interval X1, Y1 = 2.000000 5.000000 X2, Y2 = 4.000000 13.000000 X3, Y3 = 5.000000 20.000000 XMIN, YMIN = 2.000000 5.000000 The function is flat. X1, Y1 = 11.000000 6.000000 X2, Y2 = 6.000000 6.000000 X3, Y3 = 2.000000 6.000000 XMIN, YMIN = 11.000000 6.000000 The function has a maximum. X1, Y1 = 0.000000 3.000000 X2, Y2 = 2.000000 3.000000 X3, Y3 = 3.000000 0.000000 XMIN, YMIN = 3.000000 0.000000 GEOMETRY_TEST0475 For the octahedron: OCTAHEDRON_SIZE_3D returns dimension information; OCTAHEDRON_SHAPE_3D returns face and order information. We will use this information to compute the areas and centers of each face. Number of points = 6 Number of edges = 12 Number of faces = 8 Maximum face order = 3 Face Order Area 1 3 0.866025 2 3 0.866025 3 3 0.866025 4 3 0.866025 5 3 0.866025 6 3 0.866025 7 3 0.866025 8 3 0.866025 Face Center 1 0.333333 -0.333333 -0.333333 2 0.333333 0.333333 -0.333333 3 -0.333333 0.333333 -0.333333 4 -0.333333 -0.333333 -0.333333 5 0.333333 -0.333333 0.333333 6 0.333333 0.333333 0.333333 7 -0.333333 0.333333 0.333333 8 -0.333333 -0.333333 0.333333 GEOMETRY_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.000000 TEST0478 PARALLELOGRAM_AREA_3D finds the area of a parallelogram in 3D. Vertices: Row: 1 2 3 Col 1: 1 2 3 2: 2.41421 3.41421 3 3: 1.70711 2.70711 4 4: 0.292893 0.292893 4 AREA = 2.000000 TEST048 PARALLELOGRAM_CONTAINS_POINT_2D determines if a point is within a parallelogram in 2D. P Inside? 1.000000 0.500000 1 2.000000 0.000000 0 0.500000 -0.100000 0 0.100000 0.500000 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.000000 1.000000 0.500000 1 3.000000 3.000000 0.000000 0 0.500000 0.500000 -0.100000 0 0.100000 0.100000 0.500000 0 1.500000 1.600000 0.500000 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.000000 -4.000000 10.000000 X, Y data X1, Y1 = 1.000000 8.000000 X2, Y2 = 2.000000 10.000000 X3, Y3 = 3.000000 16.000000 PARABOLA_EX returns (XMIN,YMIN) = 1.000000 8.000000 PARABOLA_EX2 returns (XMIN,YMIN) = 1.000000 8.000000 and (A,B,C) = 2.000000 -4.000000 10.000000 TEST0495 PARALLELEPIPED_POINT_DIST_3D computes the distance from a point to a box (parallelipiped) in 3D. The 4 box corners that are specified: 1 0.000000 0.000000 0.000000 2 2.000000 0.000000 0.000000 3 0.000000 8.000000 0.000000 4 0.000000 0.000000 1.000000 I P Distance to box 1 1.000000 4.000000 0.500000 1.118034 2 1.000000 0.000000 0.500000 0.000000 3 0.000000 4.000000 1.000000 0.000000 4 2.000000 8.000000 1.000000 0.000000 5 -0.500000 4.000000 0.500000 0.707107 6 1.000000 -1.000000 -1.000000 1.414214 7 3.000000 9.000000 2.000000 1.732051 TEST050 PLANE_EXP_NORMAL_3D finds the normal to a plane. Three points on the plane: P1: -10.560000 -10.560000 78.090000 P2: 44.660000 -65.770000 0.000000 P3: 44.660000 44.660000 0.000000 The normal vector: 1: 0.816487 2: 0 3: 0.577364 TEST051 PLANE_EXP2IMP_3D puts a plane defined by 3 points into A*X+B*Y+C*Z+D = 0 form. P1, P2, P3: -1.000000 0.000000 -1.000000 -4.000000 0.000000 0.000000 -20.000000 2.000000 4.000000 (A,B,C,D)= -2.000000 -4.000000 -6.000000 -8.000000 Correct answer is a multiple of 1, 2, 3, 4. P1, P2, P3: -16.000000 2.000000 4.000000 0.000000 0.000000 0.000000 4.000000 -2.000000 0.000000 (A,B,C,D)= -8.000000 -16.000000 -24.000000 0.000000 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. P1, P2, P3: -1.000000 0.000000 -1.000000 -4.000000 0.000000 0.000000 -20.000000 2.000000 4.000000 The point PP: 1: -1 2: 0 3: -1 Normal vector: 1: -0.267261 2: -0.534522 3: -0.801784 P1, P2, P3: -16.000000 2.000000 4.000000 0.000000 0.000000 0.000000 4.000000 -2.000000 0.000000 The point PP: 1: -16 2: 2 3: 4 Normal vector: 1: -0.267261 2: -0.534522 3: -0.801784 TEST053 PLANE_EXP_PROJECT_3D projects a point through a focus point into a plane. PO, PP, IVIS 0.000000 2.000000 2.000000 0.000000 0.500000 0.500000 3 4.000000 5.000000 -8.000000 4.000000 5.000000 -8.000000 3 0.250000 0.250000 0.250000 0.333333 0.333333 0.333333 1 5.000000 -2.000000 -3.000000 7647803531873692.000000 -3059121412749477.000000 -4588682119124216.000000 1 -2.000000 0.000000 0.000000 1.000000 0.000000 0.000000 -1 TEST054 PLANE_IMP2EXP_3D converts a plane in implicit (A,B,C,D) form to explicit form. (A,B,C,D) = 1.000000 -2.000000 -3.000000 6.000000 P1, P2, P3: -6.000000 0.000000 0.000000 -6.963624 -0.148250 -0.222375 -6.000000 -0.832050 0.554700 TEST055 PLANE_IMP2NORMAL_3D converts a plane in implicit (A,B,C,D) form to point, normal form. Input: (A,B,C,D) = 1.000000 -2.000000 -3.000000 6.000000 The point PP: 1: -6 2: 0 3: 0 Normal vector: 1: 0.267261 2: -0.534522 3: -0.801784 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.000000 2.000000 3.000000 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.000000 A nearest point on the line segment is 7.000000 2.000000 3.000000 A nearest point on the plane is 7.000000 2.000000 3.000000 The distance between the plane and the line segment is 4.008919 A nearest point on the line segment is 5.000000 1.000000 -2.000000 A nearest point on the plane is 3.928571 3.142857 1.214286 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.000000 0.000000 1.000000 -10.000000 (X,Y,Z) DISTANCE SIGNED_DISTANCE -12.000000 14.000000 0.000000 10.000000 -10.000000 7.000000 8.000000 9.000000 1.000000 -1.000000 1.000000 2.000000 10.000000 0.000000 0.000000 0.000000 0.000000 12.000000 2.000000 2.000000 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,B,C,D = 1.000000 -2.000000 -3.000000 6.000000 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.008919 Nearest points: Row: 1 2 3 Col 1: 5 1 -2 2: 3.92857 3.14286 1.21429 3: 5 1 -2 4: 3.92857 3.14286 1.21429 Triangle vertices: Row: 1 2 3 Col 1: 3 0 -7 2: 13 -4 -1 3: 9 3 8 Triangle to plane distance is 0.000000 Nearest points: Row: 1 2 3 Col 1: 10.3333 0.666667 5 2: 7 2 3 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.000000 -2.000000 -3.000000 6.000000 Case 1 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: (None) Case 2 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.3333 0.666667 5 Case 3 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 Case 4 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 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 test 1: Point PP: 1: 0.218418 2: 0.956318 3: 0.829509 Normal vector N: 1: 0.800502 2: 0.591876 3: 0.0942293 Vector PQ: 1: -0.0757679 2: -0.0560214 3: 0.995551 Vector PR: 1: -0.594521 2: 0.80408 3: 0 Dot product matrix: Col: 1 2 3 Row 1 : 1 1.38778e-17 -5.55112e-17 2 : 1.38778e-17 1 0 3 :-5.55112e-17 0 1 Dot product matrix: Col: 1 2 3 Row 1 : 1 3.46945e-18 -5.55112e-17 2 : 3.46945e-18 1 0 3 :-5.55112e-17 0 1 Dot product matrix: Col: 1 2 3 Row 1 : 1 5.42101e-20 0 2 : 5.42101e-20 1 0 3 : 0 0 1 Dot product matrix: Col: 1 2 3 Row 1 : 1 -1.73472e-18 0 2 :-1.73472e-18 1 0 3 : 0 0 1 Dot product matrix: Col: 1 2 3 Row 1 : 1 0 5.55112e-17 2 : 0 1 0 3 : 5.55112e-17 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: 1: -1 2: 1 3: 1 Plane Normal: 1: 0.267261 2: -0.534522 3: -0.801784 Line point P1: 1: 3 2: 0 3: -7 Line point P2: 1: 5 2: 1 3: -2 The plane and line intersect at 7.000000 2.000000 3.000000 Expected answer: The plane and line intersect at 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 for 5 points was 0.000000 GEOMETRY_TEST0617 PLANE_NORMAL_TETRAHEDRON_INTERSECT determines the intersection of a plane and tetrahedron. Plane normal vector number 1 0.000000 0.000000 1.000000 Point on plane: 0.000000 0.000000 0.000000 Number of intersection points = 3 1 0.000000 0.000000 0.000000 2 1.000000 0.000000 0.000000 3 0.000000 1.000000 0.000000 Point on plane: 0.000000 0.000000 0.200000 Number of intersection points = 3 1 0.000000 0.000000 0.200000 2 0.800000 0.000000 0.200000 3 0.000000 0.800000 0.200000 Point on plane: 0.000000 0.000000 0.400000 Number of intersection points = 3 1 0.000000 0.000000 0.400000 2 0.600000 0.000000 0.400000 3 0.000000 0.600000 0.400000 Point on plane: 0.000000 0.000000 0.600000 Number of intersection points = 3 1 0.000000 0.000000 0.600000 2 0.400000 0.000000 0.600000 3 0.000000 0.400000 0.600000 Point on plane: 0.000000 0.000000 0.800000 Number of intersection points = 3 1 0.000000 0.000000 0.800000 2 0.200000 0.000000 0.800000 3 0.000000 0.200000 0.800000 Point on plane: 0.000000 0.000000 1.000000 Number of intersection points = 1 1 0.000000 0.000000 1.000000 Point on plane: 0.000000 0.000000 1.200000 Number of intersection points = 0 Plane normal vector number 2 0.707107 0.707107 0.000000 Point on plane: 0.000000 0.000000 0.000000 Number of intersection points = 2 1 0.000000 0.000000 0.000000 2 0.000000 0.000000 1.000000 Point on plane: 0.141421 0.141421 0.000000 Number of intersection points = 4 1 0.282843 0.000000 0.000000 2 0.000000 0.282843 0.000000 3 0.000000 0.282843 0.717157 4 0.282843 0.000000 0.717157 Point on plane: 0.282843 0.282843 0.000000 Number of intersection points = 4 1 0.565685 0.000000 0.000000 2 0.000000 0.565685 0.000000 3 0.000000 0.565685 0.434315 4 0.565685 0.000000 0.434315 Point on plane: 0.424264 0.424264 0.000000 Number of intersection points = 4 1 0.848528 0.000000 0.000000 2 0.000000 0.848528 0.000000 3 0.000000 0.848528 0.151472 4 0.848528 0.000000 0.151472 Point on plane: 0.565685 0.565685 0.000000 Number of intersection points = 0 Point on plane: 0.707107 0.707107 0.000000 Number of intersection points = 0 Point on plane: 0.848528 0.848528 0.000000 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: 1: 0 2: 0 3: 2 The normal vector N: 1: 1 2: -2 3: -3 Case 1 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: (None) Case 2 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.3333 0.666667 5 Case 3 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 Case 4 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: 1: -1 2: 0 3: -1 Normal vector: 1: -0.267261 2: -0.534523 3: -0.801784 P1, P2, P3: -1.000000 0.000000 -1.000000 -1.963624 0.148250 -0.777625 -1.000000 -0.832050 -0.445300 TEST064 PLANE_NORMAL2IMP_3D puts a plane defined by point, normal form into implicit ABCD form. The point PP: 1: -1 2: 0 3: -1 Normal vector: 1: -0.267261 2: -0.534523 3: -0.801784 Output: (A,B,C,D)= -0.267261 -0.534523 -0.801784 -1.069045 The point PP: 1: -16 2: 2 3: 4 Normal vector: 1: -0.267261 2: -0.534523 3: -0.801784 Output: (A,B,C,D)= -0.267261 -0.534523 -0.801784 0.000001 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 #:5 TEST066 POINTS_COLIN_2D estimates the colinearity of three points. Points almost on a line: Expect COLIN to be close to 0 0.000000 0.000000 10.000000 10.000000 5.000000 4.990000 Colinearity index = 0.001299 Two points close, one far: Expect COLIN to be close to 0 0.000000 0.000000 0.000000 1.000000 100.000000 0.000000 Colinearity index = 0.025722 Points on an equilateral triangle: Expect COLIN to be close to 1 0.000000 0.000000 1.000000 0.000000 0.500000 0.866025 Colinearity index = 1.000000 GEOMETRY_TEST068 POINTS_DIST_SPHERE_3D measures the distance between two points on a sphere. All tests uses RADIUS = 3957.000000 which is the radius of the earth in miles. Distance from Atlanta, Georgia to North Pole is 3923.91118352 3923.91118352 3923.91118352 to South Pole is 8507.37094673 8507.37094673 8507.37094673 to Timbuktu is 4995.76351265 4995.76351265 4995.76351265 to San Antonio, Texas is 974.43026414 974.43026414 974.43026414 to Savannah, Georgia is 114.22379279 114.22379279 114.22379279 Distance from North Pole to South Pole is 12431.28213025 12431.28213025 12431.28213025 to Timbuktu is 5054.23702166 5054.23702166 5054.23702166 to San Antonio, Texas is 4184.04727254 4184.04727254 4184.04727254 to Savannah, Georgia is 3999.88012987 3999.88012987 3999.88012987 Distance from South Pole to Timbuktu is 7377.04510859 7377.04510859 7377.04510859 to San Antonio, Texas is 8247.23485771 8247.23485771 8247.23485771 to Savannah, Georgia is 8431.40200038 8431.40200038 8431.40200038 Distance from Timbuktu to San Antonio, Texas is 5969.44112133 5969.44112133 5969.44112133 to Savannah, Georgia is 4922.93556095 4922.93556095 4922.93556095 Distance from San Antonio, Texas to Savannah, Georgia is 1047.81549868 1047.81549868 1047.81549868 POLAR_TO_XY_TEST 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.563163 0.912635 1.072407 2.123676 -0.563163 0.912635 0.659018 0.123391 0.670470 0.185091 0.659018 0.123391 -0.169386 -0.867763 0.884140 -1.763571 -0.169386 -0.867763 -0.484844 -0.780086 0.918482 -2.126894 -0.484844 -0.780086 -0.912342 0.267931 0.950871 2.855949 -0.912342 0.267931 -0.876546 -0.100922 0.882336 -3.026961 -0.876546 -0.100922 -0.197387 0.509347 0.546256 1.940507 -0.197387 0.509347 0.594574 -0.996323 1.160249 -1.032757 0.594574 -0.996323 0.795008 -0.298495 0.849198 -0.359176 0.795008 -0.298495 -0.810910 -0.972766 1.266432 -2.265700 -0.810910 -0.972766 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.000000 X 0.500000 Y 0.500000 X*X 0.333333 X*Y 0.250000 Y*Y 0.333333 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: 1 63.434949 2 135.000000 3 270.000000 4 45.000000 5 90.000000 6 116.565051 GEOMETRY_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.000000 The computed area is 2.000000 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.000000 The computed area is 6.000000 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.000000 The computed area is 2.000000 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.000000 The computed area is 6.000000 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.449490 The computed area is 2.449490 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.000000 The computed area is 6.000004 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.449490 The computed area is 2.449490 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.000000 The computed area is 6.000004 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: 1: 1 2: 1 POLYGON_CENTROID_2D_2: 1: 1 2: 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: 1: 1 2: 1 3: 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.000000 1.000000 1 1 3.000000 4.000000 0 0 0.000000 2.000000 0 1 0.500000 -0.250000 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.000000 Diameter ( exact ) 2.000000 TEST0801 For a polygon in 2D: POLYGON_EXPAND_2D "expands" it by an amount H. The polygon vertices: Row: 1 2 Col 1: 1 1 2: 5 1 3: 2 4 4: 1 3 The expansion amount H = 0.500000 The expanded polygon: Row: 1 2 Col 1: 0.5 0.5 2: 6.20711 0.5 3: 2 4.70711 4: 0.5 3.20711 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.000000 AREA = 0.866025 RADIN = 0.288675 RADOUT = 0.577350 Assuming RADIN = 0.288675 AREA = 0.433013 RADOUT = 0.577350 SIDE = 1.000000 Assuming RADOUT = 0.577350 AREA = 0.433013 RADIN = 0.288675 SIDE = 1.000000 Number of polygonal sides = 4 Assuming SIDE = 1.000000 AREA = 2.000000 RADIN = 0.500000 RADOUT = 0.707107 Assuming RADIN = 0.500000 AREA = 1.000000 RADOUT = 0.707107 SIDE = 1.000000 Assuming RADOUT = 0.707107 AREA = 1.000000 RADIN = 0.500000 SIDE = 1.000000 Number of polygonal sides = 5 Assuming SIDE = 1.000000 AREA = 3.440955 RADIN = 0.688191 RADOUT = 0.850651 Assuming RADIN = 0.688191 AREA = 1.720477 RADOUT = 0.850651 SIDE = 1.000000 Assuming RADOUT = 0.850651 AREA = 1.720477 RADIN = 0.688191 SIDE = 1.000000 TEST0805 POLYGON_IS_CONVEX determines if a polygon is convex. Shape #1, a point: Row: 1 2 Col 1: 0 0 The polygon is degenerate and convex. Shape #2, a line: Row: 1 2 Col 1: 0 0 2: 1 2 The polygon is degenerate and convex. Shape #3, a flat triangle: Row: 1 2 Col 1: 0 0 2: 2 0 3: 1 0 The polygon is convex and clockwise. Shape #4, a CCW triangle: Row: 1 2 Col 1: 0 0 2: 1 0 3: 0 2 The polygon is convex and counterclockwise. Shape #5, a CW triangle: Row: 1 2 Col 1: 0 0 2: 0 2 3: 1 0 The polygon is convex and clockwise. #6, Polygon with large angle: Row: 1 2 Col 1: 1 0 2: 2 0 3: 3 1 4: 0 1 The polygon is convex and counterclockwise. #7, Polygon with huge angle: Row: 1 2 Col 1: 0 0 2: 0.5 0.5 3: 1 0 4: 1 1 5: 0 1 The polygon is not convex. #8, a star: Row: 1 2 Col 1: 1 0 2: -0.809017 0.587785 3: 0.309017 -0.951057 4: 0.309017 0.951057 5: -0.809017 -0.587785 The polygon is not convex. #9, regular hexagon: Row: 1 2 Col 1: 1 0 2: 0.5 0.866025 3: -0.5 0.866025 4: -1 1.22465e-16 5: -0.5 -0.866025 6: 0.5 -0.866025 The polygon is convex and counterclockwise. #10, double hexagon: Row: 1 2 Col 1: 0 0 2: 2 0 3: 1 1 4: 0 0 5: 2 0 6: 1 1 The polygon is not convex. #11, square knot: Row: 1 2 Col 1: 1 0 2: 3 0 3: 3 3 4: 0 3 5: 0 1 6: 2 1 7: 2 2 8: 1 2 The polygon is not convex. 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: 1: 0 2: 0 3: 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.570796 TEST # 2 The viewing point P: 1: 0 2: 0 3: 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.570796 TEST # 3 The viewing point P: 1: 1 2: 2 3: 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.570796 TEST # 4 The viewing point P: 1: 0 2: 0 3: 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.570796 TEST081 For a polyhedron in 3D: POLYHEDRON_AREA_3D computes surface area; Number of faces is 4 Order of each face: 1: 3 2: 3 3: 3 4: 3 Nodes per face: 1 3 2 1 2 1 2 4 3 1 4 3 4 2 3 4 Polyhedron nodes Row: 1 2 3 Col 1: 0 0 0 2: 1 0 0 3: 0 1 0 4: 0 0 1 Surface area = 2.366025 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: 1: 3 2: 3 3: 3 4: 3 Nodes per face: 1 3 2 1 2 1 2 4 3 1 4 3 4 2 3 4 Polyhedron nodes: Row: 1 2 3 Col 1: 0 0 0 2: 1 0 0 3: 0 1 0 4: 0 0 1 Computed centroid: 1: 0.25 2: 0.25 3: 0.25 Exact centroid: 1: 0.25 2: 0.25 3: 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: 1: 3 2: 3 3: 3 4: 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 1 0.218418 0.956318 0.829509 0 0 2 0.561695 0.415307 0.066119 0 0 3 0.257578 0.109957 0.043829 1 1 4 0.633966 0.061727 0.449539 0 0 5 0.401306 0.754673 0.797287 0 0 6 0.001838 0.897504 0.350752 0 0 7 0.094545 0.013617 0.859097 1 1 8 0.840847 0.123104 0.007512 1 1 9 0.260303 0.912484 0.113664 0 0 10 0.351629 0.822887 0.267132 0 0 11 0.692066 0.561662 0.861216 0 0 12 0.453794 0.911977 0.597917 0 0 13 0.188955 0.761492 0.396988 0 0 14 0.185314 0.574366 0.367027 0 0 15 0.617205 0.361529 0.212930 0 0 16 0.714471 0.117707 0.299329 0 0 17 0.825003 0.824660 0.061862 0 0 18 0.710781 0.088283 0.777994 0 0 19 0.745303 0.308675 0.899373 0 0 20 0.763537 0.761731 0.406970 0 0 21 0.938749 0.562088 0.017820 0 0 22 0.501103 0.041909 0.368851 1 1 23 0.271724 0.858573 0.029037 0 0 24 0.017442 0.152384 0.114319 1 1 25 0.353907 0.119308 0.206653 1 1 26 0.212924 0.612948 0.809519 0 0 27 0.587090 0.215492 0.768056 0 0 28 0.723297 0.448019 0.855176 0 0 29 0.945017 0.909057 0.519726 0 0 30 0.030195 0.481067 0.292313 1 1 31 0.902640 0.667842 0.412278 0 0 32 0.156948 0.833282 0.964404 0 0 33 0.740790 0.456099 0.653561 0 0 34 0.406827 0.540539 0.832281 0 0 35 0.145756 0.717128 0.775651 0 0 36 0.362262 0.531111 0.379977 0 0 37 0.269285 0.877418 0.761285 0 0 38 0.913675 0.135794 0.291195 0 0 39 0.118211 0.771781 0.320633 0 0 40 0.877413 0.679476 0.949176 0 0 41 0.793361 0.021366 0.102278 1 1 42 0.991406 0.563260 0.704528 0 0 43 0.994146 0.604334 0.046145 0 0 44 0.562029 0.021515 0.609135 0 0 45 0.728789 0.748407 0.469634 0 0 46 0.135194 0.202348 0.860120 0 0 47 0.040624 0.773973 0.155941 1 1 48 0.895727 0.487127 0.148682 0 0 49 0.893345 0.445207 0.599347 0 0 50 0.228689 0.572300 0.639618 0 0 51 0.065985 0.002120 0.629405 1 1 52 0.412842 0.628397 0.469879 0 0 53 0.258509 0.754493 0.768513 0 0 54 0.403978 0.660236 0.584298 0 0 55 0.304735 0.684345 0.780800 0 0 56 0.910878 0.131231 0.595555 0 0 57 0.490323 0.854159 0.848580 0 0 58 0.083143 0.383972 0.411112 1 1 59 0.565026 0.394392 0.538036 0 0 60 0.775243 0.509806 0.305324 0 0 61 0.584076 0.559778 0.195029 0 0 62 0.856103 0.529502 0.344293 0 0 63 0.530101 0.406241 0.692814 0 0 64 0.121905 0.858971 0.722382 0 0 65 0.079996 0.492085 0.466644 0 0 66 0.878359 0.584231 0.173778 0 0 67 0.684731 0.278111 0.214915 0 0 68 0.068821 0.679375 0.261012 0 0 69 0.829383 0.442158 0.351522 0 0 70 0.032762 0.628850 0.086721 1 1 71 0.516988 0.011003 0.919105 0 0 72 0.396910 0.871228 0.722048 0 0 73 0.455404 0.966804 0.078531 0 0 74 0.870750 0.688186 0.337421 0 0 75 0.036307 0.214310 0.908339 0 0 76 0.455910 0.474342 0.258065 0 0 77 0.302162 0.434341 0.971341 0 0 78 0.335417 0.358697 0.615840 0 0 79 0.424428 0.366481 0.438869 0 0 80 0.078173 0.849352 0.065509 1 1 81 0.003868 0.008359 0.486560 1 1 82 0.622276 0.598399 0.290530 0 0 83 0.944417 0.824733 0.290477 0 0 84 0.038914 0.034183 0.510304 1 1 85 0.677301 0.397581 0.151405 0 0 86 0.662250 0.428705 0.236546 0 0 87 0.628882 0.621841 0.281714 0 0 88 0.769302 0.663225 0.824001 0 0 89 0.986634 0.350637 0.151555 0 0 90 0.179257 0.770598 0.441796 0 0 91 0.263209 0.761996 0.869792 0 0 92 0.600145 0.629358 0.623897 0 0 93 0.830126 0.919770 0.573310 0 0 94 0.620359 0.368776 0.024396 0 0 95 0.023587 0.430812 0.652667 0 0 96 0.373921 0.493998 0.618198 0 0 97 0.055057 0.341973 0.532633 1 1 98 0.969348 0.825221 0.485053 0 0 99 0.285376 0.319971 0.754984 0 0 100 0.014932 0.956749 0.075678 0 0 TEST083 For a polyhedron in 3D: POLYHEDRON_VOLUME_3D computes volume. POLYHEDRON_VOLUME_3D_2 computes volume. Number of faces is 4 Order of each face: 1: 3 2: 3 3: 3 4: 3 Nodes per face: 1 3 2 1 2 1 2 4 3 1 4 3 4 2 3 4 Polyhedron nodes Row: 1 2 3 Col 1: 0 0 0 2: 1 0 0 3: 0 1 0 4: 0 0 1 Volume ( method 1 ) = 0.166667 Volume ( method 2 ) = 0.166667 Volume ( exact ) = 0.166667 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.000000 0.000000 0.000000 1.000000 1.000000 1.414214 2.000000 0.000000 2.828427 0.000000 0.000000 4.828427 We search for the point with coordinate 2.000000 The computed point: 1: 1.41421 2: 0.585786 TEST0844 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.666667 3: 0 0.333333 4: 0 0 5: 0.333333 0 6: 0.666667 0 7: 1 0 8: 1 0.333333 9: 1 0.666667 10: 1 1 11: 1 1.33333 12: 1 1.66667 13: 1 2 TEST0845 POLYLOOP_ARCLENGTH_ND computes the arclength of the nodes of a polyloop. P Arclength(P) 0.000000 0.000000 0.000000 1.000000 1.000000 1.414214 2.000000 0.000000 2.828427 0.000000 0.000000 4.828427 0.000000 0.000000 4.828427 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.45455 3: 0 0.909091 4: 0 0.363636 5: 0.181818 0 6: 0.727273 0 7: 1 0.272727 8: 1 0.818182 9: 1 1.36364 10: 1 1.90909 11: 0.545455 2 12: 0 2 PROVEC_TEST 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: 1: 1 2: 1 3: 1 4: 2 Projected vector in BASE coordinates: 1: 2.00832 2: 1.63299 Projected vector in original coordinates: 1: 0.8 2: 1.1 3: 1.4 4: 1.7 PYRAMID_VOLUME_3D_TEST MATLAB version PYRAMID_VOLUME_3d returns the volume of a pyramid. Radius Height Volume 2.9658 9.6069 112.6662 8.4656 6.0553 578.6090 4.7378 1.5951 47.7381 3.3182 1.9896 29.2087 1.3945 6.7057 17.3858 PYRAMID_VOLUME_3D_TEST Normal end of execution. PYRAMID01_VOLUME_3D_TEST MATLAB version PYRAMID01_VOLUME_3d returns the volume of the unit pyramid. Volume = 1.33333 PYRAMID01_VOLUME_3D_TEST Normal end of execution. 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.000000 QUAD_AREA2_2D area is 1.000000 GEOMETRY_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.828427 Sum of TRIANGLE_AREA_3D: 2.828427 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.250000 0.250000 1 -0.250000 0.250000 0.750000 0.250000 1 -0.250000 0.250000 1.000000 1.000000 1 0.000000 0.000000 11.000000 0.500000 0 10.000000 10.000000 0.000000 0.500000 1 0.000000 0.000000 0.500000 -10.000000 0 10.000000 10.000000 2.000000 2.000000 0 1.000000 1.414214 QUAD_ANGLES_TEST QUAD_ANGLES returns the angles of a quadrilateral in radians. Quadrilateral coordinates: 1: 0 0 2: 1 0 3: 1 1 4: 0 1 Interior angles: 1: 1.5708 2: 1.5708 3: 1.5708 4: 1.5708 Angles sum to 6.28319 Quadrilateral coordinates: 1: 0 0 2: 1 0 3: 2 1 4: 0 1 Interior angles: 1: 1.5708 2: 2.35619 3: 0.785398 4: 1.5708 Angles sum to 6.28319 Quadrilateral coordinates: 1: 0 0 2: 1 0 3: 0.25 0.25 4: 0 1 Interior angles: 1: 1.5708 2: 0.321751 3: 4.06889 4: 0.321751 Angles sum to 6.28319 Quadrilateral coordinates: 1: 0 0 2: 1 0 3: -0.5 0.5 4: 0 1 Interior angles: 1: 1.5708 2: 0.321751 3: 5.17604 4: 5.49779 Angles sum to 12.5664 QUAD_ANGLES_DEGREES_TEST QUAD_ANGLES_DEGREES returns the angles of a quadrilateral in degrees. Quadrilateral coordinates: 1: 0 0 2: 1 0 3: 1 1 4: 0 1 Interior angles: 1: 90 2: 90 3: 90 4: 90 Angles sum to 360 Quadrilateral coordinates: 1: 0 0 2: 1 0 3: 2 1 4: 0 1 Interior angles: 1: 90 2: 135 3: 45 4: 90 Angles sum to 360 Quadrilateral coordinates: 1: 0 0 2: 1 0 3: 0.25 0.25 4: 0 1 Interior angles: 1: 90 2: 18.4349 3: 233.13 4: 18.4349 Angles sum to 360 Quadrilateral coordinates: 1: 0 0 2: 1 0 3: -0.5 0.5 4: 0 1 Interior angles: 1: 90 2: 18.4349 3: 296.565 4: 315 Angles sum to 720 QUAD_CONVEX_RANDOM_TEST QUAD_CONVEX_RANDOM returns a random convex quadrilateral within the unit square. Quadrilateral coordinates: 1: 0.113664 0.351629 2: 0.822887 0.267132 3: 0.692066 0.561662 4: 0.260303 0.912484 QUAD_IS_CONVEX_TEST QUAD_IS_CONVEX is true if a quadrilateral is convex. Quadrilateral q: 1: 0.260303 0.912484 2: 0.113664 0.351629 3: 0.822887 0.267132 4: 0.692066 0.561662 quad_is_convex ( q ) = 1 Quadrilateral q: 1: 0.861216 0.453794 2: 0.911977 0.597917 3: 0.188955 0.761492 4: 0.396988 0.185314 quad_is_convex ( q ) = 1 Quadrilateral q: 1: 0.574366 0.367027 2: 0.617205 0.361529 3: 0.21293 0.714471 4: 0.117707 0.299329 quad_is_convex ( q ) = 0 Quadrilateral q: 1: 0.358697 0.61584 2: 0.424428 0.366481 3: 0.438869 0.0781727 4: 0.849352 0.0655086 quad_is_convex ( q ) = 0 Quadrilateral q: 1: 0.869792 0.600145 2: 0.629358 0.623897 3: 0.830126 0.91977 4: 0.57331 0.620359 quad_is_convex ( q ) = 0 QUAD_IS_SIMPLE_TEST QUAD_IS_SIMPLE is true if a quadrilateral is "simple", that is, non-degenerate. Quadrilateral q: 1: 0 0 2: 1 0 3: 1 1 4: 0 1 quad_is_simple ( q ) = 1 Quadrilateral q: 1: 0 0 2: 1 0 3: 2 1 4: 0 1 quad_is_simple ( q ) = 1 Quadrilateral q: 1: 0 0 2: 1 0 3: 0.25 0.25 4: 0 1 quad_is_simple ( q ) = 1 Quadrilateral q: 1: 0 0 2: 1 0 3: -0.5 0.5 4: 0 1 quad_is_simple ( q ) = 0 QUAD_RANDOM_TEST QUAD_RANDOM returns a random quadrilateral within the unit square. Quadrilateral q: 1: 0.218418 0.956318 2: 0.829509 0.561695 3: 0.415307 0.0661187 4: 0.257578 0.109957 quad_is_simple ( q ) = 0 quad_is_convex ( q ) = 0 Angles: 1: 305.502 2: 277.036 3: 245.644 4: 251.819 Angle sum = 1080 Area = -0.299037 Perimeter = 2.38429 Quadrilateral q: 1: 0.043829 0.633966 2: 0.0617272 0.449539 3: 0.401306 0.754673 4: 0.797287 0.00183837 quad_is_simple ( q ) = 0 quad_is_convex ( q ) = 0 Angles: 1: 44.4613 2: 53.6013 3: 284.198 4: 337.739 Angle sum = 720 Area = -0.124415 Perimeter = 2.47595 Quadrilateral q: 1: 0.897504 0.350752 2: 0.0945448 0.0136169 3: 0.859097 0.840847 4: 0.123104 0.00751236 quad_is_simple ( q ) = 0 quad_is_convex ( q ) = 0 Angles: 1: 1.12863 2: 335.521 3: 358.706 4: 24.6449 Angle sum = 720 Area = -0.00688112 Perimeter = 3.95617 Quadrilateral q: 1: 0.260303 0.912484 2: 0.113664 0.351629 3: 0.822887 0.267132 4: 0.692066 0.561662 quad_is_simple ( q ) = 1 quad_is_convex ( q ) = 1 Angles: 1: 65.5574 2: 82.1418 3: 59.2566 4: 153.044 Angle sum = 360 Area = 0.245717 Perimeter = 2.17255 Quadrilateral q: 1: 0.861216 0.453794 2: 0.911977 0.597917 3: 0.188955 0.761492 4: 0.396988 0.185314 quad_is_simple ( q ) = 1 quad_is_convex ( q ) = 1 Angles: 1: 139.445 2: 83.3452 3: 57.3996 4: 79.8102 Angle sum = 360 Area = 0.217919 Perimeter = 2.04295 QUAD_SIMPLE_RANDOM_TEST QUAD_SIMPLE_RANDOM returns a random simple quadrilateral within the unit square. Quadrilateral coordinates: 1: 0.260303 0.912484 2: 0.113664 0.351629 3: 0.822887 0.267132 4: 0.692066 0.561662 Angles: 1: 65.5574 2: 82.1418 3: 59.2566 4: 153.044 Angle sum = 360 Area = 0.245717 Perimeter = 2.17255 Quadrilateral coordinates: 1: 0.861216 0.453794 2: 0.911977 0.597917 3: 0.188955 0.761492 4: 0.396988 0.185314 Angles: 1: 139.445 2: 83.3452 3: 57.3996 4: 79.8102 Angle sum = 360 Area = 0.217919 Perimeter = 2.04295 Quadrilateral coordinates: 1: 0.574366 0.367027 2: 0.617205 0.361529 3: 0.21293 0.714471 4: 0.117707 0.299329 Angles: 1: 195.746 2: 33.8084 3: 61.7969 4: 68.6488 Angle sum = 360 Area = 0.0980145 Perimeter = 1.46743 Quadrilateral coordinates: 1: 0.358697 0.61584 2: 0.424428 0.366481 3: 0.438869 0.0781727 4: 0.849352 0.0655086 Angles: 1: 26.9517 2: 191.9 3: 94.6346 4: 46.5138 Angle sum = 360 Area = 0.102169 Perimeter = 1.69452 Quadrilateral coordinates: 1: 0.869792 0.600145 2: 0.629358 0.623897 3: 0.830126 0.91977 4: 0.57331 0.620359 Angles: 1: 1.74145 2: 298.517 3: 6.46168 4: 53.2795 Angle sum = 360 Area = 0.0090274 Perimeter = 1.2908 R8_ACOS_TEST R8_ACOS computes the arc-cosine of an angle. C R8_ACOS(C) ACOS(C) -1.16667 3.14159 -1 3.14159 3.14159 -0.833333 2.55591 2.55591 -0.666667 2.30052 2.30052 -0.5 2.0944 2.0944 -0.333333 1.91063 1.91063 -0.166667 1.73824 1.73824 0 1.5708 1.5708 0.166667 1.40335 1.40335 0.333333 1.23096 1.23096 0.5 1.0472 1.0472 0.666667 0.841069 0.841069 0.833333 0.585686 0.585686 1 0 0 1.16667 0 R8_ASIN_TEST R8_ASIN computes the arc-sine of a value between -1 and +1; X R8_ASIN(X) -1.100000 -1.570796 -1.000000 -1.570796 -0.900000 -1.119770 -0.800000 -0.927295 -0.700000 -0.775397 -0.600000 -0.643501 -0.500000 -0.523599 -0.400000 -0.411517 -0.300000 -0.304693 -0.200000 -0.201358 -0.100000 -0.100167 0.000000 0.000000 0.100000 0.100167 0.200000 0.201358 0.300000 0.304693 0.400000 0.411517 0.500000 0.523599 0.600000 0.643501 0.700000 0.775397 0.800000 0.927295 0.900000 1.119770 1.000000 1.570796 1.100000 1.570796 R8_ATAN_TEST R8_ATAN computes the arc-tangent given Y and X; ATAN2 is the system version of this routine. X Y ATAN2(Y,X) R8_ATAN(Y,X) 1.000000 0.000000 0.000000 0.000000 1.000000 1.000000 0.785398 0.785398 0.000000 1.000000 1.570796 1.570796 -1.000000 1.000000 2.356194 2.356194 -1.000000 0.000000 3.141593 3.141593 -1.000000 -1.000000 -2.356194 3.926991 0.000000 -1.000000 -1.570796 4.712389 1.000000 -1.000000 -0.785398 5.497787 R8_HAVERSINE_TEST R8_HAVERSINE computes the haversine of an angle. Degrees Radians Haversine 0.000000 0.000000 0.000000 30.000000 0.523599 0.066987 60.000000 1.047198 0.250000 90.000000 1.570796 0.500000 120.000000 2.094395 0.750000 150.000000 2.617994 0.933013 180.000000 3.141593 1.000000 210.000000 3.665191 0.933013 240.000000 4.188790 0.750000 270.000000 4.712389 0.500000 300.000000 5.235988 0.250000 330.000000 5.759587 0.066987 360.000000 6.283185 0.000000 R8_UNIFORM_01_TEST R8_UNIFORM_01 produces a sequence of random values. Using random seed 123456789 SEED R8_UNIFORM_01(SEED) 469049721 0.218418 2053676357 0.956318 1781357515 0.829509 1206231778 0.561695 891865166 0.415307 141988902 0.066119 553144097 0.257578 236130416 0.109957 94122056 0.043829 1361431000 0.633966 Verify that the sequence can be restarted. Set the seed back to its original value, and see that we generate the same sequence. SEED R8_UNIFORM_01(SEED) 469049721 0.218418 2053676357 0.956318 1781357515 0.829509 1206231778 0.561695 891865166 0.415307 141988902 0.066119 553144097 0.257578 236130416 0.109957 94122056 0.043829 1361431000 0.633966 R8_UNIFORM_AB_TEST R8_UNIFORM_AB returns random values in a given range: [ A, B ] For this problem: A = 10.000000 B = 20.000000 12.184183 19.563176 18.295092 15.616954 14.153071 10.661187 12.575778 11.099568 10.438290 16.339657 R82VEC_PART_QUICK_A_TEST R82VEC_PART_QUICK_A reorders an R82VEC as part of a quick sort. Using initial random number seed = Before rearrangement: 1: 2.18418 9.56318 2: 8.29509 5.61695 3: 4.15307 0.661187 4: 2.57578 1.09957 5: 0.43829 6.33966 6: 0.617272 4.49539 7: 4.01306 7.54673 8: 7.97287 0.0183837 9: 8.97504 3.50752 10: 0.945448 0.136169 11: 8.59097 8.40847 12: 1.23104 0.0751236 Rearranged array Left index = 4 Key index = 5 Right index = 6 Left half: 1: 1.23104 0.0751236 2: 0.945448 0.136169 3: 0.617272 4.49539 4: 0.43829 6.33966 Key: 1: 2.18418 9.56318 Right half: 1: 4.01306 7.54673 2: 7.97287 0.0183837 3: 8.97504 3.50752 4: 2.57578 1.09957 5: 8.59097 8.40847 6: 4.15307 0.661187 7: 8.29509 5.61695 R82VEC_PERMUTE_TEST R82VEC_PERMUTE permutes an R82VEC. Original array XY[]: 1: 1 11 2: 2 22 3: 3 33 4: 4 44 5: 5 55 Permutation vector P[]: 1: 2 2: 4 3: 5 4: 1 5: 3 Permuted array X[P[]]: 1: 2 22 2: 4 44 3: 5 55 4: 1 11 5: 3 33 R82VEC_PRINT_TEST R82VEC_PRINT prints an R82VEC. The R82VEC: 1: 2.18418 4.15307 2: 9.56318 0.661187 3: 8.29509 2.57578 4: 5.61695 1.09957 R82VEC_SORT_QUICK_A_TEST R82VEC_SORT_QUICK_A sorts an R82VEC using quick sort. Using initial random number seed = 123456789 Before rearrangement: 1: 2.18418 9.56318 2: 8.29509 3.50752 3: 0.43829 0.661187 4: 1.23104 1.09957 5: 0.43829 6.33966 6: 0.617272 9.56318 7: 8.59097 8.40847 8: 7.97287 0.0183837 9: 8.97504 3.50752 10: 0.945448 0.136169 11: 8.59097 8.40847 12: 1.23104 0.0751236 Sorted array: 1: 0.43829 0.661187 2: 0.43829 6.33966 3: 0.617272 9.56318 4: 0.945448 0.136169 5: 1.23104 0.0751236 6: 1.23104 1.09957 7: 2.18418 9.56318 8: 7.97287 0.0183837 9: 8.29509 3.50752 10: 8.59097 8.40847 11: 8.59097 8.40847 12: 8.97504 3.50752 R82VEC_SORT_HEAP_INDEX_A_TEST R82VEC_SORT_HEAP_INDEX_A index sorts an R82VEC using heapsort. Using initial random number seed = 123456789 Before rearrangement: 1: 2.18418 9.56318 2: 8.29509 3.50752 3: 0.43829 0.661187 4: 1.23104 1.09957 5: 0.43829 6.33966 6: 0.617272 9.56318 7: 8.59097 8.40847 8: 7.97287 0.0183837 9: 8.97504 3.50752 10: 0.945448 0.136169 11: 8.59097 8.40847 12: 1.23104 0.0751236 I Index A(Index) 1 3 4.382900e-01 6.611873e-01 2 5 4.382900e-01 6.339657e+00 3 6 6.172723e-01 9.563176e+00 4 10 9.454475e-01 1.361689e-01 5 12 1.231039e+00 7.512364e-02 6 4 1.231039e+00 1.099568e+00 7 1 2.184183e+00 9.563176e+00 8 8 7.972870e+00 1.838371e-02 9 2 8.295092e+00 3.507523e+00 10 7 8.590969e+00 8.408475e+00 11 11 8.590969e+00 8.408475e+00 12 9 8.975041e+00 3.507523e+00 After rearrangement by R82VEC_PERMUTE: 1: 0.43829 0.661187 2: 0.43829 6.33966 3: 0.617272 9.56318 4: 0.945448 0.136169 5: 1.23104 0.0751236 6: 1.23104 1.09957 7: 2.18418 9.56318 8: 7.97287 0.0183837 9: 8.29509 3.50752 10: 8.59097 8.40847 11: 8.59097 8.40847 12: 8.97504 3.50752 R8MAT_INVERSE_3D_TEST R8MAT_INVERSE_3D inverts a 3 by 3 matrix. Matrix A to be inverted: Col: 1 2 3 Row 1 : 1 2 3 2 : 4 5 6 3 : 7 8 0 Inverse matrix B: Col: 1 2 3 Row 1 : -1.77778 0.888889 -0.111111 2 : 1.55556 -0.777778 0.222222 3 : -0.111111 0.222222 -0.111111 Product C = A * B: Col: 1 2 3 Row 1 : 1 -1.11022e-16 0 2 : 3.33067e-16 1 1.11022e-16 3 : 1.77636e-15 -8.88178e-16 1 R8MAT_SOLVE_TEST 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.000000 1.000000 2.000000 0.000000 3.000000 2.000000 R8MAT_SOLVE_2D_TEST R8MAT_SOLVE_2D solves 2D linear systems. Solution / Computed: 0.415307 0.415307 0.066119 0.066119 Solution / Computed: 0.061727 0.061727 0.449539 0.449539 Solution / Computed: 0.897504 0.897504 0.350752 0.350752 Solution / Computed: 0.123104 0.123104 0.007512 0.007512 Solution / Computed: 0.822887 0.822887 0.267132 0.267132 R8MAT_UNIFORM_01_TEST R8MAT_UNIFORM_01 computes a random R8MAT. Initial seed is 123456789 Uniform R8MAT: Col: 1 2 3 4 Row 1 : 0.218418 0.0661187 0.0617272 0.00183837 2 : 0.956318 0.257578 0.449539 0.897504 3 : 0.829509 0.109957 0.401306 0.350752 4 : 0.561695 0.043829 0.754673 0.0945448 5 : 0.415307 0.633966 0.797287 0.0136169 R8MAT_UNIFORM_AB_TEST R8MAT_UNIFORM_AB sets an R8MAT to random values in [A,B]. Using initial random number seed = 123456789 The random matrix: Col: 1 2 3 4 Row 1 : 3.74735 2.52895 2.49382 2.01471 2 : 9.65054 4.06062 5.59631 9.18003 3 : 8.63607 2.87965 5.21045 4.80602 4 : 6.49356 2.35063 8.03739 2.75636 5 : 5.32246 7.07173 8.3783 2.10894 R8VEC_ANY_NORMAL_TEST R8VEC_ANY_NORMAL computes a vector V2 that is normal to a given vector V1. Test ||V1|| ||V2|| V1.V2 1 1.62017 1 0 2 1.58424 1 0 3 1.80159 1 0 4 1.93359 1 0 5 1.73095 1 0 R8VEC_NORMAL_01_TEST 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.679040 2 -0.472769 3 -0.566060 4 -0.231124 5 1.212934 Test #2: Restore the random number seed. Call 5 times, 1 value each time. The results should be identical. 1 0.535037 2 1.679040 3 -0.472769 4 -0.566060 5 -0.231124 Test #3: Restore the random number seed. Call 1 time for 5 values. The results should be identical. 1 1.679040 2 -0.472769 3 -0.566060 4 -0.231124 5 1.212934 Test #4: Restore the random number seed. Call for 2, 1, and 2 values. The results should be identical. 1 0.535037 2 1.679040 1 -0.472769 1 -0.566060 2 -0.231124 Test #5: Number of samples was 1000 Minimum value was -3.029754 Maximum value was 3.328581 Average value was -0.015702 Variance was 0.998034 Expected average 0.000000 Expected variance 1.000000 R8VEC_SCALAR_TRIPLE_PRODUCT_TEST: R8VEC_SCALAR_TRIPLE_PRODUCT computes the scalar triple product of three R8VEC's. S = V1 dot ( V2 x V3 ). V1, V2 and V3: 1: -1 -2 0 2: 3 3 4 3: 3 1 0 Computed = -20, Exact = -20 R8VEC_UNIFORM_01 R8VEC_UNIFORM_01 returns a random R8VEC with entries in [ 0.0, 1.0 ] Input SEED = 123456789 Random R8VEC: 1: 0.218418 2: 0.956318 3: 0.829509 4: 0.561695 5: 0.415307 6: 0.0661187 7: 0.257578 8: 0.109957 9: 0.043829 10: 0.633966 Input SEED = 1361431000 Random R8VEC: 1: 0.0617272 2: 0.449539 3: 0.401306 4: 0.754673 5: 0.797287 6: 0.00183837 7: 0.897504 8: 0.350752 9: 0.0945448 10: 0.0136169 Input SEED = 29242052 Random R8VEC: 1: 0.859097 2: 0.840847 3: 0.123104 4: 0.00751236 5: 0.260303 6: 0.912484 7: 0.113664 8: 0.351629 9: 0.822887 10: 0.267132 R8VEC_UNIFORM_AB_TEST R8VEC_UNIFORM_AB returns a random R8VEC with entries in a given range [ A, B ] For this problem: A = 10.000000 B = 20.000000 Input SEED = 123456789 Random R8VEC: 1: 12.1842 2: 19.5632 3: 18.2951 4: 15.617 5: 14.1531 6: 10.6612 7: 12.5758 8: 11.0996 9: 10.4383 10: 16.3397 Input SEED = 1361431000 Random R8VEC: 1: 10.6173 2: 14.4954 3: 14.0131 4: 17.5467 5: 17.9729 6: 10.0184 7: 18.975 8: 13.5075 9: 10.9454 10: 10.1362 Input SEED = 29242052 Random R8VEC: 1: 18.591 2: 18.4085 3: 11.231 4: 10.0751 5: 12.603 6: 19.1248 7: 11.1366 8: 13.5163 9: 18.2289 10: 12.6713 R8VEC3_PRINT_TEST R8VEC3_PRINT prints three R8VEC's. n, n^2, sqrt(n): 1: 1 1 1 2: 2 4 1.41421 3: 3 9 1.73205 4: 4 16 2 5: 5 25 2.23607 RADEC_DISTANCE_3D_TEST 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.000000 0.000000 6.000000 0.000000 1.570796 90.000000 0.000000 0.000000 0.000000 90.000000 1.570796 90.000000 0.000000 0.000000 3.000000 35.264390 0.955317 54.735610 0.000000 0.000000 22.546573 -10.519735 0.420534 24.094843 0.000000 0.000000 15.000000 -35.264390 2.186276 125.264390 6.000000 0.000000 0.000000 90.000000 1.570796 90.000000 6.000000 0.000000 3.000000 35.264390 0.955317 54.735610 6.000000 0.000000 22.546573 -10.519735 1.944589 111.416714 6.000000 0.000000 15.000000 -35.264390 2.186276 125.264390 0.000000 90.000000 3.000000 35.264390 0.955317 54.735610 0.000000 90.000000 22.546573 -10.519735 1.754400 100.519735 0.000000 90.000000 15.000000 -35.264390 2.186276 125.264390 3.000000 35.264390 22.546573 -10.519735 1.358384 77.829677 3.000000 35.264390 15.000000 -35.264390 3.141593 180.000000 22.546573 -10.519735 15.000000 -35.264390 1.783209 102.170323 RADEC_TO_XYZ_TEST RADEC_TO_XYZ converts XYZ to RADEC coordinates. XYZ_TO_RADEC converts RADEC to XYZ coordinates. P1 RA DEC P2 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 1.000000 0.000000 6.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 1.000000 0.000000 90.000000 0.000000 0.000000 1.000000 1.000000 1.000000 1.000000 3.000000 35.264390 0.577350 0.577350 0.577350 5.000000 -2.000000 -1.000000 22.546573 -10.519735 0.912871 -0.365148 -0.182574 -2.000000 -2.000000 -2.000000 15.000000 -35.264390 -0.577350 -0.577350 -0.577350 RADIANS_TO_DEGREES_TEST RADIANS_TO_DEGREES converts an angle from radians to degrees; Degrees Radians Degrees -60.000000 -1.047198 -60.000000 -30.000000 -0.523599 -30.000000 0.000000 0.000000 0.000000 30.000000 0.523599 30.000000 60.000000 1.047198 60.000000 90.000000 1.570796 90.000000 120.000000 2.094395 120.000000 150.000000 2.617994 150.000000 180.000000 3.141593 180.000000 210.000000 3.665191 210.000000 240.000000 4.188790 240.000000 270.000000 4.712389 270.000000 300.000000 5.235988 300.000000 330.000000 5.759587 330.000000 360.000000 6.283185 360.000000 390.000000 6.806784 390.000000 420.000000 7.330383 420.000000 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.218418 0.0661187 0.0617272 0.00183837 0.859097 2 : 0.956318 0.257578 0.449539 0.897504 0.840847 3 : 0.829509 0.109957 0.401306 0.350752 0.123104 4 : 0.561695 0.043829 0.754673 0.0945448 0.00751236 5 : 0.415307 0.633966 0.797287 0.0136169 0.260303 Factored ALU matrix. Col: 1 2 3 4 5 Row 1 : 0.956318 0.257578 0.449539 0.897504 0.840847 2 : -0.228395 0.522106 0.602062 -0.376149 -0.104858 3 : -0.867399 0.217324 0.614552 -0.510026 -0.507943 4 : -0.587352 0.20582 -0.231419 -0.391459 -0.511487 5 : -0.434277 -0.0139612 0.0803036 -0.610161 0.939815 Solution: (Should be 1, 2, 3,...) 1: 1 2: 2 3: 3 4: 4 5: 5 Solution: (Should be 1, 1, 1,...) 1: 1 2: 1 3: 1 4: 1 5: 1 Solution of transposed system: (Should be 1, 2, 3,...) 1: 1 2: 2 3: 3 4: 4 5: 5 RTP_TO_XYZ_TEST 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.9079 2.7816 2.1475 3.6295 1.8863 0.9376 -0.9079 2.7816 2.1475 0.8085 0.0765 -1.6694 1.8565 0.0944 2.6888 0.8085 0.0765 -1.6694 -0.7121 -1.4502 -1.7809 2.4045 4.2559 2.4048 -0.7121 -1.4502 -1.7809 1.1698 -1.6914 0.2477 2.0714 5.3175 1.4509 1.1698 -1.6914 0.2477 0.0065 1.7734 1.9864 2.6629 1.5671 0.7288 0.0065 1.7734 1.9864 TEST036 SEGMENT_CONTAINS_POINT_1D determines if a point lies within a line segment in 1D. P1 P T 2.000000 6.000000 3.000000 0.250000 10.000000 -10.000000 7.500000 0.125000 8.000000 10.000000 20.000000 6.000000 88.000000 88.000000 5.000000 -Inf TEST0365 SEGMENT_POINT_DIST_2D computes the distance between a line segment and point in 2D. TEST = 1 P1 = 0.218418 0.956318 P2 = 0.829509 0.561695 P = 0.415307 0.066119 DIST = 0.641015 TEST = 2 P1 = 0.257578 0.109957 P2 = 0.043829 0.633966 P = 0.061727 0.449539 DIST = 0.053085 TEST = 3 P1 = 0.401306 0.754673 P2 = 0.797287 0.001838 P = 0.897504 0.350752 DIST = 0.251122 TEST0366 SEGMENT_POINT_DIST_3D computes the distance between a line segment and point in 3D. TEST = 1 P1 = 0.218418 0.956318 0.829509 P2 = 0.561695 0.415307 0.066119 P = 0.257578 0.109957 0.043829 DIST = 0.431536 TEST = 2 P1 = 0.633966 0.061727 0.449539 P2 = 0.401306 0.754673 0.797287 P = 0.001838 0.897504 0.350752 DIST = 0.615929 TEST = 3 P1 = 0.094545 0.013617 0.859097 P2 = 0.840847 0.123104 0.007512 P = 0.260303 0.912484 0.113664 DIST = 0.907579 SEGMENT_POINT_NEAR_2D_TEST SEGMENT_POINT_NEAR_2D computes the nearest point from a line segment to a point in 2D. TEST = 1 P1 = 0.218418 0.956318 P2 = 0.829509 0.561695 P = 0.415307 0.066119 PN = 0.763049 0.604613 DIST = 0.641015 T = 0.891243 TEST = 2 P1 = 0.257578 0.109957 P2 = 0.043829 0.633966 P = 0.061727 0.449539 PN = 0.110880 0.469589 DIST = 0.053085 T = 0.686309 TEST = 3 P1 = 0.401306 0.754673 P2 = 0.797287 0.001838 P = 0.897504 0.350752 PN = 0.675252 0.233851 DIST = 0.251122 T = 0.691815 TEST0368 SEGMENT_POINT_NEAR_3D computes the nearest point from a line segment to a point in 3D. TEST = 1 P1 = 0.218418 0.956318 0.829509 P2 = 0.561695 0.415307 0.066119 P = 0.257578 0.109957 0.043829 PN = 0.561695 0.415307 0.066119 DIST = 0.431536 T = 1.000000 TEST = 2 P1 = 0.633966 0.061727 0.449539 P2 = 0.401306 0.754673 0.797287 P = 0.001838 0.897504 0.350752 PN = 0.401306 0.754673 0.797287 DIST = 0.615929 T = 1.000000 TEST = 3 P1 = 0.094545 0.013617 0.859097 P2 = 0.840847 0.123104 0.007512 P = 0.260303 0.912484 0.113664 PN = 0.588707 0.086113 0.295222 DIST = 0.907579 T = 0.662148 TEST037 SEGMENT_POINT_NEAR_3D computes the nearest point on a line segment, to a given point, in 3D. Case, T, Distance, PN. 1 1.000000 5.000000 8.000000 6.000000 0.000000 2 0.333333 1.000000 4.000000 4.000000 0.000000 3 0.666667 0.000000 6.000000 5.000000 0.000000 TEST1788 SIMPLEX_LATTICE_LAYER_POINT_NEXT returns the next point in an N-dimensional simplex lattice layer defined by: C(N+1) - 1 <= X(1)/C(1) + 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. We will use this information to compute the areas and centers of each face. Number of points = 60 Number of edges = 90 Number of faces = 32 Maximum face order = 6 Face Order Area 1 6 0.441056 2 6 0.441056 3 5 0.292073 4 6 0.441057 5 5 0.292073 6 6 0.441056 7 5 0.292073 8 6 0.441056 9 6 0.441056 10 6 0.441056 11 5 0.292073 12 6 0.441056 13 5 0.292072 14 6 0.441056 15 5 0.292073 16 6 0.441056 17 6 0.441056 18 6 0.441056 19 5 0.292072 20 6 0.441056 21 5 0.292073 22 5 0.292073 23 6 0.441056 24 6 0.441056 25 6 0.441056 26 5 0.292073 27 6 0.441056 28 5 0.292073 29 6 0.441057 30 6 0.441056 31 5 0.292073 32 6 0.441056 Face Center 1 0.176084 0.333333 0.854729 2 -0.374587 -0.042441 0.854729 3 0.185551 -0.271913 0.900685 4 0.681916 -0.042441 0.637077 5 -0.371103 0.543825 0.697234 6 -0.209088 -0.650456 0.637077 7 0.616466 0.543825 0.493784 8 0.443866 -0.650456 0.502561 9 -0.804597 0.222222 0.419426 10 0.086406 0.830237 0.419426 11 -0.731143 -0.375774 0.493784 12 0.904859 0.222222 0.067258 13 0.866776 -0.375774 0.164595 14 -0.519688 0.761567 0.150394 15 0.033908 -0.944118 0.164595 16 -0.536815 -0.761567 0.067258 17 0.536815 0.761567 -0.067258 18 0.519688 -0.761567 -0.150394 19 -0.866776 0.375774 -0.164595 20 -0.904859 -0.222222 -0.067258 21 -0.033908 0.944118 -0.164595 22 0.731143 0.375774 -0.493784 23 0.804597 -0.222222 -0.419426 24 -0.443867 0.650456 -0.502561 25 -0.086406 -0.830237 -0.419426 26 -0.616466 -0.543825 -0.493784 27 0.209088 0.650456 -0.637077 28 0.371103 -0.543825 -0.697234 29 -0.681916 0.042441 -0.637077 30 0.374587 0.042441 -0.854729 31 -0.185551 0.271913 -0.900685 32 -0.176084 -0.333333 -0.854729 SORT_HEAP_EXTERNAL_TEST SORT_HEAP_EXTERNAL sorts objects externally. Unsorted array: 1: 5 2: 20 3: 17 4: 12 5: 9 6: 2 7: 6 8: 3 9: 1 10: 13 11: 2 12: 9 13: 9 14: 16 15: 16 16: 1 17: 18 18: 8 19: 2 20: 1 Sorted array: 1: 1 2: 1 3: 1 4: 2 5: 2 6: 2 7: 3 8: 5 9: 6 10: 8 11: 9 12: 9 13: 9 14: 12 15: 13 16: 16 17: 16 18: 17 19: 18 20: 20 SIMPLEX_VOLUME_ND_TEST SIMPLEX_VOLUME_ND computes the volume of an ND simplex. 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.638429 Volume computed by SIMPLEX_VOLUME_ND: 0.638429 SIMPLEX01_VOLUME_ND_TEST SIMPLEX01_VOLUME_ND: volume of the unit M-dimensional simplex. M Volume 1 1.00000000 2 0.50000000 3 0.16666667 4 0.04166667 5 0.00833333 6 0.00138889 7 0.00019841 8 0.00002480 9 0.00000276 10 0.00000028 SPHERE_DIA2IMP_3D_TEST SPHERE_DIA2IMP_3D converts a sphere from diameter to implicit form. Point P1: 1: -1 2: -1 3: 4 Point P2: 1: 5 2: 7 3: 4 Radius: 5.000000 The center: 1: 2 2: 3 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 1 1.000000 2.000000 3.000000 0 7.000000 2.000000 3.000000 1 1.000000 5.000000 3.000000 1 2.500000 3.500000 4.500000 SPHERE_IMP_CONTAINS_POINT_3D: Inside, P 1 1.000000 2.000000 3.000000 0 7.000000 2.000000 3.000000 1 1.000000 5.000000 3.000000 1 2.500000 3.500000 4.500000 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.000000 Sphere center: 1: 1 2: 2 3: 3 SPHERE_EXP_POINT_NEAR_3D: P, PN 1.000000 2.000000 3.000000 2.732051 3.732051 4.732051 7.000000 2.000000 3.000000 4.000000 2.000000 3.000000 1.000000 5.000000 3.000000 1.000000 5.000000 3.000000 2.500000 3.500000 4.500000 2.732051 3.732051 4.732051 SPHERE_IMP_POINT_NEAR_3D: P, PN 1.000000 2.000000 3.000000 2.732051 3.732051 4.732051 7.000000 2.000000 3.000000 4.000000 2.000000 3.000000 1.000000 5.000000 3.000000 1.000000 5.000000 3.000000 2.500000 3.500000 4.500000 2.732051 3.732051 4.732051 TEST1835 SPHERE_EXP2IMP_3D: explicit sphere => implicit form; SPHERE_IMP2EXP_3D: implicit sphere => explicit form. Initial form of explicit sphere: 4.000000 2.000000 3.000000 1.000000 5.000000 3.000000 1.000000 2.000000 6.000000 -2.000000 2.000000 3.000000 Computed form of implicit sphere: Imputed radius = 3.000000 Imputed center 1: 1 2: 2 3: 3 Computed form of explicit sphere: 1.000000 2.000000 6.000000 3.598076 2.000000 1.500000 -0.299038 4.250000 1.500000 -0.299038 -0.250000 1.500000 GEOMETRY_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.000000 True radius = 3.000000 Imputed center 1: 1 2: 2 3: 3 True center 1: 1 2: 2 3: 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.000000 0.000000 0.000000 2.000000 2.000000 0.000000 0.000000 4.000000 0.000000 0.000000 4.000000 0.000000 2.000000 4.000000 10.000000 2.000000 4.000000 2.000000 3.000000 5.000000 0.000000 3.414214 5.414214 0.000000 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.000000 DIM_NUM Area Volume 2 6.283185 3.141593 3 12.566371 4.188790 4 19.739209 4.934802 5 26.318945 5.263789 6 31.006277 5.167713 7 33.073362 4.724766 8 32.469697 4.058712 9 29.686580 3.298509 10 25.501640 2.550164 SPHERE01_AREA_ND_TEST: SPHERE01_AREA_ND evaluates the area of the unit sphere in N dimensions. DIM_NUM Exact Computed Area Area 1 2.000000 2.000000 2 6.283185 6.283185 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.686580 29.686580 10 25.501640 25.501640 11 20.725143 20.725143 12 16.023153 16.023153 13 11.838174 11.838174 14 8.389703 8.389703 15 5.721649 5.721649 16 3.765290 3.765290 17 2.396679 2.396679 18 1.478626 1.478626 19 0.885810 0.885810 20 0.516138 0.516138 TEST190 For the unit sphere in 2 dimensions (the circle): SPHERE01_SAMPLE_2D samples; A few sample values: 0.197134 0.980377 0.962570 -0.271032 0.479049 -0.877788 -0.925802 -0.378008 -0.861723 0.507380 Number of sample points = 1000 Now average the points, which should get a value close to zero, and closer as N_SAMPLE increases. Average: -0.019487 -0.015738 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.805634 -0.592413 Average |(XdotV)| 0.649573 V: 0.918517 -0.395381 Average |(XdotV)| 0.623194 V: -0.630859 -0.775898 Average |(XdotV)| 0.648768 V: 0.572459 -0.819933 Average |(XdotV)| 0.638814 V: -0.980377 -0.197131 Average |(XdotV)| 0.643394 TEST191 For the unit sphere in 3 dimensions: SPHERE01_SAMPLE_3D samples; A few sample values: 0.795416 -0.223966 -0.563163 -0.696321 -0.284310 0.659018 0.901719 0.397757 -0.169386 0.674043 0.557308 -0.484844 -0.272750 -0.305351 -0.912342 Now average the points, which should get a value close to zero, and closer as N_SAMPLE increases. Average: 0.011231 0.018262 -0.001727 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.159238 -0.835329 -0.526183 Average |(XdotV)| 0.503798 V: 0.326524 -0.253713 0.910501 Average |(XdotV)| 0.509729 V: -0.093655 -0.983536 -0.154550 Average |(XdotV)| 0.497744 V: 0.515204 0.518383 0.682528 Average |(XdotV)| 0.505148 V: 0.857298 0.257252 -0.445940 Average |(XdotV)| 0.498380 TEST192 For the unit sphere in 3 dimensions: SPHERE01_SAMPLE_3D_2 samples; A few sample values: 0.609872 -0.171722 0.773671 -0.472500 -0.192923 -0.859956 0.882745 0.389387 0.262942 0.557775 0.461177 0.690074 -0.091438 -0.102367 0.990535 Now average the points, which should get a value close to zero, and closer as N_SAMPLE increases. Average: 0.014671 0.017093 -0.001434 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.126855 -0.665452 0.735583 Average |(XdotV)| 0.560237 V: 0.110647 -0.085974 -0.990134 Average |(XdotV)| 0.639146 V: -0.092014 -0.966305 0.240390 Average |(XdotV)| 0.423899 V: 0.337146 0.339226 -0.878213 Average |(XdotV)| 0.606969 V: 0.732275 0.219736 0.644585 Average |(XdotV)| 0.515108 TEST193 For the unit sphere in N dimensions: SPHERE01_SAMPLE_ND samples; A few sample values: -0.563163 0.544577 0.621517 -0.169386 0.477838 0.861962 -0.912342 -0.358883 -0.197066 -0.197387 0.582876 -0.788222 0.795008 0.491897 0.354964 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.030880 0.010031 -0.007365 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.339619 0.919418 -0.198316 Average |(XdotV)| 0.408130 V: -0.859971 -0.321067 0.396694 Average |(XdotV)| 0.511034 V: -0.078837 -0.001260 0.996887 Average |(XdotV)| 0.616625 V: -0.090849 0.234495 -0.967863 Average |(XdotV)| 0.604203 V: 0.029875 -0.457946 -0.888478 Average |(XdotV)| 0.571806 TEST194 For the unit sphere in N dimensions: SPHERE01_SAMPLE2_ND samples; A few sample values: 0.915568 -0.257797 -0.308668 -0.171751 0.901345 0.397592 0.541822 0.447986 -0.711152 -0.620052 -0.745456 0.244603 0.026281 -0.894727 0.445840 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.017643 0.009349 0.043713 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.930075 -0.331206 -0.158946 Average |(XdotV)| 0.491631 V: -0.836126 -0.427942 -0.343159 Average |(XdotV)| 0.521659 V: 0.934808 0.233746 -0.267390 Average |(XdotV)| 0.508868 V: 0.184203 -0.896916 0.402008 Average |(XdotV)| 0.483926 V: -0.639335 0.513178 -0.572625 Average |(XdotV)| 0.493075 TEST195 For the unit sphere in N dimensions: SPHERE01_SAMPLE3_ND samples; A few sample values: 0.138221 -0.189744 -0.972056 0.290560 -0.950577 -0.109446 -0.244469 0.630839 0.736395 -0.349232 0.760003 -0.548117 0.464237 0.149042 0.873081 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.010652 -0.025063 0.023125 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.344740 0.215308 0.913672 Average |(XdotV)| 0.495086 V: -0.725816 -0.570666 0.384099 Average |(XdotV)| 0.512422 V: 0.614104 0.678902 0.402452 Average |(XdotV)| 0.517617 V: -0.303734 -0.344136 0.888435 Average |(XdotV)| 0.496253 V: 0.697872 0.714651 -0.047419 Average |(XdotV)| 0.492769 TEST1955: SPHERE01_VOLUME_ND evaluates the area of the unit sphere in N dimensions. SPHERE01_VOLUME_VALUES returns some test values. DIM_NUM Exact Computed Volume Volume 1 2.000000 2.000000 2 3.141593 3.141593 3 4.188790 4.188790 4 4.934802 4.934802 5 5.263789 5.263789 6 5.167713 5.167713 7 4.724766 4.724766 8 4.058712 4.058712 9 3.298509 3.298509 10 2.550164 2.550164 11 1.884104 1.884104 12 1.335263 1.335263 13 0.910629 0.910629 14 0.599265 0.599265 15 0.381443 0.381443 16 0.235331 0.235331 17 0.140981 0.140981 18 0.082146 0.082146 19 0.046622 0.046622 20 0.025807 0.025807 TEST196 For a shape in 2D, SHAPE_POINT_DIST_2D computes the distance to a point; Number of sides: 4 Center of square: 1: 3 2: 0 Square vertex #1 1: 5 2: 0 I X Y DIST 1 3.000000 0.000000 1.414214 2 5.000000 0.000000 0.000000 3 4.000000 0.000000 0.707107 4 10.000000 0.000000 5.000000 5 8.000000 5.000000 5.830952 6 6.000000 6.000000 6.082763 7 1.000000 2.000000 2.000000 8 2.500000 -0.500000 1.414214 9 4.000000 -1.000000 1.414214 TEST197 For a shape in 2D, SHAPE_POINT_DIST_2D computes the distance to a point; Number of sides: 6 Center of hexagon: 1: 3 2: 0 Hexagon vertex #1 1: 5 2: 0 I X Y DIST 1 3.000000 0.000000 1.732051 2 5.000000 0.000000 0.000000 3 4.000000 0.000000 0.866025 4 10.000000 0.000000 5.000000 5 4.000000 1.732051 2.000000 6 5.000000 3.464102 3.464102 7 3.000000 1.732051 3.464102 8 3.000000 0.866025 2.598076 TEST198 For a shape in 2D, SHAPE_POINT_NEAR_2D computes the nearest point to a point; Number of sides: 6 Hexagon center: 1: 3 2: 0 Hexagon vertex #1: 5.000000 0.000000 I X Y PN Dist 1 3.000000 0.000000 3.000000 0.000000 1.732051 2 5.000000 0.000000 5.000000 0.000000 0.000000 3 4.000000 0.000000 4.750000 0.433013 0.866025 4 10.000000 0.000000 5.000000 0.000000 5.000000 5 4.000000 1.732051 5.000000 -0.000000 2.000000 6 5.000000 3.464102 5.000000 -0.000000 3.464102 7 3.000000 1.732051 3.000000 -1.732051 3.464102 8 3.000000 0.866025 3.000000 -1.732051 2.598076 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: 1: 3 2: 0 Hexagon vertex #1: 5.000000 0.000000 I XA YA XB YB XI YI 1 3.000000 0.000000 4.000000 0.000000 5.000000 0.000000 2 3.000000 0.000000 3.000000 1.000000 3.000000 3.464102 3 3.000000 -1.000000 3.000000 1.000000 3.000000 3.464102 4 3.000000 -1.000000 7.000000 5.000000 4.821367 1.732051 SPHERE_TRIANGLE_SIDES_TO_ANGLES_TEST SPHERE_TRIANGLE_SIDES_TO_ANGLES takes the sides of a spherical triangle and determines the angles. A = 2.058867 (radians) A = 117.964369 (degrees) Correct = 117.966667 (radians) B = 1.627136 (radians) B = 93.228029 (degrees) Correct = 93.230000 (radians) C = 1.227740 (radians) C = 70.344308 (degrees) Correct = 70.343333 (radians) TEST201 STRING_2D takes a set of line segments, and "strings" them together. I, (X1,Y1), (X2,Y2) 1 0.000000 0.000000 1.000000 1.000000 2 3.000000 4.000000 2.000000 4.000000 3 2.000000 2.000000 1.000000 3.000000 4 3.000000 2.000000 2.000000 3.000000 5 2.000000 1.000000 2.000000 2.000000 6 1.000000 1.000000 1.000000 2.000000 7 0.000000 5.000000 1.000000 6.000000 8 1.000000 2.000000 1.000000 3.000000 9 3.000000 2.000000 3.000000 3.000000 10 0.000000 0.000000 1.000000 0.000000 11 5.000000 5.000000 6.000000 6.000000 12 3.000000 3.000000 3.000000 4.000000 13 2.000000 4.000000 2.000000 3.000000 14 7.000000 4.000000 5.000000 5.000000 15 1.000000 0.000000 2.000000 1.000000 Found 4 groups of segments. STRING, ORDER, P1, P2 1 -3 2.000000 2.000000 2.000000 1.000000 1 -2 2.000000 1.000000 1.000000 0.000000 1 -1 1.000000 0.000000 0.000000 0.000000 1 0 0.000000 0.000000 1.000000 1.000000 1 1 1.000000 1.000000 1.000000 2.000000 1 2 1.000000 2.000000 1.000000 3.000000 1 3 1.000000 3.000000 2.000000 2.000000 2 -2 3.000000 2.000000 3.000000 3.000000 2 -1 3.000000 3.000000 3.000000 4.000000 2 0 3.000000 4.000000 2.000000 4.000000 2 1 2.000000 4.000000 2.000000 3.000000 2 2 2.000000 3.000000 3.000000 2.000000 3 0 0.000000 5.000000 1.000000 6.000000 4 -1 7.000000 4.000000 5.000000 5.000000 4 0 5.000000 5.000000 6.000000 6.000000 TEST202 SUPER_ELLIPSE_POINTS_2D returns points on a super ellipse; Superellipse center: 1: 5 2: -2 radii R1 = 3.000000, R2 = 1.000000 exponent EXPO = 1.500000 and angle PSI = 0.523599 Sample points: Row: 1 2 Col 1: 7.59808 -0.5 2: 7.40059 -0.461979 3: 6.91708 -0.484923 4: 6.24752 -0.593153 5: 5.51559 -0.771716 6: 4.86743 -0.980351 7: 4.5 -1.13397 8: 4.18324 -1.37537 9: 3.67848 -1.83238 10: 3.15787 -2.37696 11: 2.72936 -2.9027 12: 2.46774 -3.30996 13: 2.40192 -3.5 14: 2.59941 -3.53802 15: 3.08292 -3.51508 16: 3.75248 -3.40685 17: 4.48441 -3.22828 18: 5.13257 -3.01965 19: 5.5 -2.86603 20: 5.81676 -2.62463 21: 6.32152 -2.16762 22: 6.84213 -1.62304 23: 7.27064 -1.0973 24: 7.53226 -0.690042 TETRAHEDRON_BARYCENTRIC_3D_TEST TETRAHEDRON_BARYCENTRIC_3D converts XYZ to XSI. We are computing the XSI 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 (X,Y,Z) (XSI1,XSI2,XSI3,XSI4): 1.388984 4.014574 3.001498 0.602231 0.388984 0.007287 0.001498 1.112721 4.008224 3.058079 0.825088 0.112721 0.004112 0.058079 1.120614 4.021312 3.232467 0.636262 0.120614 0.010656 0.232467 1.035017 4.095236 3.058308 0.859057 0.035017 0.047618 0.058308 1.227945 4.054928 3.006983 0.737607 0.227945 0.027464 0.006983 1.831312 4.032399 3.029986 0.122502 0.831312 0.016200 0.029986 1.063531 4.826294 3.067761 0.455560 0.063531 0.413147 0.067761 1.019699 4.000548 3.036171 0.943856 0.019699 0.000274 0.036171 1.345321 4.003678 3.014342 0.638498 0.345321 0.001839 0.014342 1.266859 4.014596 3.020022 0.705821 0.266859 0.007298 0.020022 TETRAHEDRON_CENTROID_3D_TEST TETRAHEDRON_CENTROID_3D computes the centroid of a tetrahedron; 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: 1: 0 2: -0.172546 3: 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.081650 -0.244949 0.600000 1 -1.469693 -3.021943 -0.200000 0 -0.898146 0.672598 -0.200000 0 TEST2032 For a tetrahedron in 3D, TETRAHEDRON_CIRCUMSPHERE_3D computes the circumsphere; Tetrahedron vertices: Row: 1 2 3 Col 1: 0.57735 0 0 2: -0.288675 0.5 0 3: -0.288675 -0.5 0 4: 0 0 0.816497 Circumsphere center: 1: 1.11022e-16 2: 0 3: 0.204124 Circumsphere radius is 0.612372 TEST20321 For a tetrahedron in 3D, TETRAHEDRON_EDGE_LENGTH_3D computes the edge lengths; Tetrahedron vertices: Row: 1 2 3 Col 1: 0.57735 0 0 2: -0.288675 0.5 0 3: -0.288675 -0.5 0 4: 0 0 0.816497 Edge lengths: 1: 1 2: 1 3: 1 4: 1 5: 1 6: 1 TEST20322 For a tetrahedron in 3D, TETRAHEDRON_INSPHERE_3D computes the insphere; Tetrahedron vertices: Row: 1 2 3 Col 1: 0.57735 0 0 2: -0.288675 0.5 0 3: -0.288675 -0.5 0 4: 0 0 0.816497 Insphere center: 1: -3.20494e-17 2: 0 3: 0.204124 Insphere radius is 0.204124 GEOMETRY_TEST203224 TETRAHEDRON_LATTICE_LAYER_POINT_NEXT returns the next point in a tetrahedron lattice layer defined by: C(4) - 1 < X(1)/C(1) + X(2)/C(2) +X(3)/C(3) <= C(4). 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.57735 0 0 2: -0.288675 0.5 0 3: -0.288675 -0.5 0.816497 4: 0 0 0.816497 Tetrahedron quality is 0.580468 Tetrahedron vertices: Row: 1 2 3 Col 1: 0.57735 0 0 2: -0.288675 0.5 0 3: -0.288675 -0.5 0 4: 0 0 0.408248 Tetrahedron quality is 0.732051 TEST203232 For a tetrahedron in 3D, TETRAHEDRON_QUALITY2_3D computes quality measure #2; Tetrahedron vertices: Row: 1 2 3 Col 1: 0.57735 0 0 2: -0.288675 0.5 0 3: -0.288675 -0.5 0.816497 4: 0 0 0.816497 Tetrahedron quality is 0.565770 Tetrahedron vertices: Row: 1 2 3 Col 1: 0.57735 0 0 2: -0.288675 0.5 0 3: -0.288675 -0.5 0 4: 0 0 0.408248 Tetrahedron quality is 0.732051 TEST203233 For a tetrahedron in 3D, TETRAHEDRON_QUALITY3_3D computes quality measure #3; Tetrahedron vertices: Row: 1 2 3 Col 1: 0.57735 0 0 2: -0.288675 0.5 0 3: -0.288675 -0.5 0.816497 4: 0 0 0.816497 Tetrahedron quality is 0.686829 Tetrahedron vertices: Row: 1 2 3 Col 1: 0.57735 0 0 2: -0.288675 0.5 0 3: -0.288675 -0.5 0 4: 0 0 0.408248 Tetrahedron quality is 0.839947 TEST203234 For a tetrahedron in 3D, TETRAHEDRON_QUALITY4_3D computes quality measure #4; Tetrahedron vertices: Row: 1 2 3 Col 1: 0.57735 0 0 2: -0.288675 0.5 0 3: -0.288675 -0.5 0.816497 4: 0 0 0.816497 Tetrahedron quality is 0.476642 Tetrahedron vertices: Row: 1 2 3 Col 1: 0.57735 0 0 2: -0.288675 0.5 0 3: -0.288675 -0.5 0 4: 0 0 0.408248 Tetrahedron quality is 0.621320 TEST203235 For the cube, TETRAHEDRON_RHOMBIC_SIZE_3D returns dimension information; TETRAHEDRON_RHOMBIC_SHAPE_3D returns face and order information. SHAPE_PRINT_3D prints this information. Number of points = 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.816497 0.000000 0.000000 2 0.000000 -0.577350 0.000000 3 0.000000 0.577350 0.000000 4 0.000000 0.000000 0.816497 5 -0.408248 -0.288675 0.000000 6 -0.408248 0.288675 0.000000 7 -0.408248 0.000000 0.408248 8 0.000000 0.000000 0.000000 9 0.000000 -0.288675 0.408248 10 0.000000 0.288675 0.408248 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 TETRAHEDRON_SAMPLE_3D_TEST TETRAHEDRON_SAMPLE_3D samples a tetrahedron. We are computing the XSI 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 (X,Y,Z) (XSI1,XSI2,XSI3,XSI4): 1.388984 4.014574 3.001498 0.602231 0.388984 0.007287 0.001498 1.112721 4.008224 3.058079 0.825088 0.112721 0.004112 0.058079 1.120614 4.021312 3.232467 0.636262 0.120614 0.010656 0.232467 1.035017 4.095236 3.058308 0.859057 0.035017 0.047618 0.058308 1.227945 4.054928 3.006983 0.737607 0.227945 0.027464 0.006983 1.831312 4.032399 3.029986 0.122502 0.831312 0.016200 0.029986 1.063531 4.826294 3.067761 0.455560 0.063531 0.413147 0.067761 1.019699 4.000548 3.036171 0.943856 0.019699 0.000274 0.036171 1.345321 4.003678 3.014342 0.638498 0.345321 0.001839 0.014342 1.266859 4.014596 3.020022 0.705821 0.266859 0.007298 0.020022 TEST20325 For the tetrahedron, TETRAHEDRON_SIZE_3D returns dimension information; TETRAHEDRON_SHAPE_3D returns face and order info. We will use this information to compute the areas and centers of each face. Number of points = 4 Number of edges = 6 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.000000 -0.333333 2 -0.471405 0.816497 -0.333333 3 -0.471405 -0.816497 -0.333333 4 0.000000 0.000000 1.000000 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 Face Order Area 1 3 1.154701 2 3 1.154701 3 3 1.154701 4 3 1.154701 Face Center 1 -0.000000 0.000000 -0.333333 2 0.157135 0.272166 0.111111 3 0.157135 -0.272166 0.111111 4 -0.314270 0.000000 0.111111 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: 1: 0.455087 2: 0.535656 3: 0.535656 4: 0.641025 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: 1: 1.5708 2: 0.339837 3: 0.339837 4: 0.339837 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: 1: 1.5708 2: 0.899175 3: 0.289752 4: 0.0581062 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: 1: 0.523599 2: 0.445561 3: 0.445561 4: 0.183762 TETRAHEDRON_VOLUME_3D_TEST TETRAHEDRON_VOLUME_3D computes the volume of a tetrahedron; 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.638429 TETRAHEDRON01_VOLUME_TEST TETRAHEDRON01_VOLUME returns the volume of the unit tetrahedron. Unit tetrahedron volume = 0.166667 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: Col: 1 2 3 4 Row 1 : 1 0 0 0 2 : 0 1 0 0 3 : 0 0 1 0 4 : 0 0 0 1 Transformation matrix for rotation about x by 30.000000 Col: 1 2 3 4 Row 1 : 1 0 0 0 2 : 0 0.866025 -0.5 0 3 : 0 0.5 0.866025 0 4 : 0 0 0 1 Transformation matrix for rotation about 1.000000 2.000000 3.000000 of 30.000000 Col: 1 2 3 4 Row 1 : 0.875595 -0.381753 0.29597 0 2 : 0.420031 0.904304 -0.0762129 0 3 : -0.238552 0.191048 0.952152 0 4 : 0 0 0 1 Transformation matrix for scaling by 2.000000 0.500000 10.000000 Col: 1 2 3 4 Row 1 : 2 0 0 0 2 : 0 0.5 0 0 3 : 0 0 10 0 4 : 0 0 0 1 Transformation matrix for xy shear coefficient of 0.500000 Col: 1 2 3 4 Row 1 : 1 0.5 0 0 2 : 0 1 0 0 3 : 0 0 1 0 4 : 0 0 0 1 Transformation matrix for translation by 1.000000 2.000000 3.000000 Col: 1 2 3 4 Row 1 : 1 0 0 1 2 : 0 1 0 2 3 : 0 0 1 3 4 : 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 Initial transformation matrix: Col: 1 2 3 4 Row 1 : 1 0 0 0 2 : 0 1 0 0 3 : 0 0 1 0 4 : 0 0 0 1 Rotation about x by 30.000000 Row: 1 2 3 Col 1: 1 0 0 2: 0 0.866025 0.5 3: 0 -0.5 0.866025 4: 1 0.366025 1.36603 Rotation about 1.000000 2.000000 3.000000 of 30.000000 Row: 1 2 3 Col 1: 0.875595 0.420031 -0.238552 2: -0.381753 0.904304 0.191048 3: 0.29597 -0.0762129 0.952152 4: 0.789812 1.24812 0.904648 Scaling by 2.000000 0.500000 10.000000 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.500000 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.000000 2.000000 3.000000 Row: 1 2 3 Col 1: 2 2 3 2: 1 3 3 3: 1 2 4 4: 2 3 4 TP_TO_XYZ_TEST TP_TO_XYZ converts (Theta,Phi) to normalized XYZ coordinates. XYZ_TO_TP converts XYZ to (Theta,Phi) coordinates. T P X Y Z T P 0.6862 3.0044 0.1058 0.0867 -0.9906 0.6862 3.0044 2.6060 1.7646 -0.8439 0.5008 -0.1926 2.6060 1.7646 1.3047 0.2077 0.0542 0.1990 0.9785 1.3047 0.2077 0.8092 0.3454 0.2337 0.2451 0.9409 0.8092 0.3454 0.1377 1.9917 0.9041 0.1253 -0.4086 0.1377 1.9917 0.1939 1.4123 0.9690 0.1903 0.1579 0.1939 1.4123 TEST206 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.785398 45.000000 1.570796 90.000000 0.785398 45.000000 TEST20605 For a triangle in 3D: TRIANGLE_ANGLES_3D computes the angles; Triangle vertices: Row: 1 2 3 Col 1: 1 2 3 2: 2.41421 3.41421 3 3: 1.70711 2.70711 4 Radians Degrees 0.785398 44.999999 0.785398 44.999995 1.570796 90.000006 TEST2061 For a triangle in 2D, TRIANGLE_AREA_2D computes the area; Triangle vertices (columns) Col: 1 2 3 Row 1 : 0 0 1 2 : 1 0 0 Triangle area is 0.500000 TRIANGLE_AREA_HERON_TEST For a triangle in any dimension, TRIANGLE_AREA_HERON computes the area; Triangle vertices: Row: 1 2 3 Col 1: 1 0 0 2: 0 1 0 3: 0 0 1 Side lengths: 1: 1.41421 2: 1.41421 3: 1.41421 The area is 0.866025 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 3 2 : 2.41421 3.41421 3 3 : 1.70711 2.70711 4 Area #1 1.118034 Area #2 1.118034 Area #3 1.118034 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: 1: 0.333333 2: 0.333333 Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 0.5 0.866025 Centroid: 1: 0.5 2: 0.288675 Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 0.5 10 Centroid: 1: 0.5 2: 3.33333 Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 10 2 Centroid: 1: 3.66667 2: 0.666667 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.41421 3.41421 3 3: 1.70711 2.70711 4 Centroid: 1: 1.70711 2: 2.70711 3: 3.33333 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 ( columns ) Col: 1 2 3 Row 1 : 10 11 10 2 : 5 5 6 Circumcenter by TRIANGLE_CIRCUMCENTER_2D: 1: 10.5 2: 5.5 Circumcenter by TRIANGLE_CIRCUMCENTER_2D_2: 1: 10.5 2: 5.5 Circumcenter by TRIANGLE_CIRCUMCENTER: 1: 10.5 2: 5.5 Triangle vertices ( columns ) Col: 1 2 3 Row 1 : 10 11 10.5 2 : 5 5 5.86603 Circumcenter by TRIANGLE_CIRCUMCENTER_2D: 1: 10.5 2: 5.28868 Circumcenter by TRIANGLE_CIRCUMCENTER_2D_2: 1: 10.5 2: 5.28868 Circumcenter by TRIANGLE_CIRCUMCENTER: 1: 10.5 2: 5.28868 Triangle vertices ( columns ) Col: 1 2 3 Row 1 : 10 11 10.5 2 : 5 5 15 Circumcenter by TRIANGLE_CIRCUMCENTER_2D: 1: 10.5 2: 9.9875 Circumcenter by TRIANGLE_CIRCUMCENTER_2D_2: 1: 10.5 2: 9.9875 Circumcenter by TRIANGLE_CIRCUMCENTER: 1: 10.5 2: 9.9875 Triangle vertices ( columns ) Col: 1 2 3 Row 1 : 10 11 20 2 : 5 5 7 Circumcenter by TRIANGLE_CIRCUMCENTER_2D: 1: 10.5 2: 28.5 Circumcenter by TRIANGLE_CIRCUMCENTER_2D_2: 1: 10.5 2: 28.5 Circumcenter by TRIANGLE_CIRCUMCENTER: 1: 10.5 2: 28.5 GEOMETRY_TEST21011 For a triangle in M dimensions, the circumenter can be computed by: TRIANGLE_CIRCUMCENTER; M2 = 2 Circumcenter by TRIANGLE_CIRCUMCENTER: 1: 6.75635 2: 12.479 Distances from circumcenter to vertices: 0.533001 0.533001 0.533001 Circumcenter by TRIANGLE_CIRCUMCENTER: 1: 6.97462 2: 12.4292 Distances from circumcenter to vertices: 0.653938 0.653938 0.653938 Circumcenter by TRIANGLE_CIRCUMCENTER: 1: 13.6918 2: 10.895 Distances from circumcenter to vertices: 7.339086 7.339086 7.339086 Circumcenter by TRIANGLE_CIRCUMCENTER: 1: 48.5917 2: 2.92402 Distances from circumcenter to vertices: 43.124048 43.124048 43.124048 M2 = 3 Circumcenter by TRIANGLE_CIRCUMCENTER: 1: 4.95926 2: 12.4483 3: 8.91262 Distances from circumcenter to vertices: 0.646826 0.646826 0.646826 Circumcenter by TRIANGLE_CIRCUMCENTER: 1: 4.98611 2: 12.4528 3: 8.9003 Distances from circumcenter to vertices: 0.643991 0.643991 0.643991 Circumcenter by TRIANGLE_CIRCUMCENTER: 1: 9.08447 2: 13.1472 3: 7.02055 Distances from circumcenter to vertices: 4.561227 4.561227 4.561227 Circumcenter by TRIANGLE_CIRCUMCENTER: 1: 76.6274 2: 24.5921 3: -23.9586 Distances from circumcenter to vertices: 79.703076 79.703076 79.703076 M2 = 4 Circumcenter by TRIANGLE_CIRCUMCENTER: 1: 3.96069 2: 10.8146 3: 10.1582 4: 7.11479 Distances from circumcenter to vertices: 0.733734 0.733734 0.733734 Circumcenter by TRIANGLE_CIRCUMCENTER: 1: 3.76458 2: 10.8907 3: 10.1175 4: 7.12158 Distances from circumcenter to vertices: 0.822921 0.822921 0.822921 Circumcenter by TRIANGLE_CIRCUMCENTER: 1: 7.0081 2: 9.63113 3: 10.7916 4: 7.0093 Distances from circumcenter to vertices: 3.192932 3.192932 3.192932 Circumcenter by TRIANGLE_CIRCUMCENTER: 1: 114.696 2: -32.1886 3: 33.1732 4: 3.28141 Distances from circumcenter to vertices: 120.847616 120.847616 120.847616 M2 = 5 Circumcenter by TRIANGLE_CIRCUMCENTER: 1: 2.98189 2: 11.9165 3: 9.99218 4: 6.09667 5: 7.98512 Distances from circumcenter to vertices: 0.744628 0.744628 0.744628 Circumcenter by TRIANGLE_CIRCUMCENTER: 1: 2.98184 2: 11.9186 3: 10.0022 4: 6.10563 5: 7.94834 Distances from circumcenter to vertices: 0.753036 0.753036 0.753036 Circumcenter by TRIANGLE_CIRCUMCENTER: 1: 2.98826 2: 11.6759 3: 8.82892 4: 5.05131 5: 12.273 Distances from circumcenter to vertices: 4.489448 4.489448 4.489448 Circumcenter by TRIANGLE_CIRCUMCENTER: 1: 3.12242 2: 6.61127 3: -15.6585 4: -16.9542 5: 102.536 Distances from circumcenter to vertices: 100.645654 100.645654 100.645654 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 1: 0.5 2: 0.5 Circumradius: 0.707107 Circumcenter2 1: 0.5 2: 0.5 Circumradius2: 0.707107 Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 0.5 0.866025 Circumcenter 1: 0.5 2: 0.288675 Circumradius: 0.577350 Circumcenter2 1: 0.5 2: 0.288675 Circumradius2: 0.577350 Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 0.5 10 Circumcenter 1: 0.5 2: 4.9875 Circumradius: 5.012500 Circumcenter2 1: 0.5 2: 4.9875 Circumradius2: 5.012500 Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 10 2 Circumcenter 1: 0.5 2: 23.5 Circumradius: 23.505319 Circumcenter2 1: 0.5 2: 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.707107 Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 0.5 0.866025 Circumradius: 0.577350 Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 0.5 10 Circumradius: 5.012500 Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 10 2 Circumradius: 23.505319 TEST2068 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: 1: 3 2: 0 3: -7 Line point P2: 1: 5 2: 1 3: -2 The triangle contains the line. Intersection point: 1: 7 2: 2 3: 3 Expected answer: The triangle contains the line, and the intersection point is at: 7, 2, 3. TEST2069 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: 1: 3 2: 0 3: -7 Parametric direction PD: 1: 0.365148 2: 0.182574 3: 0.912871 The triangle contains the line. Intersection point: 1: 7 2: 2 3: 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.250000 0.250000 1 1 1 0.750000 0.250000 1 1 1 1.000000 1.000000 0 0 0 11.000000 0.500000 0 0 0 0.000000 1.000000 1 1 1 0.500000 -10.000000 0 0 0 0.600000 0.600000 0 0 0 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.250000 0.250000 1 0 1 0.750000 0.250000 1 0 1 1.000000 1.000000 0 0 0 11.000000 0.500000 0 0 0 0.000000 1.000000 1 0 1 0.500000 -10.000000 0 0 0 0.600000 0.600000 0 0 0 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 = 6.000000 Triangle vertices: Row: 1 2 Col 1: 4 2 2: 5 4 3: 6 6 Diameter = 6.000000 Triangle vertices: Row: 1 2 Col 1: 4 2 2: 1 5 3: 4 2 Diameter = 0.000000 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.666667 0.333333 0 0.666667 2 : 0 0 0 0 0.333333 Col: 6 7 8 9 10 Row 1 : 0.333333 0 0.333333 0 0 2 : 0.333333 0.333333 0.666667 0.666667 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 1: 0.292893 2: 0.292893 Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 0.5 0.866025 Incenter 1: 0.5 2: 0.288675 Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 0.5 10 Incenter 1: 0.5 2: 0.475625 Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 10 2 Incenter 1: 0.989247 2: 0.0979548 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 Incenter 1: 0.292893 2: 0.292893 Incircle radius is 0.292893 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.292893 GEOMETRY_TEST2104 TRIANGLE_LATTICE_LAYER_POINT_NEXT returns the next point in a triangle lattice layer defined by: C(3) - 1 < X(1)/C(1) + X(2)/C(2) <= C(3). 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 1: 0 2: 0 Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 0.5 0.866025 Orthocenter 1: 0.5 2: 0.288675 Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 0.5 10 Orthocenter 1: 0.5 2: 0.025 Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 10 2 Orthocenter 1: 10 2: -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.250000 0.250000 0.250000 0.750000 0.250000 0.000000 1.000000 1.000000 0.707107 11.000000 0.500000 10.012492 0.000000 1.000000 0.000000 0.500000 -10.000000 10.000000 0.600000 0.600000 0.141421 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.250000 0.250000 -0.250000 0.750000 0.250000 0.000000 1.000000 1.000000 0.707107 11.000000 0.500000 10.012492 0.000000 1.000000 0.000000 0.500000 -10.000000 10.000000 0.600000 0.600000 0.141421 TEST2095 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.41421 3.41421 3 3: 1.70711 2.70711 4 P DIST 1.000000 2.000000 3.000000 0.000000 1.353553 2.353553 3.000000 0.000000 0.000000 0.000000 0.000000 3.741657 TEST2072 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.250000 0.250000 0.000000 0.250000 0.750000 0.250000 0.750000 0.250000 1.000000 1.000000 0.500000 0.500000 11.000000 0.500000 1.000000 0.000000 0.000000 1.000000 0.000000 1.000000 0.500000 -10.000000 0.500000 0.000000 0.600000 0.600000 0.500000 0.500000 TEST2115 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.828427 Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 0.5 0.866025 Quality = 1.000000 Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 0.5 10 Quality = 0.189775 Triangle vertices: Row: 1 2 Col 1: 0 0 2: 1 0 3: 10 2 Quality = 0.008335 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: 0.706341 3.707723 0.166436 0.569241 0.264323 0.974887 4.823647 0.025207 0.941216 0.033578 1.254659 3.228926 0.337622 0.409642 0.252736 -0.712067 2.537562 0.125062 0.179187 0.695751 2.067980 2.661706 0.567712 0.220569 0.211719 0.703147 2.708282 0.332478 0.236094 0.431428 -0.433591 2.619837 0.157762 0.206612 0.635626 1.352549 2.504834 0.474619 0.168278 0.357103 1.177012 4.033299 0.190619 0.677766 0.131615 2.449371 2.519134 0.655040 0.173045 0.171916 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.000000 3.000000 0.333333 0.333333 0.333333 1.000000 3.000000 3.000000 0.000000 1.166667 -0.666667 0.500000 3.000000 0.000000 0.060612 3.938604 0.020335 0.646201 0.333464 0.060612 3.938604 1.191249 3.781417 0.234972 0.593806 0.171222 1.191249 3.781417 0.736414 3.936954 0.133243 0.645651 0.221105 0.736414 3.936954 0.374307 2.642146 0.288693 0.214049 0.497258 0.374307 2.642146 -1.547989 2.115272 0.056123 0.038424 0.905453 -1.547989 2.115272 1.473141 3.911582 0.260260 0.637194 0.102546 1.473141 3.911582 2.542350 2.860665 0.613614 0.286888 0.099498 2.542350 2.860665 0.549822 4.051260 0.083094 0.683753 0.233153 0.549822 4.051260 TEST219 TUBE_2D computes corners of a tube of radius DIST surrounding a sequence of points. Test number 1 Number of points N = 4 Tube radius DIST = 0.500000 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 number 2 Number of points N = 5 Tube radius DIST = 0.500000 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 number 3 Number of points N = 5 Tube radius DIST = 1.000000 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.4142 19 3: 10.4142 9 4: 21 9 5: 8.58579 20 P2: Row: 1 2 Col 1: 9 21 2: 19.5858 21 3: 9.58579 11 4: 21 11 5: 10 21.4142 Test number 4 Number of points N = 5 Tube radius DIST = 1.000000 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 TUPLE_NEXT2_TEST TUPLE_NEXT2 returns the next "tuple", that is, a vector of N integers. N = 3 The minimum tuple: 2 3 8 The maximum tuple: 4 3 5 1 2 3 8 2 2 3 7 3 2 3 6 4 2 3 5 5 3 3 8 6 3 3 7 7 3 3 6 8 3 3 5 9 4 3 8 10 4 3 7 11 4 3 6 12 4 3 5 TEST220 VECTOR_DIRECTIONS_ND computes the angles that a vector makes with the axes. X Y AX AY AX AY (__Radians___) (___Degrees___) 1.000000 0.000000 0.000000 1.570796 0.000000 90.000000 1.732051 1.000000 0.523599 1.047198 30.000000 60.000000 -1.732051 1.000000 2.617994 1.047198 150.000000 60.000000 -1.732051 -1.000000 2.617994 2.094395 150.000000 120.000000 1.732051 -1.000000 0.523599 2.094395 30.000000 120.000000 TEST221 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.000000 0.000000 0.000000 0.000000 1.570796 1.570796 0.000000 90.000000 90.000000 1.000000 2.000000 3.000000 1.300247 1.006854 0.640522 74.498640 57.688467 36.699225 0.000000 0.000000 1.000000 1.570796 1.570796 0.000000 90.000000 90.000000 0.000000 VECTOR_ROTATE_2D_TEST VECTOR_ROTATE_2D rotates a vector through a given angle around the origin. X1 Y1 Angle X2 Y2 1.000000 0.000000 30.000000 0.866025 0.500000 0.000000 2.000000 -45.000000 1.414214 1.414214 1.000000 1.000000 270.000000 1.000000 -1.000000 TEST2225 VECTOR_ROTATE_3D rotates a vector through a given angle around the origin. Rotations will be about the following axis: 1.000000 1.000000 1.000000 V1 Angle V2 ---------------------- ------ ---------------------- 1.000000 0.000000 0.000000 30.000000 0.910684 0.333333 -0.244017 0.000000 2.000000 0.000000 -45.000000 1.011759 1.609476 -0.621234 0.000000 0.000000 3.000000 90.000000 2.732051 -0.732051 1.000000 1.000000 1.000000 1.000000 270.000000 1.000000 1.000000 1.000000 1.000000 1.000000 -2.000000 30.000000 0.000000 1.732051 -1.732051 Rotations will be about the following axis: 0.000000 0.000000 2.000000 V1 Angle V2 ---------------------- ------ ---------------------- 1.000000 1.000000 1.000000 90.000000 -1.000000 1.000000 1.000000 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.000000 5.000000 10.000000 5.000000 30.000000 10.866025 5.500000 10.000000 7.000000 10.000000 5.000000 -45.000000 11.414214 6.414214 11.000000 6.000000 10.000000 5.000000 270.000000 11.000000 4.000000 10.000000 5.000000 10.000000 5.000000 20.000000 10.000000 5.000000 VECTOR_SEPARATION_ND_TEST VECTOR_SEPARATION_3D computes the separation angle between two vectors. -----Vector 1----- -----Vector 2----- Radians Degrees 1.000000 0.000000 0.000000 1.000000 2.000000 3.000000 1.300247 74.498640 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000 1.570796 90.000000 1.000000 0.000000 0.000000 -3.000000 2.000000 -1.000000 2.501070 143.300775 1.000000 0.000000 0.000000 -2.000000 -4.000000 -6.000000 1.841346 105.501360 1.000000 2.000000 3.000000 0.000000 0.000000 1.000000 0.640522 36.699225 1.000000 2.000000 3.000000 -3.000000 2.000000 -1.000000 1.714144 98.213211 1.000000 2.000000 3.000000 -2.000000 -4.000000 -6.000000 3.141593 180.000000 0.000000 0.000000 1.000000 -3.000000 2.000000 -1.000000 1.841346 105.501360 0.000000 0.000000 1.000000 -2.000000 -4.000000 -6.000000 2.501070 143.300775 -3.000000 2.000000 -1.000000 -2.000000 -4.000000 -6.000000 1.427449 81.786789 VECTOR_UNIT_ND_TEST VECTOR_UNIT normalizes a vector in ND. Original vector: 1: -5.63163 2: 9.12635 3: 6.59018 4: 1.23391 5: -1.69386 Norm of original vector = 12.7604 Normalized vector: 1: -0.441337 2: 0.715209 3: 0.516456 4: 0.0966983 5: -0.132743 Norm of normalized vector = 1 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 1 2 5 1 1 2 7 1 1 3 3 1 1 3 4 1 1 3 5 1 1 3 6 1 1 3 7 1 1 4 4 1 1 4 5 1 1 4 7 1 1 5 7 1 1 6 2 1 2 6 3 1 2 6 6 1 1 6 7 1 1 7 3 1 2 8 8 1 3 The stack-based list of regions is: Region 3 include 1 voxels: 8 8 1 Region 2 include 3 voxels: 7 3 1 6 3 1 6 2 1 Region 1 include 14 voxels: 6 7 1 6 6 1 5 7 1 4 7 1 3 7 1 2 7 1 4 5 1 4 4 1 3 6 1 3 5 1 3 4 1 3 3 1 2 5 1 2 4 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. Unit wedge volume = 1 XY_TO_POLAR_TEST XY_TO_POLAR converts (X,Y) to (R,Theta). POLAR_TO_XY converts (R,Theta) to (X,Y); X Y ===> R T => X Y -0.563163 0.912635 1.072407 2.123676 -0.563163 0.912635 0.659018 0.123391 0.670470 0.185091 0.659018 0.123391 -0.169386 -0.867763 0.884140 -1.763571 -0.169386 -0.867763 -0.484844 -0.780086 0.918482 -2.126894 -0.484844 -0.780086 -0.912342 0.267931 0.950871 2.855949 -0.912342 0.267931 -0.876546 -0.100922 0.882336 -3.026961 -0.876546 -0.100922 -0.197387 0.509347 0.546256 1.940507 -0.197387 0.509347 0.594574 -0.996323 1.160249 -1.032757 0.594574 -0.996323 0.795008 -0.298495 0.849198 -0.359176 0.795008 -0.298495 -0.810910 -0.972766 1.266432 -2.265700 -0.810910 -0.972766 XYZ_TO_RADEC_TEST XYZ_TO_RADEC converts RADEC to XYZ coordinates. RADEC_TO_XYZ converts XYZ to RADEC coordinates. P1 RA DEC P2 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 1.000000 0.000000 6.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 1.000000 0.000000 90.000000 0.000000 0.000000 1.000000 1.000000 1.000000 1.000000 3.000000 35.264390 0.577350 0.577350 0.577350 5.000000 -2.000000 -1.000000 22.546573 -10.519735 0.912871 -0.365148 -0.182574 -2.000000 -2.000000 -2.000000 15.000000 -35.264390 -0.577350 -0.577350 -0.577350 XYZ_TO_RTP_TEST XYZ_TO_RTP converts (R,Theta,Phi) to XYZ coordinates. RTP_TO_XYZ converts XYZ to (R,Theta,Phi) coordinates. X1 Y1 Z1 R THETA PHI X2 Y2 Z2 -0.9079 2.7816 2.1475 3.6295 1.8863 0.9376 -0.9079 2.7816 2.1475 0.8085 0.0765 -1.6694 1.8565 0.0944 2.6888 0.8085 0.0765 -1.6694 -0.7121 -1.4502 -1.7809 2.4045 4.2559 2.4048 -0.7121 -1.4502 -1.7809 1.1698 -1.6914 0.2477 2.0714 5.3175 1.4509 1.1698 -1.6914 0.2477 0.0065 1.7734 1.9864 2.6629 1.5671 0.7288 0.0065 1.7734 1.9864 XYZ_TO_TP_TEST XYZ_TO_TP converts XYZ to (Theta,Phi) coordinates. TP_TO_XYZ converts (Theta,Phi) to normalized XYZ coordinates. P1 T P P2 1.000000 0.000000 0.000000 0.000000 1.570796 1.000000 0.000000 0.000000 0.000000 1.000000 0.000000 1.570796 1.570796 0.000000 1.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000 1.000000 1.000000 1.000000 0.785398 0.955317 0.577350 0.577350 0.577350 5.000000 -2.000000 -1.000000 5.902679 1.754400 0.912871 -0.365148 -0.182574 -2.000000 -2.000000 -2.000000 3.926991 2.186276 -0.577350 -0.577350 -0.577350 geometry_test Normal end of execution. 08-Apr-2019 08:41:44 diary off