9 May 2022 9:54:08.761 PM geometry_test(): FORTRAN90 version Test geometry(). ANGLE_BOX_2D_TEST ANGLE_BOX_2D Compute points P4 and P5, normal to line through P1 and P2, and line through P2 and P3, and DIST units from P2. DIST = 1.00000 P1: 0.00000 0.00000 P2: 3.00000 0.00000 P3: 4.00000 2.00000 P4: 2.38197 1.00000 P5: 3.61803 -1.00000 DIST = 1.00000 P1: 0.00000 0.00000 P2: 3.00000 0.00000 P3: 2.00000 -2.00000 P4: 3.61803 -1.00000 P5: 2.38197 1.00000 DIST = 1.00000 P1: 3.00000 0.00000 P2: 3.00000 0.00000 P3: 2.00000 -2.00000 P4: 2.10557 0.447214 P5: 3.89443 -0.447214 ANGLE_CONTAINS_POINT_2D_TEST ANGLE_CONTAINS_POINT_2D sees if a point lies within an angle. Vertex P1 1: 1.0000000 2: 0.0000000 Vertex P2 1: 0.0000000 2: 0.0000000 Vertex P3 1: 1.0000000 2: 1.0000000 X Y Inside? 1.00000 0.00000 T 0.866025 0.500000 F 0.500000 0.866025 T 0.612323E-16 1.00000 T -0.500000 0.866025 T -0.866025 0.500000 T -1.00000 0.122465E-15 T -0.866025 -0.500000 T -0.500000 -0.866025 T -0.183697E-15 -1.00000 T 0.500000 -0.866025 T 0.866025 -0.500000 T 1.00000 -0.244929E-15 T Vertex P1 1: 1.0000000 2: 0.0000000 Vertex P2 1: 0.0000000 2: 0.0000000 Vertex P3 1: 0.0000000 2: 1.0000000 X Y Inside? 1.00000 0.00000 T 0.866025 0.500000 F 0.500000 0.866025 F 0.612323E-16 1.00000 T -0.500000 0.866025 T -0.866025 0.500000 T -1.00000 0.122465E-15 T -0.866025 -0.500000 T -0.500000 -0.866025 T -0.183697E-15 -1.00000 T 0.500000 -0.866025 T 0.866025 -0.500000 T 1.00000 -0.244929E-15 T Vertex P1 1: 1.0000000 2: -1.0000000 Vertex P2 1: 0.0000000 2: 0.0000000 Vertex P3 1: 0.0000000 2: 1.0000000 X Y Inside? 1.00000 0.00000 F 0.866025 0.500000 F 0.500000 0.866025 F 0.612323E-16 1.00000 T -0.500000 0.866025 T -0.866025 0.500000 T -1.00000 0.122465E-15 T -0.866025 -0.500000 T -0.500000 -0.866025 T -0.183697E-15 -1.00000 T 0.500000 -0.866025 T 0.866025 -0.500000 F 1.00000 -0.244929E-15 F Vertex P1 1: 1.0000000 2: 0.0000000 Vertex P2 1: 0.0000000 2: 0.0000000 Vertex P3 1: -1.0000000 2: 0.0000000 X Y Inside? 1.00000 0.00000 T 0.866025 0.500000 F 0.500000 0.866025 F 0.612323E-16 1.00000 F -0.500000 0.866025 F -0.866025 0.500000 F -1.00000 0.122465E-15 T -0.866025 -0.500000 T -0.500000 -0.866025 T -0.183697E-15 -1.00000 T 0.500000 -0.866025 T 0.866025 -0.500000 T 1.00000 -0.244929E-15 T Vertex P1 1: 1.0000000 2: 0.0000000 Vertex P2 1: 0.0000000 2: 0.0000000 Vertex P3 1: 0.0000000 2: -1.0000000 X Y Inside? 1.00000 0.00000 T 0.866025 0.500000 F 0.500000 0.866025 F 0.612323E-16 1.00000 F -0.500000 0.866025 F -0.866025 0.500000 F -1.00000 0.122465E-15 F -0.866025 -0.500000 F -0.500000 -0.866025 F -0.183697E-15 -1.00000 F 0.500000 -0.866025 T 0.866025 -0.500000 T 1.00000 -0.244929E-15 T Vertex P1 1: 1.0000000 2: 0.0000000 Vertex P2 1: 0.0000000 2: 0.0000000 Vertex P3 1: 1.0000000 2: -0.10000000E-01 X Y Inside? 1.00000 0.00000 T 0.866025 0.500000 F 0.500000 0.866025 F 0.612323E-16 1.00000 F -0.500000 0.866025 F -0.866025 0.500000 F -1.00000 0.122465E-15 F -0.866025 -0.500000 F -0.500000 -0.866025 F -0.183697E-15 -1.00000 F 0.500000 -0.866025 F 0.866025 -0.500000 F 1.00000 -0.244929E-15 T angle_degrees_2d_test angle_degrees_2d computes an angle. X Y Theta ATAN2(y, x), angle_degrees_2d 1.000 0.000 0.000 0.000 0.000 0.866 0.500 30.000 30.000 330.000 0.500 0.866 60.000 60.000 300.000 0.000 1.000 90.000 90.000 270.000 -0.500 0.866 120.000 120.000 240.000 -0.866 0.500 150.000 150.000 210.000 -1.000 0.000 180.000 180.000 180.000 -0.866 -0.500 210.000 -150.000 150.000 -0.500 -0.866 240.000 -120.000 120.000 -0.000 -1.000 270.000 -90.000 90.000 0.500 -0.866 300.000 -60.000 60.000 0.866 -0.500 330.000 -30.000 30.000 1.000 -0.000 360.000 -0.000 0.000 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.7764571 2: 5.8977775 Point P2: 1: 5.0000000 2: 3.0000000 Point P3: 1: 6.9318517 2: 3.5176381 End point of unit ray from P2, defining half angle, P4: 1: 5.7071068 2: 3.7071068 Expected value of P4: 1: 5.7071068 2: 3.7071068 ANGLE_RAD_2D_TEST ANGLE_RAD_2D computes the angle between two rays; Angle = 5.49779 Angle = 4.71239 Angle = 3.92699 Angle = 3.14159 Angle = 1.57080 Angle = 0.999967E-02 ANGLE_RAD_3D_TEST ANGLE_RAD_3D computes an angle; P, ANGLE_RAD_3D, (Degrees) 1.000 0.000 0.000 1.571 90.00 1.000 2.000 3.000 0.6405 36.70 0.000 0.000 1.000 0.000 0.000 ANGLE_RAD_ND_TEST ANGLE_RAD_ND computes an angle in N dimensions. X Y Theta ATAN2(y, x), ANGLE_RAD_ND 1.000 0.000 0.000 0.000 0.000 0.866 0.500 30.000 30.000 0.524 0.500 0.866 60.000 60.000 1.047 0.000 1.000 90.000 90.000 1.571 -0.500 0.866 120.000 120.000 2.094 -0.866 0.500 150.000 150.000 2.618 -1.000 0.000 180.000 180.000 3.142 -0.866 -0.500 210.000 -150.000 2.618 -0.500 -0.866 240.000 -120.000 2.094 -0.000 -1.000 270.000 -90.000 1.571 0.500 -0.866 300.000 -60.000 1.047 0.866 -0.500 330.000 -30.000 0.524 1.000 -0.000 360.000 -0.000 0.000 ANGLE_TURN_2D_TEST ANGLE_TURN_2D computes the turning angle defined by the line segments [P1,P2] and [P2,P3]. Our three points are: P1 = (C,S) P2 = (0,0) P3 = (1,0) C = cosine ( theta ), S = sine ( theta ). Test Theta Turn 1 0. 3.14159 2 30. 2.61799 3 60. 2.09440 4 90. 1.57080 5 120. 1.04720 6 150. 0.523599 7 180. 0.00000 8 210. -0.523599 9 240. -1.04720 10 270. -1.57080 11 300. -2.09440 12 330. -2.61799 13 360. -3.14159 ANNULUS_SECTOR_CENTROID_2D_TEST ANNULUS_SECTOR_CENTROID_2D computes the centroid of a circular annulus. The annulus has center 5.00000 3.00000 The inner radius is R1 = 2.00000 The outer radius is R2 = 3.00000 The first angle is THETA1 = 0.523599 The second angle is THETA2 = 1.04720 Centroid: 6.77094447 4.77094447 BALL01_SAMPLE_2D_TEST BALL01_SAMPLE_2D samples the unit ball in 2 dimensions; A few sample values: 0.5418 -0.1642 -0.6177 -0.3953 0.5570 -0.6885 0.2427 0.0092 -0.2894 -0.2573 Number of sample points = 1000 Now average the points, which should get a value close to zero, and closer as sample_num increases. Average: -0.0102 -0.0143 Now average the distance of the points from the center, which should be 1/sqrt(2) = 0.7071 Average: 0.6631 Now average the angle THETA, which should be PI. Average: 3.0544 BALL01_SAMPLE_3D_TEST BALL01_SAMPLE_3D samples the unit ball in 3 dimensions; A few sample values: -0.5871 0.5313 0.4162 0.3505 0.1336 0.0602 -0.0013 0.2653 0.6095 0.0140 0.3663 -0.8406 -0.5787 0.2358 -0.7562 Number of sample points = 1000 Now average the points, which should get a value close to zero, and closer as sample_num increases. Average: -0.0103 0.0218 0.0096 Now average the distance of the points from the center, which should be the 1/2**(1/dim_num) = 0.7937 Average: 0.7586 Now average the angle THETA, which should be PI. Average: 3.1476 Now average the angle PHI, which should be PI/2. Average: 1.5789 BALL01_SAMPLE_ND_TEST BALL01_SAMPLE_ND samples the unit ball in N dimensions; A few sample values: 0.3982 0.1228 -0.4640 0.6592 0.4242 -0.3681 -0.1133 0.4124 -0.8420 0.3818 -0.4203 0.3255 -0.1546 -0.2344 0.5856 Number of sample points = 1000 Now average the points, which should get a value close to zero, and closer as N increases. Average: 0.0080 0.0062 0.0055 Now average the distance of the points from the center, which should be the 1/2**(1/dim_num) = 0.7937 Average: 0.7460 Now average the angle THETA, which should be PI. Average: 3.0789 Now average the angle PHI, which should be PI/2. Average: 1.6056 BALL01_VOLUME_TEST BALL01_VOLUME returns the volume of the unit ball. Volume = 4.18879 BASIS_MAP_3D_TEST BASIS_MAP_3D computes the linear transform A which maps vectors U1, U2 and U3 to vectors V1, V2 and V3. The matrix U Col 1 2 3 Row 1: 1. 0. 1. 2: 2. 0. 0. 3: 3. 1. 2. The matrix V Col 1 2 3 Row 1: 14. 3. 7. 2: 4. 1. 3. 3: 4. 0. 2. The transformation matrix Col 1 2 3 Row 1: 1. 2. 3. 2: 1. 0. 1. 3: 2. 1. 0. The product matrix A * [ U1 | U2 | U3 ] Col 1 2 3 Row 1: 14. 3. 7. 2: 4. 1. 3. 3: 4. 0. 2. BOX_CONTAINS_POINT_2D_TEST BOX_CONTAINS_POINT_2D reports if a box contains a point. We will call the function repeatedly, and draw a sketch of the box. --------------------------------------------- - --------------------------------------------- - --------------------------------------------- - --------------------------------------------- - --------------------------------------------- - --------------------------------------------- - --------------------------------------------- - --------------------------------------------- - --------------------------------------------- - --------------------------------------------- - --------------------------------------------- - --------------------------------------------- - --------------------------------------------- - --------------------------------------------- - --------------------------------------------- - ------*************************************-- - ------*************************************-- - ------*************************************-- - ------*************************************-- - ------*************************************-- - ------*************************************-- - ------*************************************-- - ------*************************************-- - ------*************************************-- - ------*************************************-- - ------*************************************-- - ------*************************************-- - ------*************************************-- - ------*************************************-- - ------*************************************-- - ------*************************************-- - ------*************************************-- - ------*************************************-- - --------------------------------------------- - --------------------------------------------- - --------------------------------------------- - --------------------------------------------- - --------------------------------------------- - --------------------------------------------- - --------------------------------------------- - --------------------------------------------- - --------------------------------------------- - --------------------------------------------- - --------------------------------------------- - --------------------------------------------- - --------------------------------------------- - BOX_SEGMENT_CLIP_2D_TEST BOX_SEGMENT_CLIP_2D clips a line with respect to a box. The lower left box corner is: -10.0000 10.0000 The upper right box corner is: 10.0000 20.0000 We list the points PA and PB, and then the clipped values. 1.0000 2.0000 8.0000 16.0000 5.0000 10.0000 -3.0000 12.0000 5.0000 12.0000 Line is inside the box. -20.0000 20.0000 7.0000 20.0000 -10.0000 20.0000 -20.0000 40.0000 0.0000 0.0000 -10.0000 20.0000 -5.0000 10.0000 10.0000 40.0000 20.0000 30.0000 Line is outside the box. BOX_RAY_INT_2D_TEST For a box with coordinate line sides in 2D, BOX_RAY_INT_2D computes the intersection of a shape and a ray whose origin is within the shape. Lower left box corner: 0.00000 0.00000 Upper right box corner: 5.00000 3.00000 Origin: 3.0000 1.0000 Point 2: 5.0000 5.0000 Intersection: 4.0000 3.0000 Correct: 4.0000 3.0000 Origin: 4.0000 1.0000 Point 2: 3.0000 1.0000 Intersection: -0.0000 1.0000 Correct: 0.0000 1.0000 Origin: 3.0000 1.0000 Point 2: 4.0000 2.0000 Intersection: 5.0000 3.0000 Correct: 5.0000 3.0000 BOX01_CONTAINS_POINT_2D_TEST BOX01_CONTAINS_POINT_2D reports if the unit box contains a point. We will call the function repeatedly, and draw a sketch of the unit square. ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------*******************************------ ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- circle_area_2d_test circle_area_2d computes the area of a circle of radius R. R Area 1.0000 3.1416 2.0000 12.5664 4.0000 50.2655 8.0000 201.0619 CIRCLE_DIA2IMP_2D_TEST CIRCLE_DIA2IMP_2D converts a diameter to an implicit circle in 2D. P1: 1: -0.80734183E-01 2: 6.5464871 P2: 1: 4.0807342 2: -2.5464871 The implicit circle: Radius = 5.00000 Center = 2.00000 2.00000 circle_exp_contains_point_2d_test circle_exp_contains_point_2d determines if a point lies inside a circle. P1: 1: 4.0000000 2: 2.0000000 P2: 1: 1.0000000 2: 5.0000000 P3: 1: -2.0000000 2: 2.0000000 P: 1: 2.0000000 2: 3.0000000 INSIDE = -1 The point is inside the circle. P1: 1: 4.0000000 2: 2.0000000 P2: 1: 1.0000000 2: 5.0000000 P3: 1: -2.0000000 2: 2.0000000 P: 1: 1.0000000 2: -1.0000000 INSIDE = 0 The point is on the circle. P1: 1: 4.0000000 2: 2.0000000 P2: 1: 1.0000000 2: 5.0000000 P3: 1: -2.0000000 2: 2.0000000 P: 1: 4.0000000 2: 6.0000000 INSIDE = 1 The point is outside the circle circle_exp2imp_2d_test circle_exp2imp_2d() computes the radius and center of the circle through three points. We can use this routine to compute, for three points in space, the circle incident to those points, and hence the radius of that circle, and hence the curvature of those points. Our three points are: (0,0) (1,0) (C,S) C = cosine ( theta), S = sine ( theta ). Test Theta Curvature 1 0. 2.00000 2 30. 1.93185 3 60. 1.73205 4 90. 1.41421 5 120. 1.00000 6 150. 0.517638 7 180. 0.122465E-15 8 210. 0.517638 9 240. 1.00000 10 270. 1.41421 11 300. 1.73205 12 330. 1.93185 13 360. 2.00000 circle_imp_line_exp_dist_2d_test circle_imp_line_exp_dist_2d() finds the distance between an implicit circle and an explicit line. The implicit circle: Radius = 5.00000 Center = 5.00000 2.00000 The explicit line: P1 = 13.0000 8.0000 P2 = 17.0000 11.0000 Distance is 0.0000 circle_imp_line_exp_intersect_test circle_imp_line_exp_intersect() finds the intersection of an implicit circle and an explicit line. The implicit circle: Radius = 5.00000 Center = 5.00000 2.00000 The explicit line: P1 = 13.0000 8.0000 P2 = 17.0000 11.0000 Number of intersections found = 2 1 9.0000 5.0000 2 1.0000 -1.0000 circle_imp_line_par_int_2d_test circle_imp_line_par_int_2d finds the intersection of an implicit circle and a parametric line. The implicit circle: Radius = 5.00000 Center = 5.00000 2.00000 The parametric line F, G = 0.8000 0.6000 X0, Y0 = 13.0000 8.0000 Number of intersections found = 2 1 1.0000 -1.0000 2 9.0000 5.0000 circle_imp_point_dist_2d_test circle_imp_point_dist_2d() finds the distance from a point to a circle. The circle: Radius = 5.00000 Center = 0.00000 0.00000 X Y D 5.4379 -3.9773 1.7372 7.7397 0.7908 2.7800 3.8448 6.3459 2.4198 6.4187 1.4400 1.5783 8.1966 -8.8580 7.0685 -6.2453 -2.8806 1.8776 2.9982 -1.4319 1.6774 -0.4489 -1.8633 3.0833 2.1487 -8.3594 3.6312 6.7892 6.1847 4.1839 circle_imp_points_2d_test circle_imp_points_2d() gets points on a circle; The implicit circle: Radius = 2.00000 Center = 5.00000 -2.00000 The area = 12.5664 Sample results: Row 1 2 Col 1: 7.00000 -2.00000 2: 6.41421 -0.585786 3: 5.00000 0.00000 4: 3.58579 -0.585786 5: 3.00000 -2.00000 6: 3.58579 -3.41421 7: 5.00000 -4.00000 8: 6.41421 -3.41421 For any N, the sampled points define a polygon whose area approximates the circle area. N Area 3 5.19615 4 8.00000 5 9.51057 6 10.3923 7 10.9456 8 11.3137 9 11.5702 10 11.7557 11 11.8941 12 12.0000 13 12.0828 14 12.1487 15 12.2021 16 12.2459 17 12.2822 18 12.3127 19 12.3386 20 12.3607 21 12.3797 22 12.3962 23 12.4107 24 12.4233 circle_imp_points_3d_test circle_imp_points_3d() gets points on a circle in 3D; The implicit circle: Radius = 2.00000 Center = 5.00000 -2.00000 1.00000 Normal = 1.00000 1.00000 1.00000 Points on the circle: Row 1 2 3 Col 1: 3.58579 -0.585786 1.00000 2: 3.36701 -1.18350 1.81650 3: 3.58579 -2.00000 2.41421 4: 4.18350 -2.81650 2.63299 5: 5.00000 -3.41421 2.41421 6: 5.81650 -3.63299 1.81650 7: 6.41421 -3.41421 1.00000 8: 6.63299 -2.81650 0.183503 9: 6.41421 -2.00000 -0.414214 10: 5.81650 -1.18350 -0.632993 11: 5.00000 -0.585786 -0.414214 12: 4.18350 -0.367007 0.183503 circle_imp_points_arc_2d_test circle_imp_points_arc_2d() returns points on a circular arc. The implicit circle: Radius = 2.00000 Center = 5.00000 -2.00000 The arc extends from THETA1 = 1.57080 to THETA2 = 4.71239 Sample results: Row 1 2 Col 1: 5.00000 0.00000 2: 4.48236 -0.681483E-01 3: 4.00000 -0.267949 4: 3.58579 -0.585786 5: 3.26795 -1.00000 6: 3.06815 -1.48236 7: 3.00000 -2.00000 8: 3.06815 -2.51764 9: 3.26795 -3.00000 10: 3.58579 -3.41421 11: 4.00000 -3.73205 12: 4.48236 -3.93185 13: 5.00000 -4.00000 circle_imp_segment_intersect_test circle_imp_segment_intersect() finds the intersection of an implicit circle and a line segment. The implicit circle: Radius = 5.00000 Center = 5.00000 2.00000 The line segment: P1 = 13.0000 8.0000 P2 = 17.0000 11.0000 Number of intersections found = 0 The line segment: P1 = -3.0000 -4.0000 P2 = 17.0000 11.0000 Number of intersections found = 2 1 9.0000 5.0000 2 1.0000 -1.0000 The line segment: P1 = -3.0000 -4.0000 P2 = 5.0000 2.0000 Number of intersections found = 1 1 1.0000 -1.0000 circle_imp2exp_2d_test circle_imp2exp_2d() converts an implicit circle to an explicit circle. The implicit circle: Radius = 3.00000 Center = 10.0000 5.00000 P1: 1: 13.000000 2: 5.0000000 P2: 1: 8.5000000 2: 7.5980762 P3: 1: 8.5000000 2: 2.4019238 The recovered implicit circle: Radius = 3.00000 Center = 10.0000 5.00000 circle_llr2imp_2d_test circle_llr2imp_2d() is given: an explicit line through P1 and P2, an explicit 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 = 3.80131 The first explicit line: P1 = 7.5757 -8.4647 P2 = 6.2377 -1.0175 The second explicit line: P1 = 9.2553 -7.9609 P2 = 1.7152 -1.8437 Center #1: 12.7338 -15.6781 Center #2: 10.6748 -4.21759 Center #3: 3.69147 -8.34199 Center #4: 1.63248 3.11848 3.80131 3.80131 3.80131 3.80131 3.80131 3.80131 3.80131 3.80131 Radius R = 1.47201 The first explicit line: P1 = 4.1983 -7.0480 P2 = -9.1502 -3.2412 The second explicit line: P1 = -6.7206 -3.4112 P2 = 4.3665 7.4883 Center #1: -7.55359 -2.16587 Center #2: -4.29842 -3.09419 Center #3: -9.96745 -4.53888 Center #4: -6.71228 -5.46720 1.47201 1.47201 1.47201 1.47201 1.47201 1.47201 1.47201 1.47201 Radius R = 4.71807 The first explicit line: P1 = -9.3634 8.4830 P2 = 9.7462 7.3898 The second explicit line: P1 = 2.2505 3.6434 P2 = 1.9200 -8.5804 Center #1: 6.94818 2.82407 Center #2: -2.47682 3.36327 Center #3: 7.20334 12.2610 Center #4: -2.22166 12.8002 4.71807 4.71807 4.71807 4.71807 4.71807 4.71807 4.71807 4.71807 Radius R = 4.63915 The first explicit line: P1 = 6.2901 5.2776 P2 = -9.9029 -3.8579 The second explicit line: P1 = -8.9200 -9.6265 P2 = 5.9906 -6.9708 Center #1: -26.8903 -8.11504 Center #2: -51.3024 -21.8874 Center #3: 0.704435 -3.20014 Center #4: -23.7076 -16.9725 4.63915 4.63915 4.63915 4.63915 4.63915 4.63915 4.63915 4.63915 Radius R = 3.95060 The first explicit line: P1 = 9.9627 8.3996 P2 = -0.3696 1.5283 The second explicit line: P1 = 2.9721 1.2078 P2 = 9.1839 -8.9146 Center #1: 3.08797 8.57212 Center #2: -3.49554 4.19384 Center #3: 7.22334 1.83337 Center #4: 0.639826 -2.54490 3.95060 3.95060 3.95060 3.95060 3.95060 3.95060 3.95060 3.95060 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.0000 -2.0000 6.2832 2.0000 -1.6667 5.1118 2.0000 -1.3333 4.6010 2.0000 -1.0000 4.1888 2.0000 -0.6667 3.8213 2.0000 -0.3333 3.4765 2.0000 0.0000 3.1416 2.0000 0.3333 2.8067 2.0000 0.6667 2.4619 2.0000 1.0000 2.0944 2.0000 1.3333 1.6821 2.0000 1.6667 1.1714 2.0000 2.0000 0.0000 circle_lune_area_by_angle_2d_test circle_lune_area_by_angle_2d() computes the area of a circular lune, defined by joining the endpoints of a circular arc. R Theta1 Theta2 Area 1.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.523599 0.011799 1.000000 0.000000 1.047198 0.090586 1.000000 0.000000 1.570796 0.285398 1.000000 0.000000 2.094395 0.614185 1.000000 0.000000 2.617994 1.058997 1.000000 0.000000 3.141593 1.570796 1.000000 0.000000 3.665191 2.082596 1.000000 0.000000 4.188790 2.527408 1.000000 0.000000 4.712389 2.856194 1.000000 0.000000 5.235988 3.051007 1.000000 0.000000 5.759587 3.129793 1.000000 0.000000 6.283185 3.141593 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 3.141593 2.000000 -1.666667 3.141593 2.000000 -1.333333 3.141593 2.000000 -1.000000 3.141593 2.000000 -0.666667 3.141593 2.000000 -0.333333 3.141593 2.000000 0.000000 3.141593 2.000000 0.333333 3.141593 2.000000 0.666667 3.141593 2.000000 1.000000 3.141593 2.000000 1.333333 3.141593 2.000000 1.666667 3.141593 2.000000 2.000000 3.141593 circle_lune_centroid_2d_test circle_lune_centroid_2d() computes the centroid of a circular lune, defined by joining the endpoints of a circular arc. The implicit circle: Radius = 2.00000 Center = 5.00000 3.00000 The first angle of our lune is always 0. Lune 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.0000 0.0000 2.0000 2.0000 0.5236 1.9319 2.0000 1.0472 1.7321 2.0000 1.5708 1.4142 2.0000 2.0944 1.0000 2.0000 2.6180 0.5176 2.0000 3.1416 0.0000 2.0000 3.6652 -0.5176 2.0000 4.1888 -1.0000 2.0000 4.7124 -1.4142 2.0000 5.2360 -1.7321 2.0000 5.7596 -1.9319 2.0000 6.2832 -2.0000 circle_pppr2imp_3d_test circle_pppr2imp_3d() is given 3D points P1, P2, P3, and a radius R, and determines the centers C of two circles of the given radius, passing through P1 and P2 and lying in the plane of P1, P2 and P3. Radius R = 17.6020 Point #1: -8.28039 2.55108 -1.71450 Point #2: -5.72351 -9.81833 -2.78829 Point #3: 9.72725 -3.60719 5.00355 Center #1: 7.73359 -1.17961 4.56773 Center #2: -21.7375 -6.08763 -9.07051 17.6020 17.6020 17.6020 17.6020 -0.888178E-15 -0.888178E-15 0.888178E-15 0.888178E-15 Radius R = 12.4868 Point #1: -6.37765 -7.77843 -8.82167 Point #2: -6.26368 -9.42957 0.287005 Point #3: -8.38641 -3.54343 -1.41209 Center #1: -10.4457 2.05178 -2.28413 Center #2: -2.19567 -19.2598 -6.25054 12.4868 12.4868 12.4868 12.4868 0.111022E-15 0.222045E-15 -0.111022E-14 -0.555112E-15 Radius R = 16.6098 Point #1: -0.570412 -5.77633 -8.79143 Point #2: 3.55768 -8.95891 6.69872 Point #3: 1.78621 9.93462 4.87001 Center #1: 1.26135 6.78287 1.92289 Center #2: 1.72592 -21.5181 -4.01559 16.6098 16.6098 16.6098 16.6098 -0.444089E-15 0.00000 0.00000 0.444089E-15 Radius R = 18.2553 Point #1: 7.43343 5.01964 7.74357 Point #2: -9.66132 2.18809 3.08673 Point #3: 4.00202 0.640119 2.07595 Center #1: 3.66943 -6.06072 -6.26764 Center #2: -5.89733 13.2685 17.0979 18.2553 18.2553 18.2553 18.2553 0.355271E-14 0.00000 0.00000 -0.177636E-14 Radius R = 15.7002 Point #1: -0.263601 -3.13908 4.84041 Point #2: 4.25654 -8.78163 -3.52341 Point #3: 8.05858 5.22099 -2.62359 Center #1: 9.13057 6.14231 -3.65086 Center #2: -5.13763 -18.0630 4.96787 15.7002 15.7002 15.7002 15.7002 0.00000 0.138778E-15 -0.388578E-15 0.888178E-15 circle_ppr2imp_2d_test circle_ppr2imp_2d() is given 2D 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 = 12.0316 Point #1: 5.52746 -8.42145 Point #2: -1.12833 -3.39493 Center #1: 9.00102 3.09784 Center #2: -4.60189 -14.9142 12.0316 12.0316 12.0316 12.0316 Radius R = 15.5890 Point #1: 1.95508 3.49770 Point #2: 6.29099 -8.96785 Center #1: -9.21639 -7.37496 Center #2: 17.4625 1.90481 15.5890 15.5890 15.5890 15.5890 Radius R = 11.4197 Point #1: -6.46179 5.21273 Point #2: -0.160367 8.00650 Center #1: 1.10158 -3.34326 Center #2: -7.72374 16.5625 11.4197 11.4197 11.4197 11.4197 Radius R = 3.53716 Point #1: 0.765643 8.72725 Point #2: -0.631080 8.40764 Center #1: -0.705393 11.9440 Center #2: 0.839956 5.19087 3.53716 3.53716 3.53716 3.53716 Radius R = 5.99129 Point #1: -4.58559 -5.48335 Point #2: -3.64516 -8.02188 Center #1: -9.58828 -8.78011 Center #2: 1.35753 -4.72512 5.99129 5.99129 5.99129 5.99129 circle_sector_area_2d_test circle_sector_area_2d() computes the area of a circular sector, defined by joining the endpoints of a circular arc to the center. R Theta1 Theta2 Area 1.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.523599 0.261799 1.000000 0.000000 1.047198 0.523599 1.000000 0.000000 1.570796 0.785398 1.000000 0.000000 2.094395 1.047198 1.000000 0.000000 2.617994 1.308997 1.000000 0.000000 3.141593 1.570796 1.000000 0.000000 3.665191 1.832596 1.000000 0.000000 4.188790 2.094395 1.000000 0.000000 4.712389 2.356194 1.000000 0.000000 5.235988 2.617994 1.000000 0.000000 5.759587 2.879793 1.000000 0.000000 6.283185 3.141593 circle_sector_centroid_2d_test circle_sector_centroid_2d() computes the centroid of a circular sector, defined by joining the endpoints of a circular arc to the center. The implicit circle: Radius = 2.00000 Center = 5.00000 3.00000 The first angle of our sector is always 0. Sector 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 circle_triangle_area_2d_test circle_triangle_area_2d() computes the signed area of a triangle, defined by joining the endpoints of a circular arc and the center. R Theta1 Theta2 Sector Triangle Lune 1.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.523599 0.250000 1.000000 0.000000 1.047198 0.433013 1.000000 0.000000 1.570796 0.500000 1.000000 0.000000 2.094395 0.433013 1.000000 0.000000 2.617994 0.250000 1.000000 0.000000 3.141593 0.000000 1.000000 0.000000 3.665191 -0.250000 1.000000 0.000000 4.188790 -0.433013 1.000000 0.000000 4.712389 -0.500000 1.000000 0.000000 5.235988 -0.433013 1.000000 0.000000 5.759587 -0.250000 1.000000 0.000000 6.283185 -0.000000 circle_triple_angles_2d_test circle_triple_angles_2d() computes the angles in the triangle formed by the centers of 3 cotangent circles of radius r1, r2, r3. R1 R2 R3 A1 A2 A3 5.0000 3.0000 2.0000 0.6669 1.0472 1.4274 5.0000 1.0000 4.0000 0.5513 1.9106 0.6797 3.0000 2.0000 2.0000 0.8230 1.1593 1.1593 3.0000 4.0000 5.0000 1.2810 1.0195 0.8411 5.0000 3.0000 5.0000 0.8957 1.3503 0.8957 5.0000 3.0000 1.0000 0.5054 0.8128 1.8235 5.0000 1.0000 1.0000 0.3349 1.4033 1.4033 2.0000 1.0000 4.0000 0.9818 1.6375 0.5223 1.0000 1.0000 3.0000 1.3181 1.3181 0.5054 5.0000 3.0000 4.0000 0.8411 1.2810 1.0195 CIRCLES_INTERSECT_POINTS_2D_TEST CIRCLE_INTERSECT_POINTS_2D determines intersection points of two circles in 2D. The first circle: Radius = 5.00000 Center = 0.00000 0.00000 The second circle: Radius = 0.500000 Center = 5.00000 5.00000 The circles do not intersect. The second circle: Radius = 5.00000 Center = 7.07107 7.07107 The circles intersect at two points: P 3.5353 3.5357 3.5357 3.5353 The second circle: Radius = 3.00000 Center = 4.00000 0.00000 The circles intersect at two points: P 4.0000 3.0000 4.0000 -3.0000 The second circle: Radius = 3.00000 Center = 6.00000 0.00000 The circles intersect at two points: P 4.3333 2.4944 4.3333 -2.4944 The second circle: Radius = 5.00000 Center = 0.00000 0.00000 The circles coincide (infinite intersection). TEST020 CUBE_SIZE_3D returns dimension information for a cube; CUBE_SHAPE_3D returns face and order information. SHAPE_PRINT_3D prints this information. Number of vertices = 8 Number of edges = 12 Number of faces = 6 Maximum face order = 4 SHAPE_PRINT_3D Information about a polytope. The number of vertices is 8 Vertices: Index X Y Z 1 -0.57735027 -0.57735027 -0.57735027 2 0.57735027 -0.57735027 -0.57735027 3 0.57735027 0.57735027 -0.57735027 4 -0.57735027 0.57735027 -0.57735027 5 -0.57735027 -0.57735027 0.57735027 6 0.57735027 -0.57735027 0.57735027 7 0.57735027 0.57735027 0.57735027 8 -0.57735027 0.57735027 0.57735027 The number of faces is 6 The maximum order of any face is 4 Index Order Indices of Nodes in Face 1 2 3 4 1 4 1 4 3 2 2 4 1 2 6 5 3 4 2 3 7 6 4 4 3 4 8 7 5 4 1 5 8 4 6 4 5 6 7 8 CUBE01_VOLUME_TEST CUBE01_VOLUME returns the volume of the unit cube. Volume = 1.00000 cylinder_point_dist_3d_test cylinder_point_dist_3d() computes the distance to a cylinder. Radius R = 1.00000 Center of bottom disk = 0.00000 -2.00000 0.00000 Center of top disk = 0.00000 2.00000 0.00000 P = 4.00000 0.500000 0.00000 DIST (computed) = 3.00000 DIST (exact) = 3.00000 P = -0.500000 -1.00000 0.00000 DIST (computed) = 0.500000 DIST (exact) = 0.500000 P = 4.00000 6.00000 0.00000 DIST (computed) = 5.00000 DIST (exact) = 5.00000 P = 0.750000 -10.0000 0.00000 DIST (computed) = 8.00000 DIST (exact) = 8.00000 P = 0.00000 0.00000 0.00000 DIST (computed) = 1.00000 DIST (exact) = 1.00000 P = 0.250000 1.75000 0.00000 DIST (computed) = 0.250000 DIST (exact) = 0.250000 cylinder_point_dist_signed_3d_test cylinder_point_dist_signed_3d() computes the signed distance to a cylinder. Radius R = 1.00000 Center of bottom disk = 0.00000 -2.00000 0.00000 Center of top disk = 0.00000 2.00000 0.00000 P = 4.00000 0.500000 0.00000 Signed distance (computed) = 3.00000 Signed distance (exact) = 3.00000 P = -0.500000 -1.00000 0.00000 Signed distance (computed) = -0.500000 Signed distance (exact) = -0.500000 P = 4.00000 6.00000 0.00000 Signed distance (computed) = 5.00000 Signed distance (exact) = 5.00000 P = 0.750000 -10.0000 0.00000 Signed distance (computed) = 8.00000 Signed distance (exact) = 8.00000 P = 0.00000 0.00000 0.00000 Signed distance (computed) = -1.00000 Signed distance (exact) = -1.00000 P = 0.250000 1.75000 0.00000 Signed distance (computed) = -0.250000 Signed distance (exact) = -0.250000 cylinder_point_inside_3d_test cylinder_point_inside_3d() determines if a point is inside a cylinder. Radius R = 1.00000 Center of bottom disk = 0.00000 -2.00000 0.00000 Center of top disk = 0.00000 2.00000 0.00000 P = 4.00000 0.500000 0.00000 INSIDE (computed) = F INSIDE (exact) = F P = -0.500000 -1.00000 0.00000 INSIDE (computed) = T INSIDE (exact) = T P = 4.00000 6.00000 0.00000 INSIDE (computed) = F INSIDE (exact) = F P = 0.750000 -10.0000 0.00000 INSIDE (computed) = F INSIDE (exact) = F P = 0.00000 0.00000 0.00000 INSIDE (computed) = T INSIDE (exact) = T P = 0.250000 1.75000 0.00000 INSIDE (computed) = T INSIDE (exact) = T cylinder_point_near_3d_test cylinder_point_near_3d() computes the nearest point on a cylinder. Radius R = 1.00000 Center of bottom disk = 0.00000 -2.00000 0.00000 Center of top disk = 0.00000 2.00000 0.00000 P = 4.00000 0.500000 0.00000 PN (computed) = 1.00000 0.500000 0.00000 PN (exact) = 1.00000 0.500000 0.00000 P = -0.500000 -1.00000 0.00000 PN (computed) = -1.00000 -1.00000 0.00000 PN (exact) = -1.00000 -1.00000 0.00000 P = 4.00000 6.00000 0.00000 PN (computed) = 1.00000 2.00000 0.00000 PN (exact) = 1.00000 2.00000 0.00000 P = 0.750000 -10.0000 0.00000 PN (computed) = 0.750000 -2.00000 0.00000 PN (exact) = 0.750000 -2.00000 0.00000 P = 0.00000 0.00000 0.00000 PN (computed) = 1.00000 0.00000 0.00000 PN (exact) = 1.00000 0.00000 0.00000 P = 0.250000 1.75000 0.00000 PN (computed) = 0.250000 2.00000 0.00000 PN (exact) = 0.250000 2.00000 0.00000 (Note that case 5 is ambiguous. The set of nearest points forms a circle, any of which will do.) cylinder_sample_3d_test cylinder_sample_3d() samples points in a cylinder. Radius R = 1.00000 Center of bottom disk = 0.00000 -2.00000 0.00000 Center of top disk = 0.00000 2.00000 0.00000 Sample points: Row 1 2 3 Col 1: 0.708898 -1.97020 -0.293786 2: -0.838572 0.583700 0.153797 3: 0.315780 1.66045 -0.128129 4: 0.588405 0.505552E-01 -0.648721 5: -0.152814 -1.14457 -0.812436 6: -0.680041E-01 1.13226 0.262479 7: 0.896358 1.08740 -0.260268 8: -0.424001 1.55556 0.537135 9: -0.830449 0.421560 -0.361323 10: 0.613848 -1.34206 0.181368 11: 0.606883 0.270988 -0.458953 12: 0.433646 -0.807979 0.678978 13: 0.340738 1.85591 0.531329 14: -0.342840 -0.986670 0.279753 15: -0.169344 1.35624 -0.375143 16: 0.287556 -0.251306 -0.558142 17: 0.744299 1.33607 0.455081 18: -0.936071 -0.223638 -0.285696 19: -0.428557 -0.210609 -0.307898 20: 0.237525 -1.64213 -0.688362 cylinder_volume_3d_test cylinder_volume_3d() computes the volume of a cylinder. Radius R = 5.00000 Center of bottom disk = 1.00000 2.00000 3.00000 Center of top disk = 5.00000 6.00000 5.00000 Volume (computed) = 471.239 Volume (exact) = 471.239 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.0000000 2: 0.0000000 3: 0.0000000 Using Sigma = 0.990000 0.9676 -0.1434 -0.2079 0.9928 0.0100 -0.1195 0.9802 0.1967 -0.0203 0.9777 -0.1315 0.1636 0.9616 0.2604 0.0862 0.9987 -0.0496 -0.0077 0.9895 0.0831 0.1183 0.9867 0.0082 0.1622 0.9893 -0.1458 -0.0050 0.9926 -0.1200 0.0201 0.9790 -0.1681 0.1151 0.9824 -0.1706 -0.0755 0.9930 0.0713 -0.0940 0.9968 -0.0350 -0.0712 0.9777 -0.1349 0.1607 0.9771 -0.0012 0.2130 0.9630 0.0371 -0.2668 0.9937 -0.0336 0.1073 0.9994 0.0280 -0.0218 0.9934 0.0058 -0.1142 Using Sigma = 0.500000 0.1298 -0.2190 0.9671 0.8127 -0.2326 0.5342 0.0556 0.9979 0.0334 -0.0559 -0.9907 -0.1239 -0.1827 0.2018 -0.9622 0.3370 0.8903 -0.3063 -0.3660 -0.2057 -0.9076 0.4633 -0.0807 -0.8825 0.2973 0.5978 -0.7444 0.5638 0.8073 0.1741 0.5103 0.6110 -0.6052 -0.3573 0.2640 -0.8959 0.4781 0.6193 0.6228 -0.2383 0.5962 -0.7667 0.7911 0.2449 0.5604 0.8093 0.3454 -0.4751 0.1393 -0.1501 -0.9788 0.2138 -0.5913 -0.7776 0.2809 0.3741 -0.8838 0.3323 0.7682 0.5472 Using Sigma = 0.100000 0.9269 -0.1026 0.3610 0.2335 -0.8292 -0.5078 0.5998 0.7132 -0.3627 0.7760 0.5984 -0.1994 0.3744 -0.1879 -0.9080 0.4726 0.1366 -0.8706 -0.1402 -0.3781 -0.9151 -0.2353 -0.3446 -0.9088 0.9570 0.2684 -0.1104 0.9165 -0.1207 0.3814 0.2156 0.7551 -0.6192 0.2226 -0.8885 -0.4012 -0.8446 -0.4767 -0.2438 -0.4295 0.4779 -0.7663 -0.2953 0.9167 -0.2691 0.2479 -0.4324 0.8669 0.2683 0.0507 -0.9620 0.7114 0.6896 0.1354 -0.9572 0.0274 -0.2882 0.0790 0.9819 0.1723 disk_point_dist_3d_test disk_point_dist_3d() finds the distance from a disk to a point in 3D. Disk radius = 2.00000 Disk center: 1: 0.0000000 2: 1.4142135 3: 1.4142135 Disk axis: 1: 0.0000000 2: 1.0000000 3: 1.0000000 Point: 1: 0.0000000 2: 0.0000000 3: 0.0000000 Distance = 2.00000 Expected = 2.00000 Point: 1: 0.0000000 2: 0.70710677 3: 2.1213202 Distance = 0.212132E-07 Expected = 0.00000 Point: 1: 2.0000000 2: 1.4142135 3: 1.4142135 Distance = 0.00000 Expected = 0.00000 Point: 1: 10.000000 2: 1.4142135 3: 1.4142135 Distance = 8.00000 Expected = 8.00000 Point: 1: 10.000000 2: 5.6568542 3: 5.6568542 Distance = 10.0000 Expected = 10.0000 dms_to_radians_test dms_to_radians() converts an angle from degrees/minutes/seconds to radians; 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 vertices = 20 Number of edges = 30 Number of faces = 12 Maximum face order = 5 SHAPE_PRINT_3D Information about a polytope. The number of vertices is 20 Vertices: Index X Y Z 1 0.57735027 0.57735027 0.57735027 2 0.57735027 0.57735027 -0.57735027 3 0.57735027 -0.57735027 0.57735027 4 0.57735027 -0.57735027 -0.57735027 5 -0.57735027 0.57735027 0.57735027 6 -0.57735027 0.57735027 -0.57735027 7 -0.57735027 -0.57735027 0.57735027 8 -0.57735027 -0.57735027 -0.57735027 9 0.35682209 0.93417236 0.00000000 10 -0.35682209 0.93417236 0.00000000 11 0.35682209 -0.93417236 0.00000000 12 -0.35682209 -0.93417236 0.00000000 13 0.93417236 0.00000000 0.35682209 14 0.93417236 0.00000000 -0.35682209 15 -0.93417236 0.00000000 0.35682209 16 -0.93417236 0.00000000 -0.35682209 17 0.00000000 0.35682209 0.93417236 18 0.00000000 -0.35682209 0.93417236 19 0.00000000 0.35682209 -0.93417236 20 0.00000000 -0.35682209 -0.93417236 The number of faces is 12 The maximum order of any face is 5 Index Order Indices of Nodes in Face 1 2 3 4 5 1 5 2 9 1 13 14 2 5 5 10 6 16 15 3 5 3 11 4 14 13 4 5 8 12 7 15 16 5 5 3 13 1 17 18 6 5 2 14 4 20 19 7 5 5 15 7 18 17 8 5 8 16 6 19 20 9 5 5 17 1 9 10 10 5 3 18 7 12 11 11 5 2 19 6 10 9 12 5 8 20 4 11 12 dual_size_3d_test dual_size_3d() finds the "sizes" of the dual of a polyhedron; The cube: Number of vertices: 8 Number of edges: 12 Number of faces: 6 Maximum face order: 4 The dual of the cube: Number of vertices: 6 Number of edges: 12 Number of faces: 8 Maximum face order: 3 The dodecahedron: Number of vertices: 20 Number of edges: 30 Number of faces: 12 Maximum face order: 5 The dual of the dodecahedron: Number of vertices: 12 Number of edges: 30 Number of faces: 20 Maximum face order: 3 The icosahedron: Number of vertices: 12 Number of edges: 30 Number of faces: 20 Maximum face order: 3 The dual of the icosahedron: Number of vertices: 20 Number of edges: 30 Number of faces: 12 Maximum face order: 5 The octahedron: Number of vertices: 6 Number of edges: 12 Number of faces: 8 Maximum face order: 3 The dual of the octahedron: Number of vertices: 8 Number of edges: 12 Number of faces: 6 Maximum face order: 4 The soccer ball: Number of vertices: 60 Number of edges: 90 Number of faces: 32 Maximum face order: 6 The dual of the "soccer ball": Number of vertices: 32 Number of edges: 90 Number of faces: 60 Maximum face order: 3 dual_shape_3d_test dual_shape_3d() finds the dual of a polyhedron. The dodecahedron: Number of vertices = 20 Number of edges = 30 Number of faces = 12 Maximum face order = 5 The dual of the dodecahedron: Number of vertices = 12 Number of edges = 30 Number of faces = 20 Maximum face order = 3 SHAPE_PRINT_3D Information about a polytope. The number of vertices is 12 Vertices: Index X Y Z 1 0.85065081 0.52573111 0.00000000 2 -0.85065081 0.52573111 0.00000000 3 0.85065081 -0.52573111 0.00000000 4 -0.85065081 -0.52573111 0.00000000 5 0.52573111 0.00000000 0.85065081 6 0.52573111 0.00000000 -0.85065081 7 -0.52573111 0.00000000 0.85065081 8 -0.52573111 0.00000000 -0.85065081 9 0.00000000 0.85065081 0.52573111 10 0.00000000 -0.85065081 0.52573111 11 0.00000000 0.85065081 -0.52573111 12 0.00000000 -0.85065081 -0.52573111 The number of faces is 20 The maximum order of any face is 3 Index Order Indices of Nodes in Face 1 2 3 1 3 1 9 5 2 3 1 6 11 3 3 3 5 10 4 3 3 12 6 5 3 2 7 9 6 3 2 11 8 7 3 4 10 7 8 3 4 8 12 9 3 1 11 9 10 3 2 9 11 11 3 3 10 12 12 3 4 12 10 13 3 1 5 3 14 3 1 3 6 15 3 2 4 7 16 3 2 8 4 17 3 5 9 7 18 3 5 7 10 19 3 6 8 11 20 3 6 12 8 TEST028 HALFPLANE_CONTAINS_POINT_2D determines whether a halfplane bounded by PA:PB contains the point P. P1 = 0.00000 0.00000 P2 = 2.00000 0.00000 P = 1.00000 1.00000 Contains? = T Correct = T P1 = 0.00000 0.00000 P2 = 2.00000 0.00000 P = 1.00000 -1.00000 Contains? = F Correct = F P1 = -5.00000 -5.00000 P2 = 10.0000 10.0000 P = -1.00000 1.00000 Contains? = T Correct = T P1 = 3.00000 150.000 P2 = 1.00000 50.0000 P = 2.00000 200.000 Contains? = F Correct = F 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.00000 -2.00000 -3.00000 6.00000 Case 1 Triangle vertices Row 1 2 3 Col 1: 0.00000 0.00000 0.00000 2: 0.00000 -1.00000 0.00000 3: 0.00000 0.00000 -2.00000 Number of intersection points is 0 Intersections: Row 1 2 3 Col Case 2 Triangle vertices Row 1 2 3 Col 1: -6.00000 0.00000 0.00000 2: 0.00000 -1.00000 0.00000 3: 0.00000 0.00000 -2.00000 Number of intersection points is 1 Intersections: Row 1 2 3 Col 1: -6.00000 0.00000 0.00000 Case 3 Triangle vertices Row 1 2 3 Col 1: 0.00000 0.00000 0.00000 2: 0.00000 3.00000 0.00000 3: 0.00000 0.00000 2.00000 Number of intersection points is 3 Intersections: Row 1 2 3 Col 1: 0.00000 3.00000 0.00000 2: 0.00000 0.00000 2.00000 3: 0.00000 0.00000 1.00000 Case 4 Triangle vertices Row 1 2 3 Col 1: -6.00000 0.00000 0.00000 2: 0.00000 4.00000 0.00000 3: 0.00000 0.00000 3.00000 Number of intersection points is 3 Intersections: Row 1 2 3 Col 1: -6.00000 0.00000 0.00000 2: 0.00000 4.00000 0.00000 3: 0.00000 0.00000 3.00000 Case 5 Triangle vertices Row 1 2 3 Col 1: -8.00000 0.00000 0.00000 2: 0.00000 -1.00000 0.00000 3: 0.00000 0.00000 -2.00000 Number of intersection points is 3 Intersections: Row 1 2 3 Col 1: -8.00000 0.00000 0.00000 2: -6.40000 -0.200000 0.00000 3: -7.00000 0.00000 -0.250000 Case 6 Triangle vertices Row 1 2 3 Col 1: 0.00000 0.00000 0.00000 2: 0.00000 4.00000 0.00000 3: 0.00000 0.00000 4.00000 Number of intersection points is 4 Intersections: Row 1 2 3 Col 1: 0.00000 3.00000 0.00000 2: 0.00000 4.00000 0.00000 3: 0.00000 0.00000 4.00000 4: 0.00000 0.00000 1.20000 TEST030 HALFSPACE_NORMAL_TRIANGLE_INT_3D finds intersection points of a normal form halfspace and a triangle. Plane point P: 1: -6.0000000 2: 0.0000000 3: 0.0000000 Plane normal: 1: 2.0000000 2: -4.0000000 3: -6.0000000 Case 1 Triangle vertices: Row 1 2 3 Col 1: 0.00000 0.00000 0.00000 2: 0.00000 -1.00000 0.00000 3: 0.00000 0.00000 -2.00000 Number of intersection points is 0 Intersections: Row 1 2 3 Col Case 2 Triangle vertices: Row 1 2 3 Col 1: -6.00000 0.00000 0.00000 2: 0.00000 -1.00000 0.00000 3: 0.00000 0.00000 -2.00000 Number of intersection points is 1 Intersections: Row 1 2 3 Col 1: -6.00000 0.00000 0.00000 Case 3 Triangle vertices: Row 1 2 3 Col 1: 0.00000 0.00000 0.00000 2: 0.00000 3.00000 0.00000 3: 0.00000 0.00000 2.00000 Number of intersection points is 2 Intersections: Row 1 2 3 Col 1: 0.00000 3.00000 0.00000 2: 0.00000 0.00000 2.00000 Case 4 Triangle vertices: Row 1 2 3 Col 1: -6.00000 0.00000 0.00000 2: 0.00000 4.00000 0.00000 3: 0.00000 0.00000 3.00000 Number of intersection points is 3 Intersections: Row 1 2 3 Col 1: -6.00000 0.00000 0.00000 2: 0.00000 4.00000 0.00000 3: 0.00000 0.00000 3.00000 Case 5 Triangle vertices: Row 1 2 3 Col 1: -8.00000 0.00000 0.00000 2: 0.00000 -1.00000 0.00000 3: 0.00000 0.00000 -2.00000 Number of intersection points is 3 Intersections: Row 1 2 3 Col 1: -8.00000 0.00000 0.00000 2: -6.40000 -0.200000 0.00000 3: -6.85714 0.00000 -0.285714 Case 6 Triangle vertices: Row 1 2 3 Col 1: 0.00000 0.00000 0.00000 2: 0.00000 4.00000 0.00000 3: 0.00000 0.00000 4.00000 Number of intersection points is 4 Intersections: Row 1 2 3 Col 1: 0.00000 3.00000 0.00000 2: 0.00000 4.00000 0.00000 3: 0.00000 0.00000 4.00000 4: 0.00000 0.00000 2.00000 TEST031 HAVERSINE computes the haversine of an angle. Degrees Radians Haversine 0.0000 0.0000 0.00000 30.0000 0.5236 0.669873E-01 60.0000 1.0472 0.250000 90.0000 1.5708 0.500000 120.0000 2.0944 0.750000 150.0000 2.6180 0.933013 180.0000 3.1416 1.00000 210.0000 3.6652 0.933013 240.0000 4.1888 0.750000 270.0000 4.7124 0.500000 300.0000 5.2360 0.250000 330.0000 5.7596 0.669873E-01 360.0000 6.2832 0.00000 TEST0315 HEXAGON_CONTAINS_POINT_2D reports if a hexagon contains a point. We will call the function repeatedly, and draw a sketch of an irregular hexagon in the unit square. ---------------------------------------- ---------------***---------------------- --------------*****--------------------- -------------********------------------- ------------**********------------------ -----------*************---------------- ----------***************--------------- ---------******************------------- --------********************------------ --------**********************---------- --------***********************--------- --------*************************------- --------**************************------ --------****************************---- --------*****************************--- --------*******************************- --------*******************************- --------*******************************- --------*******************************- --------******************************-- --------******************************-- --------******************************-- --------*****************************--- --------*****************************--- ---------****************************--- ----------**************************---- -----------*************************---- ------------************************---- -------------**********************----- --------------*********************----- ---------------********************----- ----------------******************------ ------------------****************------ --------------------**************------ ----------------------***********------- ------------------------*********------- --------------------------*******------- ----------------------------****-------- ------------------------------**-------- ---------------------------------------- TEST032 HEXAGON_SHAPE_2D: points on a unit hexagon. Angle X Y -10.0000 0.907604 -0.160035 0.00000 1.00000 0.00000 10.0000 0.907604 0.160035 20.0000 0.826352 0.300767 30.0000 0.750000 0.433013 40.0000 0.673648 0.565258 50.0000 0.592396 0.705990 60.0000 0.500000 0.866025 70.0000 0.315207 0.866025 80.0000 0.152704 0.866025 90.0000 0.530288E-16 0.866025 100.000 -0.152704 0.866025 110.000 -0.315207 0.866025 120.000 -0.500000 0.866025 130.000 -0.592396 0.705990 140.000 -0.673648 0.565258 150.000 -0.750000 0.433013 160.000 -0.826352 0.300767 170.000 -0.907604 0.160035 180.000 -1.00000 0.122465E-15 190.000 -0.907604 -0.160035 200.000 -0.826352 -0.300767 210.000 -0.750000 -0.433013 220.000 -0.673648 -0.565258 230.000 -0.592396 -0.705990 240.000 -0.500000 -0.866025 250.000 -0.315207 -0.866025 260.000 -0.152704 -0.866025 270.000 -0.159086E-15 -0.866025 280.000 0.152704 -0.866025 290.000 0.315207 -0.866025 300.000 0.500000 -0.866025 310.000 0.592396 -0.705990 320.000 0.673648 -0.565258 330.000 0.750000 -0.433013 340.000 0.826352 -0.300767 350.000 0.907604 -0.160035 360.000 1.00000 0.00000 370.000 0.907604 0.160035 TEST0321 HEXAGON_VERTICES_2D: the vertices of the unit hexagon. Vertices: Row 1 2 Col 1: 1.00000 0.00000 2: 0.500000 0.866025 3: -0.500000 0.866025 4: -1.00000 0.00000 5: -0.500000 -0.866025 6: 0.500000 -0.866025 i4col_find_item_test i4col_find_item() finds the first occurrence of an item in an integer array of columns. The matrix of columns: Col 1 2 3 4 Row 1: 11 12 13 14 2: 21 22 23 24 3: 31 32 33 34 4: 41 42 43 44 5: 51 52 53 54 Item 34 occurs in row 3 and column 4 Item 12 occurs in row 1 and column 2 Item 90 occurs in row -1 and column -1 TEST0323 I4COL_FIND_PAIR_WRAP finds the first occurrence of a pair of item in an integer array of columns. Items in the array are ordered by column, and wraparound is allowed. The matrix of columns: Col 1 2 3 4 Row 1: 11 12 13 14 2: 21 22 23 24 3: 31 32 33 34 4: 41 42 43 44 5: 51 52 53 54 Item 22 followed by item 32 occurs in row 2 and column 2 Item 32 followed by item 22 occurs in row -1 and column -1 Item 22 followed by item 23 occurs in row -1 and column -1 Item 54 followed by item 14 occurs in row 5 and column 4 Item 54 followed by item 11 occurs in row -1 and column -1 TEST0325 For the icosahedron, ICOS_SIZE returns dimension information; ICOS_SHAPE returns face and order information. SHAPE_PRINT_3D prints this information. Number of vertices = 12 Number of edges = 30 Number of faces = 20 Maximum face order = 3 SHAPE_PRINT_3D Information about a polytope. The number of vertices is 12 Vertices: Index X Y Z 1 0.85065081 0.52573111 0.00000000 2 0.85065081 -0.52573111 0.00000000 3 0.52573111 0.00000000 0.85065081 4 0.52573111 0.00000000 -0.85065081 5 0.00000000 0.85065081 0.52573111 6 0.00000000 0.85065081 -0.52573111 7 0.00000000 -0.85065081 0.52573111 8 0.00000000 -0.85065081 -0.52573111 9 -0.52573111 0.00000000 0.85065081 10 -0.52573111 0.00000000 -0.85065081 11 -0.85065081 0.52573111 0.00000000 12 -0.85065081 -0.52573111 0.00000000 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 line_exp_normal_2d_test line_exp_normal_2d() determines a unit normal vector to a given explicit line. Point 1: 1: 1.0000000 2: 3.0000000 Point 2: 1: 4.0000000 2: 0.0000000 Normal vector N: 1: 0.70710678 2: 0.70710678 TEST033 LINE_EXP_PERP_2D is given an explicit line (P1,P2), and another point P3. It then finds a point P4 on (P1,P2) so that (P1,P2) is perpendicular to (P3,P4). The explicit line: P1 = 1.0000 3.0000 P2 = 4.0000 0.0000 Point P3: 1: 0.0000000 2: 0.0000000 Point P4: 1: 2.0000000 2: 2.0000000 Point P3: 1: 5.0000000 2: -1.0000000 Point P4: 1: 5.0000000 2: -1.0000000 Point P3: 1: 5.0000000 2: 3.0000000 Point P4: 1: 3.0000000 2: 1.0000000 TEST0335 LINE_EXP_POINT_DIST_2D finds the distance from an explicit line to a point in 2D. The explicit line: P1 = 1.0000 3.0000 P2 = 4.0000 0.0000 Point: 1: 0.0000000 2: 0.0000000 Distance = 2.82843 Point: 1: 5.0000000 2: -1.0000000 Distance = 0.00000 Point: 1: 5.0000000 2: 3.0000000 Distance = 2.82843 TEST0336 LINE_EXP_POINT_DIST_3D finds the distance from an explicit line to a point in 3D. The explicit line: P1 = 1.0000 3.0000 P2 = 4.0000 0.0000 Point: 1: 0.0000000 2: 0.0000000 3: 2.0000000 Distance = 2.84697 Point: 1: 5.0000000 2: -1.0000000 3: 1.0000000 Distance = 0.324443 Point: 1: 5.0000000 2: 3.0000000 3: 3.0000000 Distance = 3.26061 TEST0337 LINE_EXP_POINT_DIST_SIGNED_2D finds the signed distance to a point from an explicit line. The explicit line: P1 = 1.0000 3.0000 P2 = 4.0000 0.0000 Point: 1: 0.0000000 2: 0.0000000 Signed distance = 2.82843 Point: 1: 5.0000000 2: -1.0000000 Signed distance = 0.00000 Point: 1: 5.0000000 2: 3.0000000 Signed distance = -2.82843 TEST034 LINE_EXP_POINT_NEAR_2D finds the point on a line nearest in point in 2D. The explicit line: P1 = 1.0000 3.0000 P2 = 4.0000 0.0000 The point P: 1: 0.0000000 2: 0.0000000 Nearest point PN: 1: 2.0000000 2: 2.0000000 Distance = 2.82843 Relative line position T = 0.333333 The point P: 1: 5.0000000 2: -1.0000000 Nearest point PN: 1: 5.0000000 2: -1.0000000 Distance = 0.00000 Relative line position T = 1.33333 The point P: 1: 5.0000000 2: 3.0000000 Nearest point PN: 1: 3.0000000 2: 1.0000000 Distance = 2.82843 Relative line position T = 0.666667 TEST0345 LINE_EXP2IMP_2D converts explicit to implicit lines. LINE_IMP2EXP_2D converts implicit to explicit lines. Implicit line A, B, C = 1.0000 2.0000 3.0000 The explicit line: P1 = -0.6000 -1.2000 P2 = -1.2000 -0.9000 Recovered implicit line A, B, C = 0.2381 0.4762 0.7143 TEST0346 LINE_EXP2PAR_2D converts explicit to parametric lines. LINE_PAR2EXP_2D converts parametric to explicit lines. Parametric line: F, G = 1.0000 2.0000 X0, Y0 = 3.0000 4.0000 The explicit line: P1 = 3.0000 4.0000 P2 = 4.0000 6.0000 Recovered parametric line: F, G = 0.4472 0.8944 X0, Y0 = 3.0000 4.0000 TEST035 LINE_IMP_POINT_DIST_2D finds the distance from a point P to a line A * X + B * Y + C = 0. X Y A B C DIST 0.0000 6.0000 2.0000 5.0000 3.0000 6.1279 0.0000 5.0000 2.0000 5.0000 3.0000 5.1995 0.0000 4.0000 2.0000 5.0000 3.0000 4.2710 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: F, G = 1.0000 -1.0000 X0, Y0 = 1.0000 3.0000 The point P: 1: 0.0000000 2: 0.0000000 Distance = 2.82843 Nearest point PN: 1: 2.0000000 2: 2.0000000 Distance recomputed = 2.82843 The point P: 1: 5.0000000 2: -1.0000000 Distance = 0.00000 Nearest point PN: 1: 5.0000000 2: -1.0000000 Distance recomputed = 0.00000 The point P: 1: 5.0000000 2: 3.0000000 Distance = 2.82843 Nearest point PN: 1: 3.0000000 2: 1.0000000 Distance recomputed = 2.82843 TEST0352 LINE_PAR_POINT_DIST_3D finds the distance from a parametric line to a point in 3D. Parametric line: X(t) = 1.00000 + 3.00000 * t Y(t) = 3.00000 + -3.00000 * t Z(t) = 2.00000 + -1.00000 * t The point P: 1: 0.0000000 2: 0.0000000 3: 2.0000000 Distance = 2.84697 Nearest point PN: 1: 1.9473684 2: 2.0526316 3: 1.6842105 Distance recomputed = 2.84697 The point P: 1: 5.0000000 2: -1.0000000 3: 1.0000000 Distance = 0.324443 Nearest point PN: 1: 4.9473684 2: -0.94736842 3: 0.68421053 Distance recomputed = 0.324443 The point P: 1: 5.0000000 2: 3.0000000 3: 3.0000000 Distance = 3.26061 Nearest point PN: 1: 2.7368421 2: 1.2631579 3: 1.4210526 Distance recomputed = 3.26061 TEST038 LINES_EXP_ANGLE_3D finds the angle between two explicit lines in 3D; Angle between lines is 1.89255 Angle between lines is -1.00000 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.00000 0.00000 0.00000 P2: 1.00000 2.00000 0.00000 Q1: 0.00000 3.00000 3.00000 Q2: 3.00000 0.00000 3.00000 LINES_EXP_DIST_3D = 3.00000 LINES_EXP_DIST_3D_2 = 3.00000 P1: 4.00000 -3.00000 0.00000 P2: -8.00000 6.00000 0.00000 Q1: 3.00000 4.00000 -1.00000 Q2: 3.00000 4.00000 3.00000 LINES_EXP_DIST_3D = 5.00000 LINES_EXP_DIST_3D_2 = 5.00000 TEST03855 LINES_EXP_NEAR_3D finds nearest points on two explicit lines in 3D. P1: 0.00000 0.00000 0.00000 P2: 1.00000 2.00000 0.00000 Q1: 0.00000 3.00000 3.00000 Q2: 3.00000 0.00000 3.00000 PN: 1.00000 2.00000 0.00000 QN: 1.00000 2.00000 3.00000 P1: 4.00000 -3.00000 0.00000 P2: -8.00000 6.00000 0.00000 Q1: 3.00000 4.00000 -1.00000 Q2: 3.00000 4.00000 3.00000 PN: 0.00000 0.00000 0.00000 QN: 3.00000 4.00000 0.00000 TEST0386 LINES_EXP_EQUAL_2D tries to determine if two explicit lines in 2D are equal. P1 0.00000 0.00000 P2 1.00000 2.00000 Q1 0.00000 0.00000 Q2 1.00000 2.00000 The lines are equal. P1 0.00000 0.00000 P2 1.00000 2.00000 Q1 1.00000 2.00000 Q2 0.00000 0.00000 The lines are equal. P1 0.00000 0.00000 P2 1.00000 2.00000 Q1 0.00000 0.00000 Q2 2.00000 4.00000 The lines are equal. P1 0.00000 0.00000 P2 1.00000 2.00000 Q1 7.00000 14.0000 Q2 5.50000 11.0000 The lines are equal. P1 0.00000 0.00000 P2 1.00000 2.00000 Q1 1.00000 2.00000 Q2 3.00000 5.00000 The lines are distinct. P1 0.00000 0.00000 P2 1.00000 2.00000 Q1 0.00000 10.0000 Q2 1.00000 12.0000 The lines are distinct. TEST039 LINES_EXP_INT_2D finds intersections of two explicit lines in 2D. P1 0.00000 0.00000 P2 4.00000 0.00000 Q1 0.00000 -1.00000 Q2 1.00000 0.00000 Intersection at 1.00000 0.00000 P1 0.00000 2.00000 P2 4.00000 0.00000 Q1 0.00000 0.250000 Q2 0.500000 0.00000 Lines are parallel, no intersection. P1 0.00000 2.00000 P2 4.00000 0.00000 Q1 0.00000 2.00000 Q2 4.00000 0.00000 Lines are coincident. TEST040 LINES_IMP_ANGLE_2D finds the angle between two lines written in implicit form. Line 1 coefficients: 1.00000 2.00000 -4.00000 Line 2 coefficients: 1.00000 -1.00000 -1.00000 Angle between lines is 108.435 Line 1 coefficients: 1.00000 2.00000 -4.00000 Line 2 coefficients: 2.00000 4.00000 -1.00000 Angle between lines is 0.120742E-05 Line 1 coefficients: 1.00000 2.00000 -4.00000 Line 2 coefficients: -3.00000 -6.00000 12.0000 Angle between lines is 180.000 TEST041 LINES_IMP_DIST_3D finds the distance between two implicit lines in 2D. A1 B1 C1 A2 B2 C2 DIST 4.0000 -1.0000 3.0000 4.0000 -1.0000 12.0000 2.1828 2.0000 -1.0000 0.0000 4.0000 -2.0000 6.0000 1.3416 1.0000 2.0000 2.0000 2.0000 3.0000 1.0000 0.0000 TEST0415 LINES_IMP_INT_2D finds the intersection of two lines written in implicit form. Line 1 coefficients: 1.00000 2.00000 -4.00000 Line 2 coefficients: 1.00000 -1.00000 -1.00000 Intersection at 2.00000 1.00000 Line 1 coefficients: 1.00000 2.00000 -4.00000 Line 2 coefficients: 2.00000 4.00000 -1.00000 Lines are parallel, no intersection. Line 1 coefficients: 1.00000 2.00000 -4.00000 Line 2 coefficients: -3.00000 -6.00000 12.0000 Lines are coincident. TEST0416 LINES_PAR_INT_2D finds the intersection of two lines written in parametric form. Line 1 parameters: 0.00000 1.00000 2.00000 1.00000 Line 2 parameters: 10.0000 -2.00000 1.00000 1.00000 Line 1 evaluated at T1: T1 = 13.0000 X(T1)= 26.0000 Y(T1)= 14.0000 Line 2 evaluated at T2: T2 = 16.0000 X(T2)= 26.0000 Y(T2)= 14.0000 Reported intersection PINT: 26.0000 14.0000 minabs_test 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.00000 2.00000 The points lie on a straight line. XMIN, YMIN = 7.00000 2.00000 The points lie on a straight line. XMIN, YMIN = 2.00000 5.00000 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.00000 5.00000 X2, Y2 = 2.00000 5.00000 X3, Y3 = 3.00000 8.00000 XMIN, YMIN = 1.00000 4.00000 The minimum is to the left of the interval X1, Y1 = 2.00000 5.00000 X2, Y2 = 4.00000 13.0000 X3, Y3 = 5.00000 20.0000 XMIN, YMIN = 2.00000 5.00000 The function is flat. X1, Y1 = 11.0000 6.00000 X2, Y2 = 6.00000 6.00000 X3, Y3 = 2.00000 6.00000 XMIN, YMIN = 11.0000 6.00000 The function has a maximum. X1, Y1 = 0.00000 3.00000 X2, Y2 = 2.00000 3.00000 X3, Y3 = 3.00000 0.00000 XMIN, YMIN = 3.00000 0.00000 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 vertices = 6 Number of edges = 12 Number of faces = 8 Maximum face order = 3 Face Order Area 1 3 0.8660 2 3 0.8660 3 3 0.8660 4 3 0.8660 5 3 0.8660 6 3 0.8660 7 3 0.8660 8 3 0.8660 Face Center 1 0.3333 -0.3333 -0.3333 2 0.3333 0.3333 -0.3333 3 -0.3333 0.3333 -0.3333 4 -0.3333 -0.3333 -0.3333 5 0.3333 -0.3333 0.3333 6 0.3333 0.3333 0.3333 7 -0.3333 0.3333 0.3333 8 -0.3333 -0.3333 0.3333 TEST0477 PARALLELOGRAM_AREA_2D finds the area of a parallelogram in 2D. Vertices: Row 1 2 Col 1: 2.00000 7.00000 2: 5.00000 7.00000 3: 6.00000 9.00000 4: 3.00000 9.00000 AREA = 6.00000 TEST0478 PARALLELOGRAM_AREA_3D finds the area of a parallelogram in 3D. Vertices: Row 1 2 3 Col 1: 1.00000 2.00000 3.00000 2: 2.41421 3.41421 3.00000 3: 1.70711 2.70711 4.00000 4: 0.292893 0.292893 4.00000 AREA = 2.00000 TEST048 PARALLELOGRAM_CONTAINS_POINT_2D determines if a point is within a parallelogram in 2D. Parallelogram defined by P2-P1, P3-P1: P1 = 0.00000 0.00000 P2 = 1.00000 0.00000 P3 = 1.00000 1.00000 P Inside? 1.00000 0.500000 T 2.00000 0.00000 F 0.500000 -0.100000 F 0.100000 0.500000 F 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. Parallelogram defined by P2-P1, P3-P1: P1 = 0.200000 0.00000 P2 = 0.400000 0.600000 P3 = 0.600000 0.400000 --------------------------------------------------- ---------------------------------------*----------- --------------------------------------**----------- -------------------------------------**------------ ------------------------------------***------------ -----------------------------------****------------ ----------------------------------****------------- ---------------------------------*****------------- --------------------------------******------------- -------------------------------******-------------- -------------------------------******-------------- -----------------------------********-------------- ----------------------------********--------------- ---------------------------*********--------------- --------------------------**********--------------- --------------------------**********--------------- -------------------------**********---------------- -----------------------************---------------- ----------------------************----------------- ----------------------************----------------- --------------------**************----------------- --------------------*************------------------ --------------------*************------------------ --------------------*************------------------ -------------------*************------------------- -------------------*************------------------- -------------------*************------------------- ------------------**************------------------- ------------------*************-------------------- -----------------**************-------------------- -----------------**************-------------------- -----------------*************--------------------- ----------------************----------------------- ----------------***********------------------------ ----------------**********------------------------- ----------------*********-------------------------- ---------------**********-------------------------- ---------------********---------------------------- --------------********----------------------------- --------------********----------------------------- --------------******------------------------------- -------------******-------------------------------- -------------******-------------------------------- -------------****---------------------------------- -------------***----------------------------------- ------------****----------------------------------- ------------**------------------------------------- ------------*-------------------------------------- -----------**-------------------------------------- -----------*--------------------------------------- ----------*---------------------------------------- TEST049 PARALLELOGRAM_CONTAINS_POINT_3D determines if a point is within a parallelogram in 3D. Parallelogram defined by P2-P1, P3-P1: P1 = 0.00000 0.00000 0.00000 P2 = 2.00000 2.00000 0.00000 P3 = 1.00000 1.00000 1.00000 P Inside? 1.00000 1.00000 0.500000 T 3.00000 3.00000 0.00000 F 0.500000 0.500000 -0.100000 F 0.100000 0.100000 0.500000 F 1.50000 1.60000 0.500000 F 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.00000 -4.00000 10.0000 X, Y data X1, Y1 = 1.00000 8.00000 X2, Y2 = 2.00000 10.0000 X3, Y3 = 3.00000 16.0000 PARABOLA_EX returns (XMIN,YMIN) = 1.00000 8.00000 PARABOLA_EX2 returns (XMIN,YMIN) = 1.00000 8.00000 and (A,B,C) = 2.00000 -4.00000 10.0000 TEST0495 PARALLELEPIPED_POINT_DIST_3D computes the distance from a point to a box (parallelipiped) in 3D. The 4 box corners that are specified: 0.00 0.00 0.00 2.00 0.00 0.00 0.00 8.00 0.00 0.00 0.00 1.00 Test P Distance to box 1 1.00 4.00 0.50 1.11803 2 1.00 0.00 0.50 0.00000 3 0.00 4.00 1.00 0.00000 4 2.00 8.00 1.00 0.00000 5 -0.50 4.00 0.50 0.707107 6 1.00 -1.00 -1.00 1.41421 7 3.00 9.00 2.00 1.73205 TEST050 PLANE_EXP_NORMAL_3D finds the normal to a plane. P1: -10.5600 -10.5600 78.0900 P2: 44.6600 -65.7700 0.00000 P3: 44.6600 44.6600 0.00000 The normal vector: 1: 0.81648657 2: 0.0000000 3: 0.57736443 PLANE_EXP2IMP_3D_TEST PLANE_EXP2IMP_3D puts a plane defined by 3 points into A*X+B*Y+C*Z+D = 0 form. Test 1: Correct answer is a multiple of 1, 2, 3, 4. Test 2: Correct answer is a multiple of 1, 2, 3, 0. P1: -1.00000 0.00000 -1.00000 P2: -4.00000 0.00000 0.00000 P3: -20.0000 2.00000 4.00000 (A,B,C,D)= -2.00000 -4.00000 -6.00000 -8.00000 P1: -16.0000 2.00000 4.00000 P2: 0.00000 0.00000 0.00000 P3: 4.00000 -2.00000 0.00000 (A,B,C,D)= -8.00000 -16.0000 -24.0000 0.00000 PLANE_EXP2NORMAL_3D_TEST PLANE_EXP2NORMAL_3D puts a plane defined by 3 points into point, normal form. P1: -1.00000 0.00000 -1.00000 P2: -4.00000 0.00000 0.00000 P3: -20.0000 2.00000 4.00000 The point PP: 1: -1.0000000 2: 0.0000000 3: -1.0000000 Normal vector: 1: -0.26726124 2: -0.53452248 3: -0.80178373 P1: -16.0000 2.00000 4.00000 P2: 0.00000 0.00000 0.00000 P3: 4.00000 -2.00000 0.00000 The point PP: 1: -16.000000 2: 2.0000000 3: 4.0000000 Normal vector: 1: -0.26726124 2: -0.53452248 3: -0.80178373 TEST053 PLANE_EXP_PROJECT_3D projects a point through a focus point into a plane. PO PP IVIS 0.000 2.000 2.000 0.000 0.5000 0.5000 -1 4.000 5.000 -8.000 4.000 5.000 -8.000 -1 0.2500 0.2500 0.2500 0.3333 0.3333 0.3333 -1 5.000 -2.000 -3.000 0.7648E+16 -0.3059E+16 -0.4589E+16 -1 -2.000 0.000 0.000 1.000 0.000 0.000 -1 TEST054 PLANE_IMP2EXP_3D converts a plane in implicit (A,B,C,D) form to explicit form. (A,B,C,D) = 1.00000 -2.00000 -3.00000 6.00000 P1: -6.00000 0.00000 0.00000 P2: -6.00000 -0.832050 0.554700 P3: -6.96362 -0.148250 -0.222375 TEST055 PLANE_IMP2NORMAL_3D converts a plane in implicit (A,B,C,D) form to point, normal form. Input: (A,B,C,D) = 1.00000 -2.00000 -3.00000 6.00000 The point PP: 1: -6.0000000 2: 0.0000000 3: 0.0000000 Normal vector: 1: 0.26726124 2: -0.53452248 3: -0.80178373 TEST056 PLANE_IMP_LINE_PAR_INT_3D finds the intersection of an implicit plane and a parametric line, in 3D. The plane and line intersect at 7.00000 2.00000 3.00000 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.00000 A nearest point on the line segment is 7.00000 2.00000 3.00000 A nearest point on the plane is 7.00000 2.00000 3.00000 The distance between the plane and the line segment is 4.00892 A nearest point on the line segment is 5.00000 1.00000 -2.00000 A nearest point on the plane is 3.92857 3.14286 1.21429 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.00000 0.00000 1.00000 -10.0000 (X,Y,Z) DISTANCE SIGNED_DISTANCE -12.0000 14.0000 0.00000 10.0000 -10.0000 7.00000 8.00000 9.00000 1.00000 -1.00000 1.00000 2.00000 10.0000 0.00000 0.00000 0.00000 0.00000 12.0000 2.00000 2.00000 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.00000 -2.00000 -3.00000 6.00000 Triangle vertices: Row 1 2 3 Col 1: 3.00000 0.00000 -7.00000 2: 13.0000 -4.00000 -1.00000 3: 5.00000 1.00000 -2.00000 Triangle to plane distance is 4.00892 Nearest points: Row 1 2 3 Col 1: 5.00000 1.00000 -2.00000 2: 3.92857 3.14286 1.21429 3: 5.00000 1.00000 -2.00000 4: 3.92857 3.14286 1.21429 Triangle vertices: Row 1 2 3 Col 1: 3.00000 0.00000 -7.00000 2: 13.0000 -4.00000 -1.00000 3: 9.00000 3.00000 8.00000 Triangle to plane distance is 0.00000 Nearest points: Row 1 2 3 Col 1: 10.3333 0.666667 5.00000 2: 7.00000 2.00000 3.00000 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.00000 -2.00000 -3.00000 6.00000 Case 1 Triangle vertices: Row 1 2 3 Col 1: 3.00000 0.00000 -7.00000 2: 13.0000 -4.00000 -1.00000 3: 5.00000 1.00000 -2.00000 Number of intersection points is 0 Intersection points: Row 1 2 3 Col Case 2 Triangle vertices: Row 1 2 3 Col 1: 3.00000 0.00000 -7.00000 2: 13.0000 -4.00000 -1.00000 3: 9.00000 3.00000 8.00000 Number of intersection points is 2 Intersection points: Row 1 2 3 Col 1: 7.00000 2.00000 3.00000 2: 10.3333 0.666667 5.00000 Case 3 Triangle vertices: Row 1 2 3 Col 1: -6.00000 0.00000 0.00000 2: 0.00000 3.00000 0.00000 3: 0.00000 0.00000 2.00000 Number of intersection points is 3 Intersection points: Row 1 2 3 Col 1: -6.00000 0.00000 0.00000 2: 0.00000 3.00000 0.00000 3: 0.00000 0.00000 2.00000 Case 4 Triangle vertices: Row 1 2 3 Col 1: -4.00000 1.00000 0.00000 2: 0.00000 6.00000 -2.00000 3: 0.00000 0.00000 1.00000 Number of intersection points is 2 Intersection points: Row 1 2 3 Col 1: -4.00000 1.00000 0.00000 2: 0.00000 6.00000 -2.00000 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. Point PP: 1: 0.64351657 2: 0.56401622 3: 0.93934192 Normal vector N: 1: 0.93336903 2: 0.88389063 3: 0.87586481 Vector PQ: 1: -0.68759963 2: 0.72609005 3: 0.0000000 Vector PR: 1: -0.40884398 2: -0.38717094 3: 0.82640502 Dot product matrix: Col 1 2 3 Row 1: 2.41958 0. 0.111022E-15 2: 0. 1.00000 0. 3: 0.111022E-15 0. 1. Dot product matrix: Col 1 2 3 Row 1: 0.182397 -0.138778E-16 0.780626E-17 2: -0.138778E-16 1. 0. 3: 0.780626E-17 0. 1. Dot product matrix: Col 1 2 3 Row 1: 0.145247 0. 0.208167E-16 2: 0. 1. -0.277556E-16 3: 0.208167E-16 -0.277556E-16 1.00000 Dot product matrix: Col 1 2 3 Row 1: 0.653665 0.277556E-16 0. 2: 0.277556E-16 1.00000 -0.693889E-17 3: 0. -0.693889E-17 1. Dot product matrix: Col 1 2 3 Row 1: 0.660047 0.277556E-16 0.277556E-16 2: 0.277556E-16 1.00000 -0.138778E-16 3: 0.277556E-16 -0.138778E-16 1.00000 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.0000000 2: 1.0000000 3: 1.0000000 Plane Normal: 1: 0.26726124 2: -0.53452248 3: -0.80178373 The explicit line: P1 = 3.0000 0.0000 P2 = 5.0000 1.0000 The plane and line intersect at 7.00000 2.00000 3.00000 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. QR1 Row 1 2 Col 1: 0.788187 0.629363E-01 2: 0.596769 0.406176 3: 0.756467 0.868136 4: 0.983815 0.279857 5: 0.532757 0.515225 XYZ Row 1 2 3 Col 1: -0.387350 0.418218 0.782524 2: -0.190606 0.864475E-01 0.707191 3: -0.217596 -0.360075 0.904167 4: -0.484372 0.208545 0.961268 5: -0.125864 -0.189570E-01 0.680972 QR2 Row 1 2 Col 1: 0.788187 0.629363E-01 2: 0.596769 0.406176 3: 0.756467 0.868136 4: 0.983815 0.279857 5: 0.532757 0.515225 Maximum difference was 0.314018E-15 TEST0617 PLANE_NORMAL_TETRAHEDRON_INTERSECT determines the intersection of a plane and tetrahedron. Plane normal vector number 1 0.00000 0.00000 1.00000 Point on plane: 0.00000 0.00000 0.00000 Number of intersection points = 3 1 0.00000 0.00000 0.00000 2 1.00000 0.00000 0.00000 3 0.00000 1.00000 0.00000 Point on plane: 0.00000 0.00000 0.200000 Number of intersection points = 3 1 0.00000 0.00000 0.200000 2 0.800000 0.00000 0.200000 3 0.00000 0.800000 0.200000 Point on plane: 0.00000 0.00000 0.400000 Number of intersection points = 3 1 0.00000 0.00000 0.400000 2 0.600000 0.00000 0.400000 3 0.00000 0.600000 0.400000 Point on plane: 0.00000 0.00000 0.600000 Number of intersection points = 3 1 0.00000 0.00000 0.600000 2 0.400000 0.00000 0.600000 3 0.00000 0.400000 0.600000 Point on plane: 0.00000 0.00000 0.800000 Number of intersection points = 3 1 0.00000 0.00000 0.800000 2 0.200000 0.00000 0.800000 3 0.00000 0.200000 0.800000 Point on plane: 0.00000 0.00000 1.00000 Number of intersection points = 1 1 0.00000 0.00000 1.00000 Point on plane: 0.00000 0.00000 1.20000 Number of intersection points = 0 Plane normal vector number 2 0.707107 0.707107 0.00000 Point on plane: 0.00000 0.00000 0.00000 Number of intersection points = 2 1 0.00000 0.00000 0.00000 2 0.00000 0.00000 1.00000 Point on plane: 0.141421 0.141421 0.00000 Number of intersection points = 4 1 0.282843 0.00000 0.00000 2 0.00000 0.282843 0.00000 3 0.00000 0.282843 0.717157 4 0.282843 0.00000 0.717157 Point on plane: 0.282843 0.282843 0.00000 Number of intersection points = 4 1 0.565685 0.00000 0.00000 2 0.00000 0.565685 0.00000 3 0.00000 0.565685 0.434315 4 0.565685 0.00000 0.434315 Point on plane: 0.424264 0.424264 0.00000 Number of intersection points = 4 1 0.848528 0.00000 0.00000 2 0.00000 0.848528 0.00000 3 0.00000 0.848528 0.151472 4 0.848528 0.00000 0.151472 Point on plane: 0.565685 0.565685 0.00000 Number of intersection points = 0 Point on plane: 0.707107 0.707107 0.00000 Number of intersection points = 0 Point on plane: 0.848528 0.848528 0.00000 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.0000000 2: 0.0000000 3: 2.0000000 The normal vector N: 1: 1.0000000 2: -2.0000000 3: -3.0000000 Triangle vertices: Row 1 2 3 Col 1: 3.00000 0.00000 -7.00000 2: 13.0000 -4.00000 -1.00000 3: 5.00000 1.00000 -2.00000 Number of intersection points is 0 Intersection points: Row 1 2 3 Col Triangle vertices: Row 1 2 3 Col 1: 3.00000 0.00000 -7.00000 2: 13.0000 -4.00000 -1.00000 3: 9.00000 3.00000 8.00000 Number of intersection points is 2 Intersection points: Row 1 2 3 Col 1: 7.00000 2.00000 3.00000 2: 10.3333 0.666667 5.00000 Triangle vertices: Row 1 2 3 Col 1: -6.00000 0.00000 0.00000 2: 0.00000 3.00000 0.00000 3: 0.00000 0.00000 2.00000 Number of intersection points is 3 Intersection points: Row 1 2 3 Col 1: -6.00000 0.00000 0.00000 2: 0.00000 3.00000 0.00000 3: 0.00000 0.00000 2.00000 Triangle vertices: Row 1 2 3 Col 1: -4.00000 1.00000 0.00000 2: 0.00000 6.00000 -2.00000 3: 0.00000 0.00000 1.00000 Number of intersection points is 2 Intersection points: Row 1 2 3 Col 1: -4.00000 1.00000 0.00000 2: 0.00000 6.00000 -2.00000 TEST063 PLANE_NORMAL2EXP_3D puts a plane defined by point, normal form into explicit form. The point PP: 1: -1.0000000 2: 0.0000000 3: -1.0000000 Normal vector: 1: -0.26726120 2: -0.53452250 3: -0.80178370 P1: -1.00000 0.00000 -1.00000 P2: -1.00000 -0.832050 -0.445300 P3: -1.96362 0.148250 -0.777625 TEST064 PLANE_NORMAL2IMP_3D puts a plane defined by point, normal form into implicit ABCD form. The point PP: 1: -1.0000000 2: 0.0000000 3: -1.0000000 Normal vector: 1: -0.26726120 2: -0.53452250 3: -0.80178370 Output: (A,B,C,D)= -0.267261 -0.534523 -0.801784 -1.06904 The point PP: 1: -16.000000 2: 2.0000000 3: 4.0000000 Normal vector: 1: -0.26726120 2: -0.53452250 3: -0.80178370 Output: (A,B,C,D)= -0.267261 -0.534523 -0.801784 0.600000E-06 points_centroid_2d_test points_centroid_2d() computes the centroid of a discrete set of points. The points: Row 1 2 Col 1: 7.00000 3.00000 2: 4.00000 7.00000 3: 5.00000 13.0000 4: 2.00000 7.00000 5: 6.00000 9.00000 6: 12.0000 8.00000 7: 3.00000 4.00000 8: 6.00000 6.00000 9: 3.00000 10.0000 10: 8.00000 7.00000 11: 5.00000 13.0000 12: 10.0000 6.00000 The centroid is point #: 5 TEST066 POINTS_COLIN_2D estimates the colinearity of three points. Points almost on a line: Expect tiny COLIN. P1: 0.00000 0.00000 P2: 10.0000 10.0000 P3: 5.00000 4.99000 Colinearity index = 0.129904E-02 Two points close, one far: Expect tiny COLIN. P1: 0.00000 0.00000 P2: 0.00000 1.00000 P3: 100.000 0.00000 Colinearity index = 0.257216E-01 Points on an equilateral triangle: Expect COLIN = 1. P1: 0.00000 0.00000 P2: 1.00000 0.00000 P3: 0.500000 0.866025 Colinearity index = 1.00000 points_hull_2d_test points_hull_2d() computes the convex hull of a set of N 2D points using an algorithm that is order NlogH. (H is the number of points on the convex hull.) Coordinates of the points: Row 1 2 Col 1: 0.00000 0.00000 2: 1.00000 2.00000 3: 2.00000 0.00000 4: 1.00000 1.00000 5: 0.00000 2.00000 6: 1.00000 3.00000 7: 2.00000 2.00000 Coordinates of the convex hull: Row 1 2 Col 1: 0.00000 0.00000 2: 2.00000 0.00000 3: 2.00000 2.00000 4: 1.00000 3.00000 5: 0.00000 2.00000 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.00000 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 TEST068 SPHERE_DISTANCE1, SPHERE_DISTANCE2 and SPHERE_DISTANCE3 measure the distance between two points on a sphere. All tests uses RADIUS = 3957.00 which is the radius of the earth in miles. Distance from Atlanta, Georgia to North Pole 3923.91 3923.91 3923.91 to South Pole 8507.37 8507.37 8507.37 to Timbuktu 4995.76 4995.76 4995.76 to San Antonio, Texas 974.430 974.430 974.430 to Savannah, Georgia 114.224 114.224 114.224 Distance from North Pole to South Pole 12431.3 12431.3 12431.3 to Timbuktu 5054.24 5054.24 5054.24 to San Antonio, Texas 4184.05 4184.05 4184.05 to Savannah, Georgia 3999.88 3999.88 3999.88 Distance from South Pole to Timbuktu 7377.05 7377.05 7377.05 to San Antonio, Texas 8247.23 8247.23 8247.23 to Savannah, Georgia 8431.40 8431.40 8431.40 Distance from Timbuktu to San Antonio, Texas 5969.44 5969.44 5969.44 to Savannah, Georgia 4922.94 4922.94 4922.94 Distance from San Antonio, Texas to Savannah, Georgia 1047.82 1047.82 1047.82 polar_to_xy_test polar_to_xy() converts (R,Theta) to (X,Y); X Y ===> R T => X Y 0.48360 0.25394 0.54622 0.48352 0.48360 0.25394 0.10248 0.19193 0.21758 1.08035 0.10248 0.19193 0.91233 -0.42492 1.00643 5.84731 0.91233 -0.42492 0.32980 0.13495 0.35634 0.38839 0.32980 0.13495 -0.42550 0.44171 0.61331 2.33750 -0.42550 0.44171 -0.95071 -0.70816 1.18547 3.78181 -0.95071 -0.70816 0.67660 0.95285 1.16864 0.95334 0.67660 0.95285 0.71395 -0.52674 0.88723 5.64754 0.71395 -0.52674 -0.31691 -0.60722 0.68494 4.23138 -0.31691 -0.60722 -0.92074 -0.53603 1.06541 3.66880 -0.92074 -0.53603 polygon_area_2d_test(): polygon_area_2d() computes the area. Number of polygonal vertices = 4 The polygon vertices: Row 1 2 Col 1: 1.00000 0.00000 2: 2.00000 1.00000 3: 1.00000 2.00000 4: 0.00000 1.00000 Exact area is 2.00000 The computed area is 2.00000 Number of polygonal vertices = 8 The polygon vertices: Row 1 2 Col 1: 0.00000 0.00000 2: 3.00000 0.00000 3: 3.00000 3.00000 4: 2.00000 3.00000 5: 2.00000 1.00000 6: 1.00000 1.00000 7: 1.00000 2.00000 8: 0.00000 2.00000 Exact area is 6.00000 The computed area is 6.00000 polygon_area_3d_test(): polygon_area_3d() computes the area of a polygon in 3D; The polygon vertices: Row 1 2 3 Col 1: 1.00000 0.00000 0.00000 2: 2.00000 1.00000 1.00000 3: 1.00000 2.00000 1.00000 4: 0.00000 1.00000 0.00000 Exact area is 2.44949 The computed area is 2.44949 The polygon vertices: Row 1 2 3 Col 1: 0.00000 0.00000 0.00000 2: 2.62679 1.26009 -0.715657 3: 1.48153 3.97300 -0.142512 4: 0.605932 3.55297 0.960401E-01 5: 1.36944 1.74437 -0.286056 6: 0.493842 1.32433 -0.475041E-01 7: 0.112090 2.22864 0.143544 8: -0.763505 1.80861 0.382097 Exact area is 6.00000 The computed area is 6.00000 polygon_centroid_3d_test(): polygon_centroid_3d() computes the centroid. The polygon vertices: Row 1 2 3 Col 1: 1.00000 0.00000 0.00000 2: 2.00000 1.00000 1.00000 3: 1.00000 2.00000 1.00000 4: 0.00000 1.00000 0.00000 The centroid: 1: 1.0000000 2: 1.0000000 3: 0.50000000 polygon_solid_angle_3d_test(): polygon_solid_angle_3d() computes the solid angle subtended by a planar polygon as viewed from a point P. TEST # 1 The viewing point P: 1: 0.0000000 2: 0.0000000 3: 0.0000000 The polygon vertices V: Row 1 2 3 Col 1: 1.00000 0.00000 0.00000 2: 0.00000 1.00000 0.00000 3: 0.00000 0.00000 1.00000 Solid angle subtended: -1.57080 TEST # 2 The viewing point P: 1: 0.0000000 2: 0.0000000 3: 0.0000000 The polygon vertices V: Row 1 2 3 Col 1: 1.00000 0.00000 0.00000 2: 0.00000 0.00000 1.00000 3: 0.00000 1.00000 0.00000 Solid angle subtended: 1.57080 TEST # 3 The viewing point P: 1: 1.0000000 2: 2.0000000 3: 3.0000000 The polygon vertices V: Row 1 2 3 Col 1: 2.00000 2.00000 3.00000 2: 1.00000 3.00000 3.00000 3: 1.00000 2.00000 4.00000 Solid angle subtended: -1.57080 TEST # 4 The viewing point P: 1: 0.0000000 2: 0.0000000 3: 0.0000000 The polygon vertices V: Row 1 2 3 Col 1: 2.00000 0.00000 0.00000 2: 0.00000 2.00000 0.00000 3: 0.00000 0.00000 2.00000 Solid angle subtended: -1.57080 polyhedron_area_3d_test polyhedron_area_3d() computes surface area of a polyhedron in 3D. 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.00000 0.00000 0.00000 2: 1.00000 0.00000 0.00000 3: 0.00000 1.00000 0.00000 4: 0.00000 0.00000 1.00000 Surface area = 2.36603 Exact area = 2.36603 POLYHEDRON_CENTROID_3D_TEST POLYHEDRON_CENTROID_3D computes the centroid of a polyhedron in 3D. 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.00000 0.00000 0.00000 2: 1.00000 0.00000 0.00000 3: 0.00000 1.00000 0.00000 4: 0.00000 0.00000 1.00000 Computed centroid: 1: 0.25000000 2: 0.25000000 3: 0.25000000 Exact centroid: 1: 0.25000000 2: 0.25000000 3: 0.25000000 polyhedron_contains_point_3d_test 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.00000 0.00000 0.00000 2: 1.00000 0.00000 0.00000 3: 0.00000 1.00000 0.00000 4: 0.00000 0.00000 1.00000 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 0.759218E-01 0.817099 0.498458 F F 0.553203 0.433973 0.115359 F F 0.350080E-01 0.546386 0.319943 T T 0.310728E-01 0.849555 0.212842 F F 0.303254 0.458532 0.585452 F F 0.609942E-03 0.882333 0.160438E-02 T T 0.288285 0.902848 0.163203 F F 0.472160 0.682262E-01 0.715326E-01 T T 0.347505 0.650934 0.779974 F F 0.733331 0.947806 0.864137E-01 F F 0.468523 0.238742E-01 0.244770 T T 0.952502 0.187670 0.154257 F F 0.775744 0.663925 0.516793 F F 0.481621 0.741548 0.283518 F F 0.833233 0.605228 0.563165 F F 0.315553 0.118637 0.555077 T T 0.926054 0.407453 0.263442 F F 0.384547 0.960018 0.970866 F F 0.477385E-01 0.691929 0.882701 F F 0.944373 0.189521 0.507112 F F 0.127064 0.550944 0.263341 T T 0.846577 0.303662 0.334779 F F 0.814688 0.731423 0.867526 F F 0.475848 0.301886 0.855083 F F 0.109133E-01 0.998404 0.975722 F F 0.119471 0.734943 0.901956 F F 0.844293E-01 0.492243 0.221331 T T 0.827408 0.951602 0.119469 F F 0.776601 0.579020 0.639489 F F 0.528068 0.935965 0.277144 F F 0.450332 0.664408 0.223861 F F 0.123493 0.723350E-01 0.483130E-01 T T 0.623599E-01 0.284445 0.947546 F F 0.499163 0.315923 0.719970 F F 0.384683 0.557157 0.638953 F F 0.901835 0.777656 0.270721 F F 0.847311 0.478690 0.339188E-01 F F 0.188665 0.129162 0.497163 T T 0.619034 0.839661 0.517323 F F 0.190096 0.634867 0.749343E-01 T T 0.389412 0.770779 0.305308 F F 0.609477 0.210929 0.377818 F F 0.666120 0.257336 0.228814 F F 0.148563 0.100672 0.126977 T T 0.355553 0.805742 0.988396 F F 0.811165 0.941903 0.440526 F F 0.326837 0.743486 0.572595 F F 0.490142 0.471250E-01 0.218695 T T 0.158018 0.121286 0.588433 T T 0.469087 0.839884 0.244317 F F 0.127136 0.661469 0.693222 F F 0.307997 0.119325E-01 0.520191 T T 0.613258 0.633086 0.227489 F F 0.826658E-02 0.709357 0.647620 F F 0.635963 0.950662E-01 0.232979 T T 0.884761 0.180461 0.753572 F F 0.285417 0.625804 0.462693 F F 0.320871 0.363762 0.756337 F F 0.934033 0.297321 0.427949E-01 F F 0.237851 0.333408 0.589348 F F 0.558098 0.311279 0.855216 F F 0.759868 0.730972 0.475025 F F 0.523387 0.125327 0.953765 F F 0.682260 0.539821 0.902934 F F 0.343662E-01 0.506975 0.922150 F F 0.972862 0.539749 0.744666 F F 0.900811 0.382707 0.944112 F F 0.651431 0.129746E-01 0.271981 T T 0.379608 0.213267 0.742644 F F 0.438981 0.434960 0.355253 F F 0.987542 0.532692 0.701457 F F 0.844169 0.328145 0.291301 F F 0.341581 0.596075 0.335146 F F 0.138510 0.611241 0.761884 F F 0.805991E-01 0.882071 0.102865 F F 0.730132 0.368447 0.355636 F F 0.738860 0.608952 0.760495 F F 0.249940 0.493003 0.669313 F F 0.486850 0.648044 0.104867 F F 0.155342 0.733800 0.650427E-01 T T 0.878390 0.260452 0.617667 F F 0.343838 0.943973 0.808467 F F 0.823985 0.470614 0.148325 F F 0.613280 0.913578 0.359571 F F 0.968730 0.241663 0.837890E-01 F F 0.815883 0.249676 0.793646 F F 0.206841 0.316457 0.820933 F F 0.342400 0.489269E-01 0.695518E-01 T T 0.258380 0.386621 0.141764 T T 0.437854 0.611148E-01 0.143866 T T 0.292455 0.486630 0.523561 F F 0.506505 0.254385 0.442349E-01 T T 0.278946E-01 0.473565 0.487017 T T 0.732824 0.450584 0.643682 F F 0.225182 0.271085 0.773510E-01 T T 0.629141 0.180677 0.248391 F F 0.283012 0.722247 0.510762 F F 0.825452 0.864063 0.302631 F F 0.446659E-01 0.486081 0.656465 F F 0.545419 0.685643 0.318384 F F 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.00000 0.00000 0.00000 2: 1.00000 0.00000 0.00000 3: 0.00000 1.00000 0.00000 4: 0.00000 0.00000 1.00000 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.00000 0.00000 0.00000 1.00000 1.00000 1.41421 2.00000 0.00000 2.82843 0.00000 0.00000 4.82843 We search for the point with coordinate 2.00000 The computed point: 1: 1.4142136 2: 0.58578644 polyline_points_nd_test polyline_points_nd() computes points on a polyline. The defining points: Row 1 2 Col 1: 0.00000 1.00000 2: 0.00000 0.00000 3: 1.00000 0.00000 4: 1.00000 2.00000 The computed points: Row 1 2 Col 1: 0.00000 1.00000 2: 0.00000 0.666667 3: 0.00000 0.333333 4: 0.00000 0.00000 5: 0.333333 0.00000 6: 0.666667 0.00000 7: 1.00000 0.00000 8: 1.00000 0.333333 9: 1.00000 0.666667 10: 1.00000 1.00000 11: 1.00000 1.33333 12: 1.00000 1.66667 13: 1.00000 2.00000 polyloop_arclength_nd_test polyloop_arclength_nd() computes the arclength of the nodes of a polyloop. P Arclength(P) 0.00000 0.00000 0.00000 1.00000 1.00000 1.41421 2.00000 0.00000 2.82843 0.00000 0.00000 4.82843 0.00000 0.00000 4.82843 polyloop_points_nd_test polyloop_points_nd() computes points on a polyloop. The defining points: Row 1 2 Col 1: 0.00000 2.00000 2: 0.00000 0.00000 3: 1.00000 0.00000 4: 1.00000 2.00000 The computed points: Row 1 2 Col 1: 0.00000 2.00000 2: 0.00000 1.45455 3: 0.00000 0.909091 4: 0.00000 0.363636 5: 0.181818 0.00000 6: 0.727273 0.00000 7: 1.00000 0.272727 8: 1.00000 0.818182 9: 1.00000 1.36364 10: 1.00000 1.90909 11: 0.545455 2.00000 12: 0.00000 2.00000 TEST085 PLANE_EXP_PRO3 projects an object point orthographically into a plane. PO PP 0.000 2.000 2.000 -1.000 1.000 1.000 4.000 5.000 -8.000 4.000 5.000 -8.000 0.2500 0.2500 0.2500 0.3333 0.3333 0.3333 5.000 -2.000 -3.000 5.333 -1.667 -2.667 -2.000 0.000 0.000 -1.000 1.000 1.000 TEST170 PROVEC projects a vector onto a subspace. Base vectors Row 1 2 3 4 Col 1: 4.00000 3.00000 2.00000 1.00000 2: 1.00000 2.00000 3.00000 4.00000 Vector to be projected: 1: 1.0000000 2: 1.0000000 3: 1.0000000 4: 2.0000000 Projected vector in BASE coordinates: 1: 2.0083160 2: 1.6329932 Projected vector in original coordinates: 1: 0.80000000 2: 1.1000000 3: 1.4000000 4: 1.7000000 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.00000 0.00000 2: 1.00000 0.00000 3: 1.00000 1.00000 4: 0.00000 1.00000 QUAD_AREA_2D area is 1.00000 QUAD_AREA2_2D area is 1.00000 TEST1712 For a quadrilateral in 3D: QUAD_AREA_3D finds the area. The vertices: Row 1 2 3 Col 1: 2.00000 2.00000 0.00000 2: 0.00000 0.00000 0.00000 3: 1.00000 1.00000 1.00000 4: 3.00000 3.00000 1.00000 QUAD_AREA_3D area is 2.82843 Sum of TRIANGLE_AREA_3D: 2.82843 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.00000 0.00000 2: 1.00000 0.00000 3: 1.00000 1.00000 4: 0.00000 1.00000 P Contains Dist Dist Signed Unsigned 0.250000 0.250000 T -0.2500 0.2500 0.750000 0.250000 T -0.2500 0.2500 1.00000 1.00000 T 0.0000 0.0000 11.0000 0.500000 F 10.0000 10.0000 0.00000 0.500000 T 0.0000 0.0000 0.500000 -10.0000 F 10.0000 10.0000 2.00000 2.00000 F 1.0000 1.4142 R8_ACOS_TEST R8_ACOS computes an angle with a given cosine; X R8_ACOS(X) (Degrees) 5.000 0.000 0.000 1.200 0.000 0.000 1.000 0.000 0.000 0.9000 0.4510 25.84 0.5000 1.047 60.00 0.000 1.571 90.00 -0.9000 2.691 154.2 -1.000 3.142 180.0 -1.010 3.142 180.0 r8_asin_test R8_ASIN computes an angle with a given sine; X R8_ASIN(X) (Degrees) 5.000 1.571 90.00 1.200 1.571 90.00 1.000 1.571 90.00 0.9000 1.120 64.16 0.5000 0.5236 30.00 0.000 0.000 0.000 -0.9000 -1.120 -64.16 -1.000 -1.571 -90.00 -1.010 -1.571 -90.00 R8_ATAN_TEST R8_ATAN computes an angle with a given tangent. X Y ATAN(Y/X) ATAN2(Y,X) R8_ATAN(Y,X) 1.000 0.000 0.000 0.000 0.000 1.000 1.000 0.7854 0.7854 0.7854 1.000 2.000 1.107 1.107 1.107 1.000 0.000 0.000 0.000 0.000 1.000 -1.000 -0.7854 -0.7854 5.498 -1.000 -1.000 0.7854 -2.356 3.927 -1.000 -1.000 0.7854 -2.356 3.927 0.000 -1.000 0.1798+309 -1.571 4.712 Repeat, but display answers in degrees. 1.000 0.000 0.000 0.000 0.000 1.000 1.000 45.00 45.00 45.00 1.000 2.000 63.43 63.43 63.43 1.000 0.000 0.000 0.000 0.000 1.000 -1.000 -45.00 -45.00 315.0 -1.000 -1.000 45.00 -135.0 225.0 -1.000 -1.000 45.00 -135.0 225.0 0.000 -1.000 0.1798+309 -90.00 270.0 r8mat_inverse_3d_test r8mat_inverse_3d() inverts a 3 by 3 matrix. Matrix A: Col 1 2 3 Row 1: 3. 2. 1. 2: 2. 2. 1. 3: 0. 1. 1. Determinant of A is 1.00000 Inverse matrix B: Col 1 2 3 Row 1: 1. -1. 0. 2: -2. 3. -1. 3: 2. -3. 2. 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.00000 1.00000 2.00000 0.00000 3.00000 2.00000 r8mat_solve_2d_test r8mat_solve_2d() solves 2D linear systems. Solution / Computed: 0.931041E-01 0.931041E-01 0.205390 0.205390 Solution / Computed: 0.174217 0.174217 0.198111 0.198111 Solution / Computed: 0.832571 0.832571 0.777350 0.777350 Solution / Computed: 0.274038 0.274038 0.608498 0.608498 Solution / Computed: 0.398489 0.398489 0.940230 0.940230 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.659875 1.000000 -0.000000 2 1.793211 1.000000 0.000000 3 1.639788 1.000000 0.000000 4 1.844136 1.000000 0.000000 5 1.599269 1.000000 0.000000 r8vec_uniform_unit_test R8VEC_UNIFORM_UNIT picks a random direction vector. 0.3039 -0.8618 -0.0206 -0.4055 -0.5523 0.0240 0.6573 0.5121 -0.5267 0.4115 -0.0675 -0.7407 -0.6930 -0.4432 -0.5222 -0.2249 0.3307 0.7781 -0.3500 0.4034 -0.2167 0.4695 -0.4931 -0.6996 -0.4921 0.2869 0.4687 0.6751 0.3028 -0.1546 0.4274 0.8377 0.2461 0.5158 0.7049 -0.4200 0.5665 0.4911 -0.0514 -0.6598 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.0000 0.0000 6.0000 0.0000 1.5708 90.0000 0.0000 0.0000 0.0000 90.0000 1.5708 90.0000 0.0000 0.0000 3.0000 35.2644 0.9553 54.7356 0.0000 0.0000 22.5466 -10.5197 0.4205 24.0948 0.0000 0.0000 15.0000 -35.2644 2.1863 125.2644 6.0000 0.0000 0.0000 90.0000 1.5708 90.0000 6.0000 0.0000 3.0000 35.2644 0.9553 54.7356 6.0000 0.0000 22.5466 -10.5197 1.9446 111.4167 6.0000 0.0000 15.0000 -35.2644 2.1863 125.2644 0.0000 90.0000 3.0000 35.2644 0.9553 54.7356 0.0000 90.0000 22.5466 -10.5197 1.7544 100.5197 0.0000 90.0000 15.0000 -35.2644 2.1863 125.2644 3.0000 35.2644 22.5466 -10.5197 1.3584 77.8297 3.0000 35.2644 15.0000 -35.2644 3.1416 180.0000 22.5466 -10.5197 15.0000 -35.2644 1.7832 102.1703 radec_to_xyz_test radec_to_xyz() converts RADEC to XYZ coordinates. P1 RA DEC P2 1.000 0.000 0.000 0.000 0.000 1.000 0.000 0.000 0.000 1.000 0.000 6.000 0.000 0.000 1.000 0.000 0.000 0.000 1.000 0.000 90.000 0.000 0.000 1.000 1.000 1.000 1.000 3.000 35.264 0.577 0.577 0.577 5.000 -2.000 -1.000 22.547-10.520 0.913 -0.365 -0.183 -2.000 -2.000 -2.000 15.000-35.264 -0.577 -0.577 -0.577 radians_to_degrees_test 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 radians_to_dms_test radians_to_dms() 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 TEST1787 R8GE_FA factors a general linear system, R8GE_SL solves a factored system. Matrix order N = 5 Matrix A. Col 1 2 3 4 5 Row 1: 0.352959 0.905519 0.370264 0.160179 0.341624E-01 2: 0.924503 0.714898 0.822381 0.310719 0.807504E-01 3: 0.934458 0.654289 0.480308 0.109935 0.824213 4: 0.747349 0.566187E-01 0.504982 0.172054 0.441476 5: 0.977507 0.565726 0.888300 0.237763 0.701499 Factored ALU matrix. Col 1 2 3 4 5 Row 1: 0.977507 0.565726 0.888300 0.237763 0.701499 2: -0.945777 0.701247 0.495159E-01 0.743276E-01 -0.219136 3: -0.955961 -0.161822 -0.376885 -0.129385 0.189068 4: -0.764546 0.536052 -0.391686 0.807953E-01 -0.286376 5: -0.361081 -0.256468 -0.808007E-01 -0.955993 -0.268014 Solution: (Should be 1, 2, 3,...) 1: 1.0000000 2: 2.0000000 3: 3.0000000 4: 4.0000000 5: 5.0000000 Solution: (Should be 1, 1, 1,...) 1: 1.0000000 2: 1.0000000 3: 1.0000000 4: 1.0000000 5: 1.0000000 Solution of transposed system: (Should be 1, 2, 3,...) 1: 1.0000000 2: 2.0000000 3: 3.0000000 4: 4.0000000 5: 5.0000000 rtp_to_xyz_test rtp_to_xyz() converts XYZ to (R,Theta,Phi) coordinates. X1 Y1 Z1 R THETA PHI X2 Y2 Z2 -1.530 -0.564 0.167 1.639 3.495 1.468 -1.530 -0.564 0.167 -1.259 0.619 -1.378 1.967 2.685 2.347 -1.259 0.619 -1.378 -0.328 -1.225 2.590 2.884 4.451 0.455 -0.328 -1.225 2.590 0.899 0.175 1.442 1.708 0.192 0.566 0.899 0.175 1.442 2.008 -0.987 0.201 2.246 5.826 1.481 2.008 -0.987 0.201 segment_contains_point_1d_test segment_contains_point_1d() determines if a point lies within a line segment in 1D. P1 P T 2.00 6.00 3.00 0.250000 10.00 -10.00 7.50 0.125000 8.00 10.00 20.00 6.00000 88.00 88.00 5.00 -0.179769+309 segment_point_coords_2d_test segment_point_coords_2d() computes coordinates (S,T) for a point relative to a line segment in 2D. P1 = 3.0000 1.0000 P2 = 7.0000 1.0000 P1 S T ----------------- ------ ------ 3.0000 1.0000 0.0000 0.0000 Computed 0.0000 0.0000 Expected 4.0000 1.0000 0.0000 0.2500 Computed 0.0000 0.2500 Expected 100.0000 1.0000 0.0000 24.2500 Computed 0.0000 24.2500 Expected 5.0000 100.0000 99.0000 0.5000 Computed 99.0000 0.5000 Expected 7.0000 -1.0000 2.0000 1.0000 Computed 2.0000 1.0000 Expected 0.0000 5.0000 4.0000 -0.7500 Computed 4.0000 -0.7500 Expected segment_point_dist_2d_test segment_point_dist_2d() computes the distance between a line segment and point in 2D. TEST = 1 P1 = 0.0492 0.1344 P2 = 0.3854 0.9437 P = 0.9439 0.8214 DIST = 0.5717 TEST = 2 P1 = 0.8454 0.5757 P2 = 0.3744 0.4067 P = 0.3872 0.3502 DIST = 0.0579 TEST = 3 P1 = 0.8617 0.7475 P2 = 0.7206 0.8588 P = 0.5417 0.2192 DIST = 0.6176 segment_point_dist_3d_test segment_point_dist_3d() computes the distance between a line segment and point in 3D. TEST = 1 P1 = 0.0882 0.8662 0.9020 P2 = 0.9941 0.2855 0.3792 P = 0.0592 0.2659 0.2870 DIST = 0.6706 TEST = 2 P1 = 0.6423 0.1262 0.2509 P2 = 0.6177 0.5863 0.1441 P = 0.4518 0.4012 0.9071 DIST = 0.7251 TEST = 3 P1 = 0.8267 0.1758 0.8796 P2 = 0.6130 0.0802 0.7750 P = 0.6373 0.2168 0.7636 DIST = 0.1223 segment_point_near_2d_test segment_point_near_2d() computes the nearest point on a line segment to a point in 2D. TEST = 1 P1 = 0.0506 0.0373 P2 = 0.0387 0.7494 P = 0.7860 0.0242 PN = 0.0506 0.0373 DIST = 0.7355 T = 0.0000 TEST = 2 P1 = 0.7927 0.1725 P2 = 0.9496 0.0927 P = 0.3986 0.7478 PN = 0.7927 0.1725 DIST = 0.6974 T = 0.0000 TEST = 3 P1 = 0.9020 0.9868 P2 = 0.4241 0.9111 P = 0.2562 0.4407 PN = 0.4241 0.9111 DIST = 0.4995 T = 1.0000 segment_point_near_3d_test segment_point_near_3d() computes the nearest point on a line segment, to a given point, in 3D. Test T Distance PN. 1 1.0000 5.0000 8.0000 6.0000 0.0000 2 0.3333 1.0000 4.0000 4.0000 0.0000 3 0.6667 0.0000 6.0000 5.0000 0.0000 segments_curvature_2d_test segments_curvature_2d() computes the local curvature defined by the line segments [P1,P2] and [P2,P3]. Our three points are: P1 = (0,0) P2 = (1,0) P3 = (C,S) C = cosine ( theta), S = sine ( theta ). Test Theta Curvature 1 0. 2.00000 2 30. 1.93185 3 60. 1.73205 4 90. 1.41421 5 120. 1.00000 6 150. 0.517638 7 180. 0.122465E-15 8 210. 0.517638 9 240. 1.00000 10 270. 1.41421 11 300. 1.73205 12 330. 1.93185 13 360. 2.00000 segments_dist_2d_test segments_dist_2d() computes the distance between line segments in 2D. Same slope, different intercepts. P1 = 2.00000 3.00000 P2 = 8.00000 6.00000 Q1 = 8.00000 3.00000 Q2 = 14.0000 6.00000 Distance([P1,P2],[Q1,Q2]) = 2.68328 Same slope, same intercepts, overlapping. Distance should be 0. P1 = 2.00000 3.00000 P2 = 8.00000 6.00000 Q1 = 4.00000 4.00000 Q2 = 14.0000 9.00000 Distance([P1,P2],[Q1,Q2]) = 0.00000 Same slope, same intercepts, disjoint. Distance should be sqrt(45)=6.7082038 P1 = 2.00000 3.00000 P2 = 8.00000 6.00000 Q1 = 14.0000 9.00000 Q2 = 16.0000 10.0000 Distance([P1,P2],[Q1,Q2]) = 6.70820 Different slopes, intersecting. Distance should be 0. P1 = 2.00000 3.00000 P2 = 8.00000 6.00000 Q1 = 0.00000 8.00000 Q2 = 5.00000 3.00000 Distance([P1,P2],[Q1,Q2]) = 0.00000 Different slopes, not intersecting. P1 = 2.00000 3.00000 P2 = 8.00000 6.00000 Q1 = 7.00000 3.00000 Q2 = 9.00000 -1.00000 Distance([P1,P2],[Q1,Q2]) = 2.23607 Simple problem. Distance should be 0 P1 = 57.0000 53.0000 P2 = 58.0000 53.0000 Q1 = 65.0000 45.0000 Q2 = 57.0000 53.0000 Distance([P1,P2],[Q1,Q2]) = 0.00000 Same data, translated by 50. Distance should be 0 P1 = 7.00000 3.00000 P2 = 8.00000 3.00000 Q1 = 15.0000 -5.00000 Q2 = 7.00000 3.00000 Distance([P1,P2],[Q1,Q2]) = 0.00000 Diagonal and horizontal. Distance should be sqrt(2500/2)=35.355339 P1 = 0.00000 0.00000 P2 = 100.000 100.000 Q1 = 50.0000 0.00000 Q2 = 60.0000 0.00000 Distance([P1,P2],[Q1,Q2]) = 35.3553 Same data, except first segment extended. Distance should be sqrt(2500/2)=35.355339 P1 = -10.0000 -10.0000 P2 = 100.000 100.000 Q1 = 50.0000 0.00000 Q2 = 60.0000 0.00000 Distance([P1,P2],[Q1,Q2]) = 35.3553 segments_dist_3d_test segments_dist_3d() computes the distance between line segments in 3D. Case Computed True 1 5.00000 5.00000 2 0.00000 0.00000 3 3.00000 3.00000 4 0.00000 0.00000 5 1.00000 1.00000 6 3.00000 3.00000 7 1.00000 1.00000 8 10.0000 10.0000 9 4.00000 4.00000 segments_int_1d_test 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.0000 1.0000 -1.0000 1.0000 -1.0000 1.0000 -2.0000 2 -1.0000 1.0000 3.0000 2.0000 2.0000 1.0000 1.0000 3 -1.0000 1.0000 1.0000 2.0000 1.0000 1.0000 0.0000 4 -1.0000 1.0000 0.5000 -3.0000 -1.0000 0.5000 -1.5000 5 -1.0000 1.0000 0.2500 0.5000 0.2500 0.5000 -0.2500 6 -1.0000 1.0000 0.5000 0.5000 0.5000 0.5000 0.0000 7 -1.0000 1.0000 2.0000 2.0000 2.0000 1.0000 1.0000 segments_int_2d_test segments_int_2d() searches for an intersection of two line segments in 2D. All tests use the same line segment 1: P1 = -1.00000 3.00000 P2 = 1.00000 1.00000 Q1 = -1.00000 1.00000 Q2 = 1.00000 -1.00000 The line segments do not intersect. Q1 = 3.00000 -1.00000 Q2 = 2.00000 0.00000 The line segments do not intersect. Q1 = 0.00000 0.00000 Q2 = 0.00000 9.00000 The line segments intersect at: -0.00000 2.00000 Q1 = 1.00000 2.00000 Q2 = 3.00000 2.00000 The line segments do not intersect. 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. simplex_lattice_point_next_test 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 vertices = 60 Number of edges = 90 Number of faces = 32 Maximum face order = 6 Face Order Area 1 6 0.4411 2 6 0.4411 3 5 0.2921 4 6 0.4411 5 5 0.2921 6 6 0.4411 7 5 0.2921 8 6 0.4411 9 6 0.4411 10 6 0.4411 11 5 0.2921 12 6 0.4411 13 5 0.2921 14 6 0.4411 15 5 0.2921 16 6 0.4411 17 6 0.4411 18 6 0.4411 19 5 0.2921 20 6 0.4411 21 5 0.2921 22 5 0.2921 23 6 0.4411 24 6 0.4411 25 6 0.4411 26 5 0.2921 27 6 0.4411 28 5 0.2921 29 6 0.4411 30 6 0.4411 31 5 0.2921 32 6 0.4411 Face Center 1 0.1761 0.3333 0.8547 2 -0.3746 -0.0424 0.8547 3 0.1856 -0.2719 0.9007 4 0.6819 -0.0424 0.6371 5 -0.3711 0.5438 0.6972 6 -0.2091 -0.6505 0.6371 7 0.6165 0.5438 0.4938 8 0.4439 -0.6505 0.5026 9 -0.8046 0.2222 0.4194 10 0.0864 0.8302 0.4194 11 -0.7311 -0.3758 0.4938 12 0.9049 0.2222 0.0673 13 0.8668 -0.3758 0.1646 14 -0.5197 0.7616 0.1504 15 0.0339 -0.9441 0.1646 16 -0.5368 -0.7616 0.0673 17 0.5368 0.7616 -0.0673 18 0.5197 -0.7616 -0.1504 19 -0.8668 0.3758 -0.1646 20 -0.9049 -0.2222 -0.0673 21 -0.0339 0.9441 -0.1646 22 0.7311 0.3758 -0.4938 23 0.8046 -0.2222 -0.4194 24 -0.4439 0.6505 -0.5026 25 -0.0864 -0.8302 -0.4194 26 -0.6165 -0.5438 -0.4938 27 0.2091 0.6505 -0.6371 28 0.3711 -0.5438 -0.6972 29 -0.6819 0.0424 -0.6371 30 0.3746 0.0424 -0.8547 31 -0.1856 0.2719 -0.9007 32 -0.1761 -0.3333 -0.8547 TEST180 SORT_HEAP_EXTERNAL sorts objects externally. Unsorted array 1: 19 2: 11 3: 7 4: 19 5: 10 6: 14 7: 18 8: 14 9: 14 10: 9 11: 18 12: 6 13: 13 14: 13 15: 15 16: 11 17: 7 18: 2 19: 16 20: 1 Sorted array 1: 1 2: 2 3: 6 4: 7 5: 7 6: 9 7: 10 8: 11 9: 11 10: 13 11: 13 12: 14 13: 14 14: 14 15: 15 16: 16 17: 18 18: 18 19: 19 20: 19 TEST1804 For an N-dimensional unit simplex 0 <= X(1:N), sum X(1:N) <= T where T is an integer, SIMPLEX01_LATTICE_POINT_NUM_ND computes the lattice volume, that is, the number of lattice points it contains. N T Volume 2 1 3 2 2 6 2 3 10 2 4 15 3 1 4 3 2 10 3 3 20 3 10 286 4 3 35 5 3 56 6 3 84 TEST1805 For an N-dimensional simplex, SIMPLEX_VOLUME_ND computes the volume. Here, we check the routine by comparing it with TETRAHEDRON_VOLUME_3D. Simplex vertices: Row 1 2 3 Col 1: 0.00000 0.942809 -0.333333 2: -0.816496 -0.816496 -0.333333 3: 0.816496 -0.816496 -0.333333 4: 0.00000 0.00000 1.00000 Volume computed by TETRAHEDRON_VOLUME_3D: 0.638429 Volume computed by SIMPLEX_VOLUME_ND: 0.638429 sphere_cap_volume_2d_test SPHERE_CAP_VOLUME_2D computes the volume (area) of a spherical cap, defined by a plane that cuts the sphere to a thickness of H units. SPHERE_CAP_VOLUME_ND does the same operation, but in N dimensions. The two routines should get the same results if THETA1, THETA2 and H correspond. Using a radius R = 1.00000 Theta1 Theta2 H Cap Cap vol_2d vol_nd -0.000000 0.000000 0.000000 0.000000 0.000000 -0.585686 0.585686 0.166667 0.125043 0.125043 -0.841069 0.841069 0.333333 0.344165 0.344165 -1.047198 1.047198 0.500000 0.614185 0.614185 -1.230959 1.230959 0.666667 0.916690 0.916690 -1.403348 1.403348 0.833333 1.239013 1.239013 -1.570796 1.570796 1.000000 1.570796 1.570796 -1.738244 1.738244 1.166667 1.902580 1.902580 -1.910633 1.910633 1.333333 2.224903 2.224903 -2.094395 2.094395 1.500000 2.527408 2.527408 -2.300524 2.300524 1.666667 2.797428 2.797428 -2.555907 2.555907 1.833333 3.016549 3.016549 -3.141593 3.141593 2.000000 3.141593 3.141593 sphere_dia2imp_3d_test sphere_dia2imp_3d() converts a sphere from diameter to implicit form. Point P1: 1: -1.0000000 2: -1.0000000 3: 4.0000000 Point P2: 1: 5.0000000 2: 7.0000000 3: 4.0000000 Radius: 5.00000 The center: 1: 2.0000000 2: 3.0000000 3: 4.0000000 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 T 1.00000 2.00000 3.00000 F 7.00000 2.00000 3.00000 T 1.00000 5.00000 3.00000 T 2.50000 3.50000 4.50000 SPHERE_IMP_CONTAINS_POINT_3D: Inside, P T 1.00000 2.00000 3.00000 F 7.00000 2.00000 3.00000 T 1.00000 5.00000 3.00000 T 2.50000 3.50000 4.50000 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.00000 Sphere center: 1: 1.0000000 2: 2.0000000 3: 3.0000000 SPHERE_EXP_POINT_NEAR_3D: P PN 1.0000 2.0000 3.0000 2.7321 3.7321 4.7321 7.0000 2.0000 3.0000 4.0000 2.0000 3.0000 1.0000 5.0000 3.0000 1.0000 5.0000 3.0000 2.5000 3.5000 4.5000 2.7321 3.7321 4.7321 SPHERE_IMP_POINT_NEAR_3D: P PN 1.0000 2.0000 3.0000 2.7321 3.7321 4.7321 7.0000 2.0000 3.0000 4.0000 2.0000 3.0000 1.0000 5.0000 3.0000 1.0000 5.0000 3.0000 2.5000 3.5000 4.5000 2.7321 3.7321 4.7321 TEST1835 SPHERE_EXP2IMP_3D: explicit sphere => implicit form; SPHERE_IMP2EXP_3D: implicit sphere => explicit form. Initial form of explicit sphere: 4.00000 2.00000 3.00000 1.00000 5.00000 3.00000 1.00000 2.00000 6.00000 -2.00000 2.00000 3.00000 Computed form of implicit sphere: Imputed radius = 3.00000 Imputed center 1: 1.0000000 2: 2.0000000 3: 3.0000000 Computed form of explicit sphere: 1.00000 2.00000 6.00000 3.59808 2.00000 1.50000 -0.299038 4.25000 1.50000 -0.299038 -0.250000 1.50000 sphere_exp2imp_nd_test sphere_exp2imp_nd(): explicit sphere => implicit form; Initial form of explicit sphere: Row 1 2 3 Col 1: 4.00000 2.00000 3.00000 2: 1.00000 5.00000 3.00000 3: 1.00000 2.00000 6.00000 4: -2.00000 2.00000 3.00000 Computed form of implicit sphere: Imputed radius = 3.00000 True radius = 3.00000 Imputed center 1: 1.0000000 2: 2.0000000 3: 3.0000000 True center 1: 1.0000000 2: 2.0000000 3: 3.0000000 sphere_imp_point_project_3d_test sphere_imp_point_project_3d() projects a 3D point onto a sphere. P1 projection P2 2.000 0.000 0.000 2.000 2.000 0.000 0.000 4.000 0.000 0.000 4.000 0.000 2.000 4.000 10.00 2.000 4.000 2.000 3.000 5.000 0.000 3.414 5.414 0.000 SPHERE_TRIANGLE_SIDES_TO_ANGLES_TEST SPHERE_TRIANGLE_SIDES_TO_ANGLES takes the sides of a spherical triangle and determines the angles. A = 2.0589 (radians) = 117.9644 ( degrees ) Correct = 117.9667 (degrees) B = 1.6271 (radians) = 93.2280 ( degrees ) Correct = 93.2300 (degrees) C = 1.2277 (radians) = 70.3443 ( degrees ) Correct = 70.3433 (degrees) TEST189 SPHERE_IMP_AREA_ND computes the area of a sphere in ND; SPHERE_IMP_VOLUME_ND computes the volume of a sphere in ND. We use a radius of R = 1.00000 DIM_NUM Area Volume 2 6.28319 3.14159 3 12.5664 4.18879 4 19.7392 4.93480 5 26.3189 5.26379 6 31.0063 5.16771 7 33.0734 4.72477 8 32.4697 4.05871 9 29.6866 3.29851 10 25.5016 2.55016 TEST1895: SPHERE01_AREA_ND evaluates the area of the unit sphere in N dimensions. SPHERE01_AREA_VALUES returns some test values. 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 sphere01_sample_2d_test sphere01_sample_2d() samples the unit sphere in 2D (the circle); A few sample values: 0.0111 -0.9999 -0.9661 0.2581 0.6316 -0.7753 -1.0000 -0.0081 0.7542 0.6567 Number of sample points = 1000 Now average the points, which should get a value close to zero, and closer as sample_num increases. Average: -0.0034 0.0129 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.9856 -0.1693 Average |(XdotV)| 0.6510 V: -0.3768 0.9263 Average |(XdotV)| 0.6391 V: 0.9580 -0.2867 Average |(XdotV)| 0.6358 V: 0.6347 0.7728 Average |(XdotV)| 0.6423 V: 0.1205 0.9927 Average |(XdotV)| 0.6359 sphere01_sample_3d_test sphere01_sample_3d() samples the unit sphere in 3D. A few sample values: -0.6195 -0.6125 -0.4910 -0.1018 -0.5154 -0.8509 0.1725 0.9747 -0.1424 -0.2403 0.9505 -0.1972 0.2720 -0.8961 0.3508 Now average the points, which should get a value close to zero, and closer as sample_num increases. Average: 0.0299 0.0048 0.0053 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.8730 0.4325 0.2255 Average |(XdotV)| 0.4962 V: 0.9023 -0.1267 -0.4120 Average |(XdotV)| 0.5142 V: -0.3986 -0.5868 -0.7048 Average |(XdotV)| 0.5175 V: 0.3220 -0.2142 0.9222 Average |(XdotV)| 0.4896 V: 0.4491 0.6715 0.5893 Average |(XdotV)| 0.4997 TEST192 For the unit sphere in 3 dimensions: SPHERE01_SAMPLE_3D_2 samples; Warning: SPHERE01_SAMPLE_3D_2 is NOT a good code! I only implemented it for comparison. A few sample values: 0.9455 0.0366 -0.3235 0.0446 -0.5036 0.8628 0.7429 -0.0479 -0.6677 -0.9265 0.2741 0.2576 0.0460 0.1728 -0.9839 Now average the points, which should get a value close to zero, and closer as sample_num increases. Average: -0.0066 -0.0025 -0.0137 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.1691 0.7253 0.6673 Average |(XdotV)| 0.5386 V: 0.4571 0.8676 -0.1956 Average |(XdotV)| 0.4267 V: 0.0728 -0.1318 -0.9886 Average |(XdotV)| 0.6233 V: -0.8785 -0.2436 0.4109 Average |(XdotV)| 0.4669 V: -0.1253 0.1571 -0.9796 Average |(XdotV)| 0.6189 TEST193 For the unit sphere in N dimensions: SPHERE01_SAMPLE_ND samples; A few sample values: 0.9785 0.1563 0.1344 -0.3294 0.1531 0.9317 0.8528 0.2664 0.4492 -0.1246 0.9057 -0.4053 -0.4487 0.2852 -0.8469 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.0060 0.0085 -0.0329 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.5641 0.5567 -0.6099 Average |(XdotV)| 0.4951 V: -0.1560 0.8015 0.5773 Average |(XdotV)| 0.4630 V: -0.0864 -0.3620 0.9282 Average |(XdotV)| 0.5860 V: 0.6529 0.2196 0.7249 Average |(XdotV)| 0.5515 V: -0.0308 0.8764 0.4805 Average |(XdotV)| 0.4324 TEST194 For the unit sphere in N dimensions: SPHERE01_SAMPLE_ND_2 samples; A few sample values: -0.0009 -0.8758 0.4826 0.0979 -0.0679 -0.9929 0.7233 -0.4110 0.5549 0.6290 0.4069 -0.6624 0.8334 -0.2666 0.4841 Spatial dimension = 3 Number of sample points = 1000 Now average the points, which should get a value close to zero, and closer as sample_num increases. Average: 0.0225 0.0127 0.0023 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.3679 0.6626 -0.6524 Average |(XdotV)| 0.5078 V: 0.4114 0.8989 -0.1508 Average |(XdotV)| 0.5060 V: 0.0405 0.9938 0.1034 Average |(XdotV)| 0.5037 V: 0.5123 -0.2440 0.8234 Average |(XdotV)| 0.5082 V: -0.7035 0.6912 -0.1653 Average |(XdotV)| 0.5076 TEST195 For the unit sphere in N dimensions: SPHERE01_SAMPLE_ND_3 samples; A few sample values: 0.1965 -0.5017 0.8424 -0.6681 -0.6330 0.3911 0.2108 -0.8989 -0.3842 0.2417 0.1247 -0.9623 0.8535 -0.2940 0.4302 Spatial dimension = 3 Number of sample points = 1000 Now average the points, which should get a value close to zero, and closer as sample_num increases. Average: -0.0252 0.0233 0.0124 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.6761 -0.3760 -0.6336 Average |(XdotV)| 0.5020 V: 0.4286 -0.5822 0.6909 Average |(XdotV)| 0.5029 V: -0.9390 0.3040 -0.1612 Average |(XdotV)| 0.4851 V: 0.2702 0.3503 0.8968 Average |(XdotV)| 0.4910 V: -0.1012 0.6968 0.7101 Average |(XdotV)| 0.4945 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.0000000 2: 0.0000000 Square vertex #1 1: 5.0000000 2: 0.0000000 TEST X Y DIST 1 3.00000 0.00000 1.41421 2 5.00000 0.00000 0.00000 3 4.00000 0.00000 0.707107 4 10.0000 0.00000 5.00000 5 8.00000 5.00000 5.83095 6 6.00000 6.00000 6.08276 7 1.00000 2.00000 2.00000 8 2.50000 -0.500000 1.41421 9 4.00000 -1.00000 1.41421 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.0000000 2: 0.0000000 Hexagon vertex #1 1: 5.0000000 2: 0.0000000 TEST X Y DIST 1 3.00000 0.00000 1.73205 2 5.00000 0.00000 0.00000 3 4.00000 0.00000 0.866025 4 10.0000 0.00000 5.00000 5 4.00000 1.73205 2.00000 6 5.00000 3.46410 3.46410 7 3.00000 1.73205 3.46410 8 3.00000 0.866025 2.59808 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.0000000 2: 0.0000000 Hexagon vertex #1 1: 5.0000000 2: 0.0000000 TEST X Y PN Dist 1 3.0000 0.0000 3.0000 0.0000 1.7321 2 5.0000 0.0000 5.0000 0.0000 0.0000 3 4.0000 0.0000 4.7500 0.4330 0.8660 4 10.0000 0.0000 5.0000 0.0000 5.0000 5 4.0000 1.7321 5.0000 -0.0000 2.0000 6 5.0000 3.4641 5.0000 -0.0000 3.4641 7 3.0000 1.7321 3.0000 -1.7321 3.4641 8 3.0000 0.8660 3.0000 -1.7321 2.5981 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.0000000 2: 0.0000000 Hexagon vertex #1 1: 5.0000000 2: 0.0000000 TEST XA YA XB YB XI YI 1 3.0000 0.0000 4.0000 0.0000 5.0000 0.0000 2 3.0000 0.0000 3.0000 1.0000 3.0000 3.4641 3 3.0000 -1.0000 3.0000 1.0000 3.0000 3.4641 4 3.0000 -1.0000 7.0000 5.0000 4.8214 1.7321 TEST201 STRING_2D takes a set of line segments, and "strings" them together. I P1 P2 1 0.00000 0.00000 1.00000 1.00000 2 3.00000 4.00000 2.00000 4.00000 3 2.00000 2.00000 1.00000 3.00000 4 3.00000 2.00000 2.00000 3.00000 5 2.00000 1.00000 2.00000 2.00000 6 1.00000 1.00000 1.00000 2.00000 7 0.00000 5.00000 1.00000 6.00000 8 1.00000 2.00000 1.00000 3.00000 9 3.00000 2.00000 3.00000 3.00000 10 0.00000 0.00000 1.00000 0.00000 11 5.00000 5.00000 6.00000 6.00000 12 3.00000 3.00000 3.00000 4.00000 13 2.00000 4.00000 2.00000 3.00000 14 7.00000 4.00000 5.00000 5.00000 15 1.00000 0.00000 2.00000 1.00000 Found 4 groups of segments. STRING ORDER P1 P2 1 -3 2.0000 2.0000 2.0000 1.0000 1 -2 2.0000 1.0000 1.0000 0.0000 1 -1 1.0000 0.0000 0.0000 0.0000 1 0 0.0000 0.0000 1.0000 1.0000 1 1 1.0000 1.0000 1.0000 2.0000 1 2 1.0000 2.0000 1.0000 3.0000 1 3 1.0000 3.0000 2.0000 2.0000 2 -2 3.0000 2.0000 3.0000 3.0000 2 -1 3.0000 3.0000 3.0000 4.0000 2 0 3.0000 4.0000 2.0000 4.0000 2 1 2.0000 4.0000 2.0000 3.0000 2 2 2.0000 3.0000 3.0000 2.0000 3 0 0.0000 5.0000 1.0000 6.0000 4 -1 7.0000 4.0000 5.0000 5.0000 4 0 5.0000 5.0000 6.0000 6.0000 TEST202 SUPER_ELLIPSE_POINTS_2D returns points on a super ellipse; Superellipse center: 1: 5.0000000 2: -2.0000000 radii R1 = 3.00000 R2 = 1.00000 exponent EXPO = 1.50000 and angle PSI = 0.523599 Sample points: Row 1 2 Col 1: 7.59808 -0.500000 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.50000 -1.13397 8: 4.18324 -1.37537 9: 3.67848 -1.83238 10: 3.15787 -2.37696 11: 2.72936 -2.90270 12: 2.46774 -3.30996 13: 2.40192 -3.50000 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.50000 -2.86603 20: 5.81676 -2.62463 21: 6.32152 -2.16762 22: 6.84213 -1.62304 23: 7.27064 -1.09730 24: 7.53226 -0.690042 tetrahedron_centroid_3d_test tetrahedron_centroid_3d() computes the centroid of a tetrahedron in 3D. Tetrahedron vertices: Row 1 2 3 Col 1: 0.00000 0.942809 -0.333333 2: -0.816496 -0.816496 -0.333333 3: 0.816496 -0.816496 -0.333333 4: 0.00000 0.00000 1.00000 Centroid: 1: 0.0000000 2: -0.17254575 3: 0.25000000E-06 tetrahedron_circumsphere_3d_test tetrahedron_circumsphere_3d() computes the circumsphere of a tetrahedron in 3D. Tetrahedron vertices: Row 1 2 3 Col 1: 0.577350 0.00000 0.00000 2: -0.288675 0.500000 0.00000 3: -0.288675 -0.500000 0.00000 4: 0.00000 0.00000 0.816497 Circumsphere center: 1: 0.11102230E-15 2: 0.0000000 3: 0.20412415 Circumsphere radius is 0.612372 tetrahedron_volume_3d_test(): tetrahedron_volume_3d() computes the volume of a tetrahedron in 3D. Tetrahedron vertices Row 1 2 3 Col 1: 0.00000 0.942809 -0.333333 2: -0.816496 -0.816496 -0.333333 3: 0.816496 -0.816496 -0.333333 4: 0.00000 0.00000 1.00000 Volume = 0.638429 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.0000 Col 1 2 3 4 Row 1: 1. 0. 0. 0. 2: 0. 0.866025 -0.500000 0. 3: 0. 0.500000 0.866025 0. 4: 0. 0. 0. 1. Transformation matrix for rotation about 1.00000 2.00000 3.00000 of 30.0000 Col 1 2 3 4 Row 1: 0.875595 -0.381753 0.295970 0. 2: 0.420031 0.904304 -0.762129E-01 0. 3: -0.238552 0.191048 0.952152 0. 4: 0. 0. 0. 1. Transformation matrix for scaling by 2.00000 0.500000 10.0000 Col 1 2 3 4 Row 1: 2. 0. 0. 0. 2: 0. 0.500000 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.500000 0. 0. 2: 0. 1. 0. 0. 3: 0. 0. 1. 0. 4: 0. 0. 0. 1. Transformation matrix for translation by 1.00000 2.00000 3.00000 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.00000 0.00000 0.00000 2: 0.00000 1.00000 0.00000 3: 0.00000 0.00000 1.00000 4: 1.00000 1.00000 1.00000 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.0000 Row 1 2 3 Col 1: 1.00000 0.00000 0.00000 2: 0.00000 0.866025 0.500000 3: 0.00000 -0.500000 0.866025 4: 1.00000 0.366025 1.36603 Rotation about 1.00000 2.00000 3.00000 of 30.0000 Row 1 2 3 Col 1: 0.875595 0.420031 -0.238552 2: -0.381753 0.904304 0.191048 3: 0.295970 -0.762129E-01 0.952152 4: 0.789812 1.24812 0.904648 Scaling by 2.00000 0.500000 10.0000 Row 1 2 3 Col 1: 2.00000 0.00000 0.00000 2: 0.00000 0.500000 0.00000 3: 0.00000 0.00000 10.0000 4: 2.00000 0.500000 10.0000 xy shear coefficient of 0.500000 Row 1 2 3 Col 1: 1.00000 0.00000 0.00000 2: 0.500000 1.00000 0.00000 3: 0.00000 0.00000 1.00000 4: 1.50000 1.00000 1.00000 Translation by 1.00000 2.00000 3.00000 Row 1 2 3 Col 1: 2.00000 2.00000 3.00000 2: 1.00000 3.00000 3.00000 3: 1.00000 2.00000 4.00000 4: 2.00000 3.00000 4.00000 TEST206 For a triangle in 2D, TRIANGLE_ANGLES_2D computes the angles; Triangle vertices: Row 1 2 Col 1: 0.00000 1.00000 2: 0.00000 0.00000 3: 1.00000 0.00000 Radians Degrees 0.785398 45.0000 1.57080 90.0000 0.785398 45.0000 TEST20605 For a triangle in 3D: TRIANGLE_ANGLES_3D computes the angles; Triangle vertices: Row 1 2 3 Col 1: 1.00000 2.00000 3.00000 2: 2.41421 3.41421 3.00000 3: 1.70711 2.70711 4.00000 Radians Degrees 0.785398 45.0000 0.785398 45.0000 1.57080 90.0000 TEST2061 For a triangle in 2D, TRIANGLE_AREA_2D computes the area; Triangle vertices: Row 1 2 Col 1: 0.00000 1.00000 2: 0.00000 0.00000 3: 1.00000 0.00000 Triangle area is 0.500000 TEST2062 For a triangle in any dimension, TRIANGLE_AREA_HERON computes the area; Triangle vertices: Row 1 2 3 Col 1: 1.00000 0.00000 0.00000 2: 0.00000 1.00000 0.00000 3: 0.00000 0.00000 1.00000 Side lengths: 1: 1.4142136 2: 1.4142136 3: 1.4142136 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.41421 1.70711 2: 2. 3.41421 2.70711 3: 3. 3. 4. Area #1 1.00000 Area #2 1.00000 Area #3 1.00000 TEST20655 For a triangle in 2D, TRIANGLE_BARYCENTRIC_2D converts XY coordinates to barycentric XSI coordinates; Triangle vertices: Row 1 2 Col 1: 0.00000 1.00000 2: 0.00000 0.00000 3: 1.00000 0.00000 P XSI 0.250 0.250 0.500 0.250 0.250 0.750 0.250 0.000 0.750 0.250 1.000 1.000 -1.000 1.000 1.000 11.000 0.500 -10.500 11.000 0.500 0.000 1.000 -0.000 0.000 1.000 0.500 -10.000 10.500 0.500 -10.000 0.600 0.600 -0.200 0.600 0.600 TEST2066 For a triangle in 2D: TRIANGLE_CENTROID_2D computes the centroid. Triangle vertices: Row 1 2 Col 1: 0.00000 0.00000 2: 1.00000 0.00000 3: 0.00000 1.00000 Centroid: 1: 0.33333333 2: 0.33333333 Triangle vertices: Row 1 2 Col 1: 0.00000 0.00000 2: 1.00000 0.00000 3: 0.500000 0.866025 Centroid: 1: 0.50000000 2: 0.28867513 Triangle vertices: Row 1 2 Col 1: 0.00000 0.00000 2: 1.00000 0.00000 3: 0.500000 10.0000 Centroid: 1: 0.50000000 2: 3.3333333 Triangle vertices: Row 1 2 Col 1: 0.00000 0.00000 2: 1.00000 0.00000 3: 10.0000 2.00000 Centroid: 1: 3.6666667 2: 0.66666667 TEST2094 For a triangle in 3D: TRIANGLE_CENTROID_3D computes the centroid. Triangle vertices: Row 1 2 3 Col 1: 1.00000 2.00000 3.00000 2: 2.41421 3.41421 3.00000 3: 1.70711 2.70711 4.00000 Centroid: 1: 1.7071068 2: 2.7071068 3: 3.3333333 TEST2101 For a triangle in 2D, the circumenter can be computed by: TRIANGLE_CIRCUMCENTER_2D; TRIANGLE_CIRCUMCENTER_2D_2; TRIANGLE_CIRCUMCENTER (any dimension); Triangle vertices: Row 1 2 Col 1: 10.0000 5.00000 2: 11.0000 5.00000 3: 10.0000 6.00000 Circumcenter by TRIANGLE_CIRCUMCENTER_2D: 1: 10.500000 2: 5.5000000 Circumcenter by TRIANGLE_CIRCUMCENTER_2D_2: 1: 10.500000 2: 5.5000000 Circumcenter by TRIANGLE_CIRCUMCENTER: 1: 10.500000 2: 5.5000000 Triangle vertices: Row 1 2 Col 1: 10.0000 5.00000 2: 11.0000 5.00000 3: 10.5000 5.86603 Circumcenter by TRIANGLE_CIRCUMCENTER_2D: 1: 10.500000 2: 5.2886751 Circumcenter by TRIANGLE_CIRCUMCENTER_2D_2: 1: 10.500000 2: 5.2886751 Circumcenter by TRIANGLE_CIRCUMCENTER: 1: 10.500000 2: 5.2886751 Triangle vertices: Row 1 2 Col 1: 10.0000 5.00000 2: 11.0000 5.00000 3: 10.5000 15.0000 Circumcenter by TRIANGLE_CIRCUMCENTER_2D: 1: 10.500000 2: 9.9875000 Circumcenter by TRIANGLE_CIRCUMCENTER_2D_2: 1: 10.500000 2: 9.9875000 Circumcenter by TRIANGLE_CIRCUMCENTER: 1: 10.500000 2: 9.9875000 Triangle vertices: Row 1 2 Col 1: 10.0000 5.00000 2: 11.0000 5.00000 3: 20.0000 7.00000 Circumcenter by TRIANGLE_CIRCUMCENTER_2D: 1: 10.500000 2: 28.500000 Circumcenter by TRIANGLE_CIRCUMCENTER_2D_2: 1: 10.500000 2: 28.500000 Circumcenter by TRIANGLE_CIRCUMCENTER: 1: 10.500000 2: 28.500000 TEST21011 For a triangle in M dimensions, the circumenter can be computed by: TRIANGLE_CIRCUMCENTER; M2 = 2 Circumcenter by TRIANGLE_CIRCUMCENTER: 1: 8.1268130 2: 8.2543357 Distances from circumcenter to vertices: 0.695848 0.695848 0.695848 Circumcenter by TRIANGLE_CIRCUMCENTER: 1: 8.6229752 2: 7.7785540 Distances from circumcenter to vertices: 1.27504 1.27504 1.27504 Circumcenter by TRIANGLE_CIRCUMCENTER: 1: 6.8228230 2: 9.5047625 Distances from circumcenter to vertices: 1.41068 1.41068 1.41068 Circumcenter by TRIANGLE_CIRCUMCENTER: 1: -147.11737 2: 157.12164 Distances from circumcenter to vertices: 214.601 214.601 214.601 M2 = 3 Circumcenter by TRIANGLE_CIRCUMCENTER: 1: 8.6724198 2: 9.6356315 3: 5.6604807 Distances from circumcenter to vertices: 0.591927 0.591927 0.591927 Circumcenter by TRIANGLE_CIRCUMCENTER: 1: 8.3922160 2: 9.9051745 3: 5.8036382 Distances from circumcenter to vertices: 0.923928 0.923928 0.923928 Circumcenter by TRIANGLE_CIRCUMCENTER: 1: 1.0996449 2: 16.920288 3: 9.5294469 Distances from circumcenter to vertices: 11.6058 11.6058 11.6058 Circumcenter by TRIANGLE_CIRCUMCENTER: 1: -22.578975 2: 39.698016 3: 21.626965 Distances from circumcenter to vertices: 46.6118 46.6118 46.6118 M2 = 4 Circumcenter by TRIANGLE_CIRCUMCENTER: 1: 12.535372 2: 2.5215146 3: 5.0283926 4: 13.610932 Distances from circumcenter to vertices: 0.717444 0.717444 0.717444 Circumcenter by TRIANGLE_CIRCUMCENTER: 1: 12.631466 2: 2.4868597 3: 5.7539912 4: 13.462476 Distances from circumcenter to vertices: 1.27856 1.27856 1.27856 Circumcenter by TRIANGLE_CIRCUMCENTER: 1: 14.692900 2: 1.7434375 3: 21.319654 4: 10.277780 Distances from circumcenter to vertices: 17.1723 17.1723 17.1723 Circumcenter by TRIANGLE_CIRCUMCENTER: 1: 23.547118 2: -1.4496912 3: 88.176904 4: -3.4010503 Distances from circumcenter to vertices: 86.0518 86.0518 86.0518 M2 = 5 Circumcenter by TRIANGLE_CIRCUMCENTER: 1: 4.5943695 2: 10.509288 3: 7.6610749 4: 5.2826250 5: 12.655949 Distances from circumcenter to vertices: 0.756671 0.756671 0.756671 Circumcenter by TRIANGLE_CIRCUMCENTER: 1: 4.9026194 2: 10.375867 3: 7.6274231 4: 5.4271582 5: 12.747929 Distances from circumcenter to vertices: 0.988831 0.988831 0.988831 Circumcenter by TRIANGLE_CIRCUMCENTER: 1: 13.710161 2: 6.5636528 3: 6.6658978 4: 9.5568668 5: 15.376066 Distances from circumcenter to vertices: 11.5604 11.5604 11.5604 Circumcenter by TRIANGLE_CIRCUMCENTER: 1: 53.899268 2: -10.831608 3: 2.2784257 4: 28.400866 5: 27.368341 Distances from circumcenter to vertices: 60.8996 60.8996 60.8996 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.00000 0.00000 2: 1.00000 0.00000 3: 0.00000 1.00000 Circumcenter 1: 0.50000000 2: 0.50000000 Circumradius: 0.707107 Circumcenter2 1: 0.50000000 2: 0.50000000 Circumradius2: 0.707107 Triangle vertices: Row 1 2 Col 1: 0.00000 0.00000 2: 1.00000 0.00000 3: 0.500000 0.866025 Circumcenter 1: 0.50000000 2: 0.28867513 Circumradius: 0.577350 Circumcenter2 1: 0.50000000 2: 0.28867513 Circumradius2: 0.577350 Triangle vertices: Row 1 2 Col 1: 0.00000 0.00000 2: 1.00000 0.00000 3: 0.500000 10.0000 Circumcenter 1: 0.50000000 2: 4.9875000 Circumradius: 5.01250 Circumcenter2 1: 0.50000000 2: 4.9875000 Circumradius2: 5.01250 Triangle vertices: Row 1 2 Col 1: 0.00000 0.00000 2: 1.00000 0.00000 3: 10.0000 2.00000 Circumcenter 1: 0.50000000 2: 23.500000 Circumradius: 23.5053 Circumcenter2 1: 0.50000000 2: 23.500000 Circumradius2: 23.5053 TEST21015 For a triangle in 2D: TRIANGLE_CIRCUMRADIUS_2D computes the circumradius. Triangle vertices: Row 1 2 Col 1: 0.00000 0.00000 2: 1.00000 0.00000 3: 0.00000 1.00000 Circumradius: 0.707107 Triangle vertices: Row 1 2 Col 1: 0.00000 0.00000 2: 1.00000 0.00000 3: 0.500000 0.866025 Circumradius: 0.577350 Triangle vertices: Row 1 2 Col 1: 0.00000 0.00000 2: 1.00000 0.00000 3: 0.500000 10.0000 Circumradius: 5.01250 Triangle vertices: Row 1 2 Col 1: 0.00000 0.00000 2: 1.00000 0.00000 3: 10.0000 2.00000 Circumradius: 23.5053 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.00000 4.00000 2.00000 2: 9.00000 0.00000 5.00000 3: 2.00000 1.00000 2.00000 Line point P1: 1: 3.0000000 2: 0.0000000 3: -7.0000000 Line point P2: 1: 5.0000000 2: 1.0000000 3: -2.0000000 The triangle contains the line. Intersection point: 1: 7.0000000 2: 2.0000000 3: 3.0000000 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.00000 4.00000 2.00000 2: 9.00000 0.00000 5.00000 3: 2.00000 1.00000 2.00000 Parametric base point P0: 1: 3.0000000 2: 0.0000000 3: -7.0000000 Parametric direction PD: 1: 2.0000000 2: 1.0000000 3: 5.0000000 The triangle contains the line. Intersection point: 1: 7.0000000 2: 2.0000000 3: 3.0000000 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.00000 1.00000 2: 0.00000 0.00000 3: 1.00000 0.00000 X Y In1 In2 In3 0.250 0.250 T T T 0.750 0.250 T T T 1.000 1.000 F F F 11.000 0.500 F F F 0.000 1.000 T T T 0.500 -10.000 F F F 0.600 0.600 F F F Repeat the test, but reverse the triangle vertex ordering. Triangle vertices (reversed): Row 1 2 Col 1: 1.00000 0.00000 2: 0.00000 0.00000 3: 0.00000 1.00000 X Y In1 In2 In3 0.250 0.250 T F T 0.750 0.250 T F T 1.000 1.000 F F F 11.000 0.500 F F F 0.000 1.000 T F T 0.500 -10.000 F F F 0.600 0.600 F F F TEST2075 TRIANGLE_DIAMETER_2D computes the diameter of the SMALLEST circle around the triangle. Triangle vertices: Row 1 2 Col 1: 4.00000 2.00000 2: 1.00000 5.00000 3: -2.00000 2.00000 Diameter = 6.00000 Triangle vertices: Row 1 2 Col 1: 4.00000 2.00000 2: 5.00000 4.00000 3: 6.00000 6.00000 Diameter = 6.00000 Triangle vertices: Row 1 2 Col 1: 4.00000 2.00000 2: 1.00000 5.00000 3: 4.00000 2.00000 Diameter = 0.00000 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.00000 1.00000 2: 0.00000 0.00000 3: 1.00000 0.00000 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.00000 0.00000 2: 1.00000 0.00000 3: 0.00000 1.00000 Incenter 1: 0.29289322 2: 0.29289322 Triangle vertices: Row 1 2 Col 1: 0.00000 0.00000 2: 1.00000 0.00000 3: 0.500000 0.866025 Incenter 1: 0.50000000 2: 0.28867513 Triangle vertices: Row 1 2 Col 1: 0.00000 0.00000 2: 1.00000 0.00000 3: 0.500000 10.0000 Incenter 1: 0.50000000 2: 0.47562461 Triangle vertices: Row 1 2 Col 1: 0.00000 0.00000 2: 1.00000 0.00000 3: 10.0000 2.00000 Incenter 1: 0.98924728 2: 0.97954785E-01 TEST2070 For a triangle in 2D, TRIANGLE_INCIRCLE_2D computes the incircle. Triangle vertices: Row 1 2 Col 1: 0.00000 1.00000 2: 0.00000 0.00000 3: 1.00000 0.00000 Incenter 1: 0.29289322 2: 0.29289322 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.00000 1.00000 2: 0.00000 0.00000 3: 1.00000 0.00000 Incircle radius is 0.292893 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.00000 2.00000 2: 1.00000 5.00000 3: -2.00000 2.00000 The points are counterclockwise. Triangle vertices: Row 1 2 Col 1: 1.00000 5.00000 2: 4.00000 2.00000 3: 1.00000 -1.00000 The points are clockwise. Triangle vertices: Row 1 2 Col 1: 1.00000 5.00000 2: 2.00000 7.00000 3: 3.00000 9.00000 The points are colinear. Triangle vertices: Row 1 2 Col 1: 1.00000 5.00000 2: 4.00000 2.00000 3: 1.00000 5.00000 The points are not distinct. TEST2103 TRIANGLE_ORTHOCENTER_2D computes the orthocenter of a triangle in 2D. Triangle vertices: Row 1 2 Col 1: 0.00000 0.00000 2: 1.00000 0.00000 3: 0.00000 1.00000 Orthocenter 1: 0.0000000 2: 0.0000000 Triangle vertices: Row 1 2 Col 1: 0.00000 0.00000 2: 1.00000 0.00000 3: 0.500000 0.866025 Orthocenter 1: 0.50000000 2: 0.28867514 Triangle vertices: Row 1 2 Col 1: 0.00000 0.00000 2: 1.00000 0.00000 3: 0.500000 10.0000 Orthocenter 1: 0.50000000 2: 0.25000000E-01 Triangle vertices: Row 1 2 Col 1: 0.00000 0.00000 2: 1.00000 0.00000 3: 10.0000 2.00000 Orthocenter 1: 10.000000 2: -45.000000 TEST2071 TRIANGLE_POINT_DIST_2D computes the distance from a point to a triangle in 2D; Triangle vertices: Row 1 2 Col 1: 0.00000 1.00000 2: 0.00000 0.00000 3: 1.00000 0.00000 P DIST 0.250 0.250 0.250 0.750 0.250 0.000 1.000 1.000 0.707 11.000 0.500 10.012 0.000 1.000 0.000 0.500 -10.000 10.000 0.600 0.600 0.141 TEST20715 TRIANGLE_POINT_DIST_SIGNED_2D computes signed distance from a point to a triangle in 2D; Triangle vertices: Row 1 2 Col 1: 0.00000 1.00000 2: 0.00000 0.00000 3: 1.00000 0.00000 P DIST_SIGNED 0.250 0.250 -0.250 0.750 0.250 0.000 1.000 1.000 0.707 11.000 0.500 10.012 0.000 1.000 0.000 0.500 -10.000 10.000 0.600 0.600 0.141 TEST2095 TRIANGLE_POINT_DIST_3D computes the distance from a point to a triangle in 3D; Triangle vertices: Row 1 2 3 Col 1: 1.00000 2.00000 3.00000 2: 2.41421 3.41421 3.00000 3: 1.70711 2.70711 4.00000 P DIST 1.000 2.000 3.000 0.00000 1.354 2.354 3.000 0.00000 0.000 0.000 0.000 3.74166 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.00000 1.00000 2: 0.00000 0.00000 3: 1.00000 0.00000 P PN 0.250 0.250 0.000 0.250 0.750 0.250 0.750 0.250 1.000 1.000 0.500 0.500 11.000 0.500 1.000 0.000 0.000 1.000 0.000 1.000 0.500 -10.000 0.500 0.000 0.600 0.600 0.500 0.500 TEST2115 TRIANGLE_QUALITY_2D computes the quality of a triangle. Triangle vertices: Row 1 2 Col 1: 0.00000 0.00000 2: 1.00000 0.00000 3: 0.00000 1.00000 Quality = 0.828427 Triangle vertices: Row 1 2 Col 1: 0.00000 0.00000 2: 1.00000 0.00000 3: 0.500000 0.866025 Quality = 1.00000 Triangle vertices: Row 1 2 Col 1: 0.00000 0.00000 2: 1.00000 0.00000 3: 0.500000 10.0000 Quality = 0.189775 Triangle vertices: Row 1 2 Col 1: 0.00000 0.00000 2: 1.00000 0.00000 3: 10.0000 2.00000 Quality = 0.833469E-02 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.00000 2.00000 2: 1.00000 5.00000 3: -2.00000 2.00000 Sample points (X,Y) and (XSI1,XSI2,XSI3) coordinates: 1.3471 2.1767 0.5284 0.0589 0.4127 0.0176 3.2379 0.1300 0.4126 0.4574 1.4379 3.2378 0.3667 0.4126 0.2207 0.3349 2.0874 0.3746 0.0291 0.5963 -0.2850 3.2258 0.0815 0.4086 0.5099 1.3986 4.4459 0.1588 0.8153 0.0259 3.2596 2.0130 0.8744 0.0043 0.1212 1.8918 2.8379 0.5090 0.2793 0.2117 -1.0755 2.1027 0.1370 0.0342 0.8288 1.4826 2.5960 0.4811 0.1987 0.3202 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.00000 2.00000 2: 1.00000 5.00000 3: -2.00000 2.00000 Sample points: 1.0000 3.0000 0.3333 0.3333 0.3333 1.0000 3.0000 3.0000 0.0000 1.1667 -0.6667 0.5000 3.0000 0.0000 0.9481 2.7640 0.3640 0.2547 0.3813 0.9481 2.7640 0.6998 2.6170 0.3471 0.2057 0.4472 0.6998 2.6170 1.6974 3.7221 0.3292 0.5740 0.0968 1.6974 3.7221 3.3432 2.3665 0.8294 0.1222 0.0484 3.3432 2.3665 1.3748 3.1628 0.3687 0.3876 0.2437 1.3748 3.1628 0.4696 4.4180 0.0086 0.8060 0.1854 0.4696 4.4180 -0.4290 2.0635 0.2513 0.0212 0.7276 -0.4290 2.0635 0.9335 2.7208 0.3688 0.2403 0.3910 0.9335 2.7208 tube_2d_test tube_2d() computes corners of a tube of radius DIST surrounding a sequence of points. Test 1 Number of points N = 4 Tube radius DIST = 0.500000 Points to surround: Row 1 2 Col 1: 0.00000 0.00000 2: 4.00000 3.00000 3: 4.00000 0.00000 4: 0.00000 0.00000 P1: Row 1 2 Col 1: -0.100000 -0.700000 2: 4.50000 2.75000 3: 4.50000 -0.500000 4: -0.500000 -0.500000 P2: Row 1 2 Col 1: -0.700000 0.100000 2: 3.50000 3.25000 3: 3.50000 0.500000 4: -0.500000 0.500000 Test 2 Number of points N = 5 Tube radius DIST = 0.500000 Points to surround: Row 1 2 Col 1: 0.00000 0.00000 2: 2.00000 0.00000 3: 2.00000 1.00000 4: 0.00000 1.00000 5: 0.00000 0.00000 P1: Row 1 2 Col 1: -0.500000 -0.500000 2: 2.50000 -0.500000 3: 2.50000 1.50000 4: -0.500000 1.50000 5: -0.500000 -0.500000 P2: Row 1 2 Col 1: -0.500000 0.500000 2: 1.50000 0.500000 3: 1.50000 0.500000 4: 0.500000 0.500000 5: 0.500000 -0.500000 Test 3 Number of points N = 5 Tube radius DIST = 1.00000 Points to surround: Row 1 2 Col 1: 10.0000 20.0000 2: 20.0000 20.0000 3: 10.0000 10.0000 4: 20.0000 10.0000 5: 10.0000 20.0000 P1: Row 1 2 Col 1: 9.00000 19.0000 2: 20.4142 19.0000 3: 10.4142 9.00000 4: 19.5858 9.00000 5: 8.58579 20.0000 P2: Row 1 2 Col 1: 9.00000 21.0000 2: 19.5858 21.0000 3: 9.58579 11.0000 4: 20.4142 11.0000 5: 10.0000 21.4142 Test 4 Number of points N = 5 Tube radius DIST = 1.00000 Points to surround: Row 1 2 Col 1: 0.00000 0.00000 2: 10.0000 0.00000 3: 10.0000 10.0000 4: 10.0000 0.00000 5: 0.00000 0.00000 P1: Row 1 2 Col 1: -1.00000 -1.00000 2: 11.0000 -1.00000 3: 11.0000 11.0000 4: 11.0000 -1.00000 5: -1.00000 -1.00000 P2: Row 1 2 Col 1: -1.00000 1.00000 2: 9.00000 1.00000 3: 9.00000 11.0000 4: 9.00000 1.00000 5: -1.00000 1.00000 TEST220 VECTOR_DIRECTIONS_ND computes the angles that a vector makes with the axes. X Y AX AY AX AY (__Radians___) (___Degrees___) 1.000 0.000 0.000 1.571 0.000 90.000 1.732 1.000 0.524 1.047 30.000 60.000 -1.732 1.000 2.618 1.047 150.000 60.000 -1.732 -1.000 2.618 2.094 150.000 120.000 1.732 -1.000 0.524 2.094 30.000 120.000 vector_directions_nd_test vector_directions_nd() computes the angles that a vector makes with the axes. X Y Z AX AY AZ AX AY AZ (_____Radians_______) (_______Degrees_______) 1.000 0.000 0.000 0.000 1.571 1.571 0.000 90.000 90.000 1.000 2.000 3.000 1.300 1.007 0.641 74.499 57.688 36.699 0.000 0.000 1.000 1.571 1.571 0.000 90.000 90.000 0.000 vector_rotate_2d_test vector_rotate_2d() rotates a vector through a given angle around the origin. X1 Y1 Angle X2 Y2 1.000 0.000 30.000 0.866 0.500 0.000 2.000 -45.000 1.414 1.414 1.000 1.000 270.000 1.000 -1.000 vector_rotate_3d_test vector_rotate_3d() rotates a vector through a given angle around the origin. Rotations will be about the following axis: 1.000 1.000 1.000 V1 Angle V2 ---------------------- ------ ---------------------- 1.000 0.000 0.000 30.000 0.911 0.333 -0.244 0.000 2.000 0.000 -45.000 1.012 1.609 -0.621 0.000 0.000 3.000 90.000 2.732 -0.732 1.000 1.000 1.000 1.000 270.000 1.000 1.000 1.000 1.000 1.000 -2.000 30.000 0.000 1.732 -1.732 Rotations will be about the following axis: 0.000 0.000 2.000 V1 Angle V2 ---------------------- ------ ---------------------- 1.000 1.000 1.000 90.000 -1.000 1.000 1.000 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.000 5.000 10.000 5.000 30.000 10.866 5.500 10.000 7.000 10.000 5.000 -45.000 11.414 6.414 11.000 6.000 10.000 5.000 270.000 11.000 4.000 10.000 5.000 10.000 5.000 20.000 10.000 5.000 vector_separation_nd_test vector_separation_nd() computes the separation angle between two vectors. -----Vector 1----- -----Vector 2----- Radians Degrees 1.000 0.000 0.000 1.000 2.000 3.000 1.300 74.499 1.000 0.000 0.000 0.000 0.000 1.000 1.571 90.000 1.000 0.000 0.000 -3.000 2.000 -1.000 2.501 143.301 1.000 0.000 0.000 -2.000 -4.000 -6.000 1.841 105.501 1.000 2.000 3.000 0.000 0.000 1.000 0.641 36.699 1.000 2.000 3.000 -3.000 2.000 -1.000 1.714 98.213 1.000 2.000 3.000 -2.000 -4.000 -6.000 3.142 180.000 0.000 0.000 1.000 -3.000 2.000 -1.000 1.841 105.501 0.000 0.000 1.000 -2.000 -4.000 -6.000 2.501 143.301 -3.000 2.000 -1.000 -2.000 -4.000 -6.000 1.427 81.787 VOXELS_DIST_L1_ND_TEST VOXELS_DIST_L1_ND prints the voxels on a line in ND. P1: 1 1 5 P2: 9 4 4 L1 distance = 12 VOXELS_LINE_3D_TEST VOXELS_LINE_3D computes the voxels on a line in 3D starting at the first voxel, and heading towards the second one. Starting voxel: 1 1 5 "Heading" voxel: 9 4 4 Number of voxels we will compute is 13 The voxels: Row 1 2 3 Col 1: 1 1 5 2: 2 1 5 3: 2 2 5 4: 3 2 5 5: 4 2 5 6: 5 2 5 7: 5 3 5 8: 5 3 4 9: 6 3 4 10: 7 3 4 11: 8 3 4 12: 8 4 4 13: 9 4 4 VOXELS_REGION_3D_TEST VOXELS_REGION_3D groups voxels into regions. Number of regions found = 3 The nonzero ISHOW array elements are: 2 4 1 2 2 5 1 2 2 7 1 2 3 3 1 2 3 4 1 2 3 5 1 2 3 6 1 2 3 7 1 2 4 4 1 2 4 5 1 2 4 7 1 2 5 7 1 2 6 2 1 1 6 3 1 1 6 6 1 2 6 7 1 2 7 3 1 1 8 8 1 3 The stack-based list of regions is: Region 3 includes 1 voxels: 8 8 1 Region 2 includes 14 voxels: 6 7 1 6 6 1 5 7 1 4 7 1 3 7 1 2 7 1 2 5 1 3 6 1 4 5 1 3 5 1 4 4 1 3 4 1 2 4 1 3 3 1 Region 1 includes 3 voxels: 7 3 1 6 3 1 6 2 1 VOXELS_STEP_3D_TEST VOXELS_STEP_3D steps along a line from one voxel to another. 0 1 1 5 1 2 1 5 2 2 2 5 3 3 2 5 4 4 2 5 5 5 3 4 6 6 3 4 7 7 3 4 8 7 4 4 9 8 4 4 10 9 4 4 Now, as a check, reverse direction and return. 0 9 4 4 1 8 4 4 2 8 3 4 3 7 3 4 4 6 3 4 5 5 2 5 6 4 2 5 7 3 2 5 8 3 1 5 9 2 1 5 10 1 1 5 WEDGE01_VOLUME_TEST WEDGE01_VOLUME returns the volume of the unit wedge. Unit wedge volume = 1.00000 xy_to_polar_test xy_to_polar() converts (X,Y) to (R,Theta). X Y ===> R T => X Y -0.09418 -0.84452 0.84976 4.60133 -0.09418 -0.84452 -0.11400 -0.56626 0.57762 4.51373 -0.11400 -0.56626 0.20942 0.85162 0.87699 1.32967 0.20942 0.85162 0.02613 0.31859 0.31966 1.48895 0.02613 0.31859 -0.64887 0.63298 0.90647 2.36859 -0.64887 0.63298 -0.45392 0.86170 0.97395 2.05563 -0.45392 0.86170 0.98423 -0.82400 1.28362 5.58617 0.98423 -0.82400 0.94453 -0.43666 1.04058 5.85015 0.94453 -0.43666 -0.02528 0.27506 0.27622 1.66245 -0.02528 0.27506 -0.84906 -0.67396 1.08403 3.81252 -0.84906 -0.67396 xyz_to_radec_test xyz_to_radec() converts XYZ to RADEC coordinates. P1 RA DEC P2 1.000 0.000 0.000 0.000 0.000 1.000 0.000 0.000 0.000 1.000 0.000 6.000 0.000 0.000 1.000 0.000 0.000 0.000 1.000 0.000 90.000 0.000 0.000 1.000 1.000 1.000 1.000 3.000 35.264 0.577 0.577 0.577 5.000 -2.000 -1.000 22.547-10.520 0.913 -0.365 -0.183 -2.000 -2.000 -2.000 15.000-35.264 -0.577 -0.577 -0.577 xyz_to_rtp_test xyz_to_rtp() converts (R,Theta,Phi) to XYZ coordinates. X1 Y1 Z1 R THETA PHI X2 Y2 Z2 -1.647 -1.399 2.928 3.639 3.846 0.636 -1.647 -1.399 2.928 -1.731 1.784 -1.061 2.703 2.341 1.974 -1.731 1.784 -1.061 2.201 -0.844 2.305 3.297 5.917 0.797 2.201 -0.844 2.305 -1.734 -0.969 -1.916 2.760 3.651 2.338 -1.734 -0.969 -1.916 1.058 0.119 -0.061 1.066 0.112 1.628 1.058 0.119 -0.061 geometry_test(): Normal end of execution. 9 May 2022 9:54:08.780 PM