Sun Aug 13 09:46:53 2023 geometry_test(): Python version: 3.8.10 Test geometry(). angle_degree_test(): angle_degree() computes an angle. X Y Theta atan2(y,x) angle_degree 1.000000 0.000000 0.000000 0.000000 0.000000 0.866025 0.500000 30.000000 30.000000 30.000000 0.500000 0.866025 60.000000 60.000000 60.000000 0.000000 1.000000 90.000000 90.000000 90.000000 -0.500000 0.866025 120.000000 120.000000 120.000000 -0.866025 0.500000 150.000000 150.000000 150.000000 -1.000000 0.000000 180.000000 180.000000 180.000000 -0.866025 -0.500000 210.000000 -150.000000 210.000000 -0.500000 -0.866025 240.000000 -120.000000 240.000000 -0.000000 -1.000000 270.000000 -90.000000 270.000000 0.500000 -0.866025 300.000000 -60.000000 300.000000 0.866025 -0.500000 330.000000 -30.000000 330.000000 1.000000 -0.000000 360.000000 -0.000000 360.000000 angle_half_test(): angle_half() is given P1, P2, P3, forming an angle. It finds P4 so P4, P2, P3 is half the angle. Original Angle Half Angle 0.000000 0.000000 0.523599 0.261799 1.047198 0.523599 1.570796 0.785398 2.094395 1.047198 2.617994 1.308997 3.141593 1.570796 3.665191 4.974188 4.188790 5.235988 4.712389 5.497787 5.235988 5.759587 5.759587 6.021386 6.283185 6.283185 angle_radian_test(): angle_radian() computes an angle in radians. X Y Theta atan2(y,x) angle_radian 1.000000 0.000000 0.000000 0.000000 0.000000 0.866025 0.500000 30.000000 0.523599 0.523599 0.500000 0.866025 60.000000 1.047198 1.047198 0.000000 1.000000 90.000000 1.570796 1.570796 -0.500000 0.866025 120.000000 2.094395 2.094395 -0.866025 0.500000 150.000000 2.617994 2.617994 -1.000000 0.000000 180.000000 3.141593 3.141593 -0.866025 -0.500000 210.000000 -2.617994 3.665191 -0.500000 -0.866025 240.000000 -2.094395 4.188790 -0.000000 -1.000000 270.000000 -1.570796 4.712389 0.500000 -0.866025 300.000000 -1.047198 5.235988 0.866025 -0.500000 330.000000 -0.523599 5.759587 1.000000 -0.000000 360.000000 -0.000000 6.283185 annulus_area_test(): annulus_area() computes the centroid of a circular annulus. The circle has center 5.000000 3.000000 The inner radius is R1 = 2.000000 The outer radius is R2 = 3.000000 Area: 15.707963 ball01_sample_2d_test(): ball01_sample_2d() samples the unit ball in 2d; A few sample values: 0.407326 -0.694281 0.369298 -0.451688 0.244678 -0.687172 0.293671 0.170823 -0.568324 -0.131692 Number of sample points = 1000 Now average the points, which should get a value close to zero, and closer as N_SAMPLE increases. Average: [-0.03306255 -0.00310428] Now average the distance of the points from the center, which should be 1/sqrt(2) = 0.7071067811865475 Average: 0.67020787374045 Now average the angle THETA which should be PI Average: 3.1317707897491944 ball01_sample_3d_test(): ball01_sample_3d() samples the unit ball in 3d; A few sample values: 0.380025 -0.312319 0.379253 0.310982 -0.495307 0.573777 0.174649 0.133814 0.019203 0.792533 0.286726 -0.253343 0.530726 -0.576110 0.548100 Number of sample points = 1000 Now average the points, which should get a value close to zero, and closer as N_SAMPLE increases. Average: [0.0041168 0.02040184 0.01232051] Now average the distance of the points from the center, which should be the 1/2^(1/dim_num) = 0.7937005259840998 Average: 0.7529555988839802 Now average the angle THETA, which should be PI. Average: 3.101187589090313 Now average the angle PHI, which should be PI/2. Average: 1.5318495124901919 ball01_sample_nd_test(): ball_unit_sample_nd() samples the unit ball in N dimensions; A few sample values: 0.196119 -0.269924 0.816279 0.195019 -0.497873 -0.595258 0.851012 -0.016485 0.033184 -0.368636 0.126178 0.627188 -0.655996 -0.283305 0.664829 Number of sample points = 1000 Now average the points, which should get a value close to zero, and closer as N increases. Average: 0.010655 0.004177 -0.031350 Now average the distance of the points from the center, which should be the 1/2^(1/dim_num) = 0.7937005259840998 Average: 0.7433261271718968 ball01_volume_test(): ball01_volume() returns the volume of the unit ball. ball01_volume() = 4.18879 circle_area_test(): circle_area() computes the area of a circle of radius R. R Area 1.000000 3.141593 2.000000 12.566371 4.000000 50.265482 8.000000 201.061930 circle_dia2imp_2d_test(): circle_dia2imp_2d() converts a diameter to an implicit circle in 2D. point P1: [-0.08073418 7.54648713] point P2: [ 4.08073418 -1.54648713] The implicit circle: Radius = 5.000000 Center = ( 2.000000, 3.000000 ) circle_imp_point_dist_2d_test(): circle_imp_point_dist_2d() checks, by finding the distance D from a point (X,Y) to a circle. Circle has center (0.000000,0.000000) and radius 5.000000 X Y D 5.6685 -8.8846 5.5389 7.1017 -0.8685 2.1546 -0.1879 8.6382 3.6402 1.6649 3.0596 1.5168 -9.4941 -7.6657 7.2025 -2.4487 -0.0934 2.5495 0.6482 8.6295 3.6539 -5.7748 -8.1419 4.9819 -6.7748 -1.2579 1.8906 -1.5127 -6.4612 1.6359 circle_imp_print_2d_test(): circle_imp_print_2d() prints a circle definition. An example circle: Radius = 2.000000 Center = ( 5.000000, -2.000000 ) circle_lune_angle_by_height_2d_test(): circle_lune_angle_by_height_2d() computes the angle of a circular lune based on the "height" of the circular triangle. R H Angle 2.000000 -2.000000 6.283185 2.000000 -1.666667 5.111814 2.000000 -1.333333 4.601048 2.000000 -1.000000 4.188790 2.000000 -0.666667 3.821266 2.000000 -0.333333 3.476489 2.000000 0.000000 3.141593 2.000000 0.333333 2.806696 2.000000 0.666667 2.461919 2.000000 1.000000 2.094395 2.000000 1.333333 1.682137 2.000000 1.666667 1.171371 2.000000 2.000000 0.000000 circle_lune_area_by_angle_2d_test(): circle_lune_area_by_angle_2d() computes the area of a circular lune, defined by joining the endpoints of a circular arc. R Theta1 Theta2 Area 2.000000 0.000000 0.000000 0.000000 2.000000 0.000000 0.523599 0.047198 2.000000 0.000000 1.047198 0.362344 2.000000 0.000000 1.570796 1.141593 2.000000 0.000000 2.094395 2.456739 2.000000 0.000000 2.617994 4.235988 2.000000 0.000000 3.141593 6.283185 2.000000 0.000000 3.665191 8.330383 2.000000 0.000000 4.188790 10.109631 2.000000 0.000000 4.712389 11.424778 2.000000 0.000000 5.235988 12.204026 2.000000 0.000000 5.759587 12.519173 2.000000 0.000000 6.283185 12.566371 circle_lune_area_by_height_2d_test(): circle_lune_area_by_height_2d() computes the area of a circular lune based on the "height" of the circular triangle. R H Area 2.000000 -2.000000 12.566371 2.000000 -1.666667 12.066198 2.000000 -1.333333 11.189712 2.000000 -1.000000 10.109631 2.000000 -0.666667 8.899612 2.000000 -0.333333 7.610320 2.000000 0.000000 6.283185 2.000000 0.333333 4.956051 2.000000 0.666667 3.666759 2.000000 1.000000 2.456739 2.000000 1.333333 1.376659 2.000000 1.666667 0.500173 2.000000 2.000000 0.000000 circle_lune_height_by_angle_2d_test(): circle_lune_height_by_angle_2d() computes the height of the triangle of a circular lune, given the subtended angle. R Angle Height 2.000000 0.000000 2.000000 2.000000 0.523599 1.931852 2.000000 1.047198 1.732051 2.000000 1.570796 1.414214 2.000000 2.094395 1.000000 2.000000 2.617994 0.517638 2.000000 3.141593 0.000000 2.000000 3.665191 -0.517638 2.000000 4.188790 -1.000000 2.000000 4.712389 -1.414214 2.000000 5.235988 -1.732051 2.000000 5.759587 -1.931852 2.000000 6.283185 -2.000000 circle_sector_area_2d_test(): circle_sector_area_2d() computes the area of a circular sector, defined by joining the endpoints of a circular arc. R Theta1 Theta2 Area 2.000000 0.000000 0.000000 0.000000 2.000000 0.000000 0.523599 1.047198 2.000000 0.000000 1.047198 2.094395 2.000000 0.000000 1.570796 3.141593 2.000000 0.000000 2.094395 4.188790 2.000000 0.000000 2.617994 5.235988 2.000000 0.000000 3.141593 6.283185 2.000000 0.000000 3.665191 7.330383 2.000000 0.000000 4.188790 8.377580 2.000000 0.000000 4.712389 9.424778 2.000000 0.000000 5.235988 10.471976 2.000000 0.000000 5.759587 11.519173 2.000000 0.000000 6.283185 12.566371 circle_triangle_area_2d_test(): circle_triangle_area_2d() computes the area of a circular triangle. R Theta1 Theta2 Area 2.000000 0.000000 0.000000 0.000000 2.000000 0.000000 0.523599 1.000000 2.000000 0.000000 1.047198 1.732051 2.000000 0.000000 1.570796 2.000000 2.000000 0.000000 2.094395 1.732051 2.000000 0.000000 2.617994 1.000000 2.000000 0.000000 3.141593 0.000000 2.000000 0.000000 3.665191 -1.000000 2.000000 0.000000 4.188790 -1.732051 2.000000 0.000000 4.712389 -2.000000 2.000000 0.000000 5.235988 -1.732051 2.000000 0.000000 5.759587 -1.000000 2.000000 0.000000 6.283185 -0.000000 circle01_length_test(): circle01_length() returns the length of the unit circle. circle01_length() = 6.28319 circles_intersect_area_2d_test(): circles_intersect_area_2d() determines the area of the intersection of two circes of radius R1 and R2, with a distance D between the centers. R1 R2 D Area 1.000000 0.500000 1.500000 0.000000 1.000000 0.500000 1.000000 0.350767 1.000000 0.500000 0.500000 0.785398 1.000000 1.000000 1.500000 0.453312 1.000000 1.000000 1.000000 1.228370 1.000000 1.000000 0.000000 3.141593 circles_intersect_points_2d_test(): circles_intersect_points_2d() determines the intersections of two circles in 2D. The first circle: Radius = 5.000000 Center = ( 0.000000, 0.000000 ) The second circle: Radius = 0.500000 Center = ( 5.000000, 5.000000 ) The circles do not intersect. The second circle: Radius = 5.000000 Center = ( 7.071068, 7.071068 ) The circles intersect at two points: X Y 3.535329 3.535739 3.535739 3.535329 The second circle: Radius = 3.000000 Center = ( 4.000000, 0.000000 ) The circles intersect at two points: X Y 4.000000 3.000000 4.000000 -3.000000 The second circle: Radius = 3.000000 Center = ( 6.000000, 0.000000 ) The circles intersect at two points: X Y 4.333333 2.494438 4.333333 -2.494438 The second circle: Radius = 5.000000 Center = ( 0.000000, 0.000000 ) The circles coincide (infinite intersection). cone_volume_test(): cone_volume() computes the volume of a cone. R H ConeVolume 1.00000000 1.00000000 1.04719755 1.00000000 2.00000000 2.09439510 1.00000000 4.00000000 4.18879020 1.00000000 8.00000000 8.37758041 1.00000000 16.00000000 16.75516082 1.00000000 1.00000000 1.04719755 2.00000000 1.00000000 4.18879020 4.00000000 1.00000000 16.75516082 8.00000000 1.00000000 67.02064328 16.00000000 1.00000000 268.08257311 cube01_volume_test(): cube01_volume() returns the volume of the unit cube. cube01_volume() = 1 cylinder_volume_test(): cylinder_volume() returns the volume of a cylinder. cylinder_volume() = 471.23889803846896 Exact volume = 471.23889803846896 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 disk01_area_test(): disk01_area() returns the area of the unit disk. disk01_area() = 3.14159 disk01_quarter_area_test(): disk01_quarter_area() returns the area of the unit quarter disk. disk01_quarter_area() = 0.785398 hexagon01_area_test(): hexagon01_area() returns the area of the unit hexagon. hexagon01_area() = 2.598076211353316 hyperball01_volume_test(): hyperball01_volume() returns the volume of the unit hyperball in M dimensions. M Volume 1 2 2 3.14159 3 4.18879 4 4.9348 5 5.26379 6 5.16771 7 4.72477 8 4.05871 9 3.29851 10 2.55016 hypercube01_volume_test(): hypercube01_volume() returns the volume of the unit hypercube in M dimensions. hypercube01_volume(3) = 1 hypersphere01_area_test(): hypersphere01_area() returns the volume of the unit hypersphere. M Area 1 2 2 6.28319 3 12.5664 4 19.7392 5 26.3189 6 31.0063 7 33.0734 8 32.4697 9 29.6866 10 25.5016 i4_ceiling_test(): i4_ceiling() evaluates the "ceiling" of a real number. R8 i4_ceiling(R8) 4.3027 5 90.9720 91 94.1362 95 -84.3052 -84 1.0416 2 95.2059 96 6.1390 7 -65.6238 -65 89.5421 90 -62.0632 -62 i4_log_10_test(): i4_log_10(): whole part of log base 10, X, i4_log_10 0 0 1 0 2 0 3 0 9 0 10 1 11 1 99 1 101 2 -1 0 -2 0 -3 0 -9 0 i4_modp_test(): i4_modp() factors a number into a multiple M and a positive remainder R. Number Divisor Multiple Remainder 107 50 2 7 107 -50 -2 7 -107 50 -3 43 -107 -50 3 43 Repeat using Python % Operator: 107 50 2 7 107 -50 -3 -43 -107 50 -3 43 -107 -50 2 -7 i4_wrap_test(): i4_wrap() forces an integer to lie within given limits. ILO = 4 IHI = 8 I i4_wrap(I) -10 5 -9 6 -8 7 -7 8 -6 4 -5 5 -4 6 -3 7 -2 8 -1 4 0 5 1 6 2 7 3 8 4 4 5 5 6 6 7 7 8 8 9 4 10 5 11 6 12 7 13 8 14 4 15 5 16 6 17 7 18 8 19 4 20 5 line_exp2imp_test(): line_exp2imp() converts explicit to implicit lines. Implicit line A, B, C = 1.000000 2.000000 3.000000 point P1: [-0.6 -1.2] point P2: [-1.2 -0.9] Recovered A, B, C = 0.238095 0.476190 0.714286 line_exp_perp_test(): line_exp_perp() is given an explicit line (P1,P2), and another point P3. It then finds a point P4 on (P1,P2) so that (P1,P2) is perpendicular to (P3,P4). point P1: [1. 3.] point P2: [4. 0.] point P3: [0. 0.] point P4: [2. 2.] point P3: [ 5. -1.] point P4: [ 5. -1.] point P3: [5. 3.] point P4: [3. 1.] lines_exp_int_test(): lines_exp_int() finds intersections of two explicit lines in 2D. P1 0.000000 2.000000 P2 4.000000 0.000000 Q1 0.000000 -1.000000 Q2 1.000000 0.000000 Intersection at 2.000000 1.000000 P1 0.000000 2.000000 P2 4.000000 0.000000 Q1 0.000000 0.250000 Q2 0.500000 0.000000 Lines are parallel, no intersection. P1 0.000000 2.000000 P2 4.000000 0.000000 Q1 0.000000 2.000000 Q2 4.000000 0.000000 Lines are coincident. lines_imp_int_test(): lines_imp_int() finds the intersection of two lines written in implicit form. Line 1 coefficients: 1.000000 2.000000 -4.000000 Line 2 coefficients: 1.000000 -1.000000 -1.000000 Intersection at 2.000000 1.000000 Line 1 coefficients: 1.000000 2.000000 -4.000000 Line 2 coefficients: 2.000000 4.000000 -1.000000 Lines are parallel, no intersection. Line 1 coefficients: 1.000000 2.000000 -4.000000 Line 2 coefficients: -3.000000 -6.000000 12.000000 Lines are coincident. polar_to_xy_test(): polar_to_xy() converts (R,Theta) to (X,Y); xy_to_polar() converts (X,Y) to (R,Theta). R T ===> X Y => R T 1.316454 5.507416 0.939794 -0.921867 1.316454 5.507416 0.520424 1.958032 -0.196528 0.481890 0.520424 1.958032 1.547617 3.953960 -1.064423 -1.123442 1.547617 3.953960 0.227300 5.499866 0.161059 -0.160391 0.227300 5.499866 0.757051 1.079492 0.357159 0.667505 0.757051 1.079492 0.293920 0.960177 0.168526 0.240807 0.293920 0.960177 0.867666 4.655744 -0.049123 -0.866274 0.867666 4.655744 1.417239 4.166552 -0.735736 -1.211305 1.417239 4.166552 0.861745 5.497960 0.609451 -0.609240 0.861745 5.497960 0.413246 5.371108 0.252950 -0.326785 0.413246 5.371108 polygon_area_test(): polygon_area() computes the area of a polygon. Number of polygonal vertices = 4 The polygon vertices: Row: 0 1 Col 0 : 1 0 1 : 2 1 2 : 1 2 3 : 0 1 Exact area is 2 The computed area is 2 Number of polygonal vertices = 8 The polygon vertices: Row: 0 1 Col 0 : 0 0 1 : 3 0 2 : 3 3 3 : 2 3 4 : 2 1 5 : 1 1 6 : 1 2 7 : 0 2 Exact area is 6 The computed area is 6 pyramid_volume_test(): pyramid_volume() returns the volume of a pyramid. Radius Height Volume 9.4681 7.9689 952.4911 1.6747 2.0225 7.5635 3.8003 4.6810 90.1400 7.3858 3.1785 231.1798 5.0926 1.4486 50.0902 pyramid01_volume_test(): pyramid01_volume() returns the volume of the unit pyramid. pyramid01_volume() = 1.33333 r8_acos_test(): r8_acos() computes the arc-cosine of an angle. C r8_acos(C) ACOS(C) -1.16667 3.14159 -1 3.14159 3.14159 -0.833333 2.55591 2.55591 -0.666667 2.30052 2.30052 -0.5 2.0944 2.0944 -0.333333 1.91063 1.91063 -0.166667 1.73824 1.73824 0 1.5708 1.5708 0.166667 1.40335 1.40335 0.333333 1.23096 1.23096 0.5 1.0472 1.0472 0.666667 0.841069 0.841069 0.833333 0.585686 0.585686 1 0 0 1.16667 0 r8_sign_test(): r8_sign() returns the sign of an R8. R8 r8_sign(R8) -1.2500 -1 -0.2500 -1 0.0000 1 0.5000 1 9.0000 1 r8mat_det_4d_test(): r8mat_det_4d() computes the determinant of a 4 by 4 matrix Matrix: Col: 0 1 2 3 Row 0 : 1 1 1 1 1 : 1 10 100 1000 2 : 1 4 16 64 3 : 1 2 4 8 r8mat_det_4d computes determinant: -2592 Exact determinant is -2592 r8mat_solve_test(): r8mat_solve() solves linear systems. The linear system: Col: 0 1 2 3 4 Row 0 : 1 2 3 14 7 1 : 4 5 6 32 16 2 : 7 8 0 23 7 Factored matrix and solutions: Col: 0 1 2 3 4 Row 0 : 1 0 0 1 1 1 : 0 1 0 2 0 2 : 0 0 1 3 2 r8vec_indicator1_test(): r8vec_indicator1() returns the 1-based indicator matrix. the 1-based indicator vector: [ 1. 2. 3. 4. 5. 6. 7. 8. 9. 10.] radec_to_xyz_test(): xyz_to_radec() converts RADEC to XYZ coordinates. radec_to_xyz() converts XYZ to RADEC coordinates. P1 RA DEC P2 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 1.000000 0.000000 6.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 1.000000 0.000000 90.000000 0.000000 0.000000 1.000000 1.000000 1.000000 1.000000 3.000000 35.264390 0.577350 0.577350 0.577350 5.000000 -2.000000 -1.000000 -1.453427 -10.519735 0.912871 -0.365148 -0.182574 -2.000000 -2.000000 -2.000000 -9.000000 -35.264390 -0.577350 -0.577350 -0.577350 radians_to_degrees_test(): radians_to_degrees() converts an angle from radians to degrees. Degrees Radians Degrees -60.000000 -1.047198 -60.000000 -30.000000 -0.523599 -30.000000 0.000000 0.000000 0.000000 30.000000 0.523599 30.000000 60.000000 1.047198 60.000000 90.000000 1.570796 90.000000 120.000000 2.094395 120.000000 150.000000 2.617994 150.000000 180.000000 3.141593 180.000000 210.000000 3.665191 210.000000 240.000000 4.188790 240.000000 270.000000 4.712389 270.000000 300.000000 5.235988 300.000000 330.000000 5.759587 330.000000 360.000000 6.283185 360.000000 390.000000 6.806784 390.000000 420.000000 7.330383 420.000000 rtp_to_xyz_test(): rtp_to_xyz() converts XYZ to (R,Theta,Phi) coordinates. xyz_to_rtp() converts (R,Theta,Phi) to XYZ coordinates. X1 Y1 Z1 R THETA PHI X2 Y2 Z2 1.5494 -0.7521 2.3421 2.9072 5.8313 0.6341 1.5494 -0.7521 2.3421 -1.6397 -1.6718 1.9032 3.0175 3.9367 0.8883 -1.6397 -1.6718 1.9032 2.9510 -0.5550 0.1224 3.0052 6.0973 1.5301 2.9510 -0.5550 0.1224 -1.2908 0.9698 2.5743 3.0387 2.4972 0.5602 -1.2908 0.9698 2.5743 -1.9297 0.5156 2.6895 3.3501 2.8805 0.6388 -1.9297 0.5156 2.6895 segment_point_dist_test(): segment_point_dist() computes the distance from a point to a line segment. segment endpoint p1: [1. 2.] segment endpoint p2: [3. 4.] test point p: [2. 3.] Distance to segment = 0 test point p: [4. 5.] Distance to segment = 1.41421 test point p: [1. 4.] Distance to segment = 1.41421 test point p: [0. 0.] Distance to segment = 2.23607 segment_point_near_test(): segment_point_near() computes the nearest point from a line segment to a point in 2D. TEST = 0 P1 = 0.310339 0.226793 P2 = 0.056004 0.793402 P = 0.636440 0.569425 PN = 0.237019 0.390136 DIST = 0.437815 T = 0.288283 TEST = 1 P1 = 0.295853 0.405593 P2 = 0.372609 0.267804 P = 0.662560 0.597102 PN = 0.301280 0.395849 DIST = 0.413552 T = 0.070713 TEST = 2 P1 = 0.753239 0.717377 P2 = 0.653238 0.932164 P = 0.863620 0.920171 PN = 0.695307 0.841807 DIST = 0.185662 T = 0.579320 simplex01_volume_test(): simplex01_volume() returns the volume of the unit simplex in M dimensions. M Volume 1 1 2 0.5 3 0.166667 4 0.0416667 5 0.00833333 6 0.00138889 7 0.000198413 8 2.48016e-05 9 2.75573e-06 sphere_triangle_sides_to_angles_test(): sphere_triangle_sides_to_angles() takes the sides of a spherical triangle and determines the angles. A = 2.058867 (radians) A = 117.964369 (degrees) Correct = 117.966667 (radians) B = 1.627136 (radians) B = 93.228029 (degrees) Correct = 93.230000 (radians) C = 1.227740 (radians) C = 70.344308 (degrees) Correct = 70.343333 (radians) sphere01_area_test(): sphere01_area() returns the area of the unit sphere. sphere01_area() = 12.5664 sphere01_area_values_test(): sphere01_area_values() stores areas of the unit sphere in N dimensions. N sphere01_area(N) 1 2.0000000000000000 2 6.2831853071795862 3 12.5663706143591707 4 19.7392088021787195 5 26.3189450695716189 6 31.0062766802998198 7 33.0733617923198082 8 32.4696970113341479 9 29.6865801246483585 10 25.5016403987734499 11 20.7251426732889001 12 16.0231532262550687 13 11.8381738121826796 14 8.3897034104910890 15 5.7216492123495666 16 3.7652900857422908 17 2.3966788175913640 18 1.4786259590003079 19 0.8858104195716824 20 0.5161378278002812 sphere01_volume_values_test(): sphere01_volume_values() stores values of the sphere01_volume function. N sphere01_volume(X) 1 2.0000000000000000 2 3.1415926535897931 3 4.1887902047863914 4 4.9348022005446790 5 5.2637890139143249 6 5.1677127800499703 7 4.7247659703314007 8 4.0587121264167676 9 3.2985089027387069 10 2.5501640398773451 11 1.8841038793899001 12 1.3352627688545891 13 0.9106287547832831 14 0.5992645293207921 15 0.3814432808233045 16 0.2353306303588932 17 0.1409811069171390 18 0.0821458866111282 19 0.0466216010300885 20 0.0258068913900141 tetrahedron_barycentric_test(): tetrahedron_barycentric() converts XYZ to XSI. We are computing the XSI coordinates just to verify that the points are inside the tetrahedron. Tetrahedron vertices Row: 0 1 2 Col 0 : 1 4 3 1 : 2 4 3 2 : 1 6 3 3 : 1 4 4 (X,Y,Z) (XSI1,XSI2,XSI3,XSI4): 1.094568 4.093863 3.084492 0.774008 0.094568 0.046932 0.084492 1.113602 4.003986 3.000530 0.883875 0.113602 0.001993 0.000530 1.109142 4.021994 3.010909 0.868953 0.109142 0.010997 0.010909 1.019856 4.001986 3.005055 0.974096 0.019856 0.000993 0.005055 1.027597 4.126250 3.003492 0.905786 0.027597 0.063125 0.003492 1.058760 4.042280 3.094638 0.825462 0.058760 0.021140 0.094638 1.390585 4.012327 3.004206 0.599045 0.390585 0.006163 0.004206 1.257375 4.153063 3.089702 0.576392 0.257375 0.076532 0.089702 1.331302 4.142597 3.113295 0.484105 0.331302 0.071298 0.113295 1.045396 4.018361 3.006175 0.939249 0.045396 0.009181 0.006175 tetrahedron_centroid_test(): tetrahedron_centroid() computes the centroid of a tetrahedron Tetrahedron vertices: Row: 0 1 2 Col 0 : 0 0.942809 -0.333333 1 : -0.816496 -0.816496 -0.333333 2 : 0.816496 -0.816496 -0.333333 3 : 0 0 1 tetrahedron centroid: [ 0.0000000e+00 -1.7254575e-01 2.5000000e-07] tetrahedron_sample_test(): tetrahedron_sample() samples a tetrahedron. We are computing the XSI coordinates just to verify that the points are inside the tetrahedron. Tetrahedron vertices Row: 0 1 2 Col 0 : 1 4 3 1 : 2 4 3 2 : 1 6 3 3 : 1 4 4 (X,Y,Z) (XSI1,XSI2,XSI3,XSI4): 1.012604 4.011297 3.000189 0.981559 0.012604 0.005648 0.000189 1.536917 4.040061 3.033768 0.409285 0.536917 0.020030 0.033768 1.016093 4.002549 3.134613 0.848020 0.016093 0.001274 0.134613 1.137163 4.038036 3.001470 0.842349 0.137163 0.019018 0.001470 1.269418 4.325032 3.119828 0.448237 0.269418 0.162516 0.119828 1.323346 4.004292 3.122263 0.552245 0.323346 0.002146 0.122263 1.096641 4.096701 3.035471 0.819537 0.096641 0.048350 0.035471 1.216173 4.003883 3.114506 0.667379 0.216173 0.001941 0.114506 1.244246 4.005602 3.000465 0.752488 0.244246 0.002801 0.000465 1.207635 4.003999 3.000313 0.790053 0.207635 0.001999 0.000313 tetrahedron_volume_test(): tetrahedron_volume() computes the volume of a tetrahedron Tetrahedron vertices Row: 0 1 2 Col 0 : 0 0.942809 -0.333333 1 : -0.816496 -0.816496 -0.333333 2 : 0.816496 -0.816496 -0.333333 3 : 0 0 1 Volume = 0.638429 tp_to_xyz_test(): tp_to_xyz() converts (Theta,Phi) to normalized XYZ coordinates. xyz_to_tp() converts XYZ to (Theta,Phi) coordinates. T P X Y Z T P 4.7046 0.4590 -0.0034 -0.4430 0.8965 4.7046 0.4590 1.0067 2.4975 0.3210 0.5074 -0.7997 1.0067 2.4975 3.5920 1.3807 -0.8840 -0.4275 0.1890 3.5920 1.3807 6.0690 2.4457 0.6264 -0.1363 -0.7675 6.0690 2.4457 2.4045 2.9368 -0.1506 0.1367 -0.9791 2.4045 2.9368 1.5167 0.2758 0.0147 0.2720 0.9622 1.5167 0.2758 triangle_angles_test(): triangle_angles() computes the angles of a triangle. Triangle vertices: Row: 0 1 Col 0 : 0 1 1 : 0 0 2 : 1 0 Radians Degrees 0.785398 45 1.5708 90 0.785398 45 triangle_area_test(): triangle_area() computes the area of a triangle. Triangle vertices (columns) Col: 0 1 2 Row 0 : 0 0 1 1 : 1 0 0 Triangle area is 0.5 triangle_barycentric_test(): triangle_barycentric() converts XY coordinates to barycentric XSI coordinates in a triangle. Triangle vertices: Row: 0 1 Col 0 : 0 1 1 : 0 0 2 : 1 0 X Y XSI 0.250000 0.250000 0.500000 0.250000 0.250000 0.750000 0.250000 0.000000 0.750000 0.250000 1.000000 1.000000 -1.000000 1.000000 1.000000 11.000000 0.500000 -10.500000 11.000000 0.500000 0.000000 1.000000 -0.000000 0.000000 1.000000 0.500000 -10.000000 10.500000 0.500000 -10.000000 0.600000 0.600000 -0.200000 0.600000 0.600000 triangle_centroid_test(): triangle_centroid() computes the centroid of a triangle Triangle vertices: Row: 0 1 Col 0 : 0 0 1 : 1 0 2 : 0 1 triangle centroid: [0.33333333 0.33333333] Triangle vertices: Row: 0 1 Col 0 : 0 0 1 : 1 0 2 : 0.5 0.866025 triangle centroid: [0.5 0.28867513] Triangle vertices: Row: 0 1 Col 0 : 0 0 1 : 1 0 2 : 0.5 10 triangle centroid: [0.5 3.33333333] Triangle vertices: Row: 0 1 Col 0 : 0 0 1 : 1 0 2 : 10 2 triangle centroid: [3.66666667 0.66666667] triangle_circumcircle_test(): triangle_circumcircle() computes the circumcenter of a triangle. Triangle vertices: Row: 0 1 Col 0 : 0 0 1 : 1 0 2 : 0 1 Triangle vertices: Row: 0 1 Col 0 : 0 0 1 : 1 0 2 : 0 1 triangle_circumcenter: [0.5 0.5] Circumradius: 0.707107 Triangle vertices: Row: 0 1 Col 0 : 0 0 1 : 1 0 2 : 0.5 0.866025 Triangle vertices: Row: 0 1 Col 0 : 0 0 1 : 1 0 2 : 0.5 0.866025 triangle_circumcenter: [0.5 0.28867513] Circumradius: 0.57735 Triangle vertices: Row: 0 1 Col 0 : 0 0 1 : 1 0 2 : 0.5 10 Triangle vertices: Row: 0 1 Col 0 : 0 0 1 : 1 0 2 : 0.5 10 triangle_circumcenter: [0.5 4.9875] Circumradius: 5.0125 Triangle vertices: Row: 0 1 Col 0 : 0 0 1 : 1 0 2 : 10 2 Triangle vertices: Row: 0 1 Col 0 : 0 0 1 : 1 0 2 : 10 2 triangle_circumcenter: [ 0.5 23.5] Circumradius: 23.5053 triangle_contains_point_test() triangle_contains_point() reports if a point is inside a triangle Triangle vertices: Row: 0 1 Col 0 : 0 1 1 : 0 0 2 : 1 0 X Y Inside 0.25 0.25 True 0.75 0.25 True 1 1 False 11 0.5 False 0 1 True 0.5 -10 False 0.6 0.6 False Repeat the test, but reverse the triangle vertex ordering. Triangle vertices (reversed): Row: 0 1 Col 0 : 1 0 1 : 0 0 2 : 0 1 X Y Inside 0.25 0.25 False 0.75 0.25 False 1 1 False 11 0.5 False 0 1 False 0.5 -10 False 0.6 0.6 False triangle_contains_point_1_test() triangle_contains_point_1() reports if a point is inside a triangle Triangle vertices: Row: 0 1 Col 0 : 0 1 1 : 0 0 2 : 1 0 X Y Inside 0.25 0.25 True 0.75 0.25 True 1 1 False 11 0.5 False 0 1 True 0.5 -10 False 0.6 0.6 False Repeat the test, but reverse the triangle vertex ordering. Triangle vertices (reversed): Row: 0 1 Col 0 : 1 0 1 : 0 0 2 : 0 1 X Y Inside 0.25 0.25 True 0.75 0.25 True 1 1 False 11 0.5 False 0 1 True 0.5 -10 False 0.6 0.6 False triangle_diameter_test(): triangle_diameter() computes the diameter of the SMALLEST circle around a triangle. Triangle vertices: Row: 0 1 Col 0 : 4 2 1 : 1 5 2 : -2 2 Diameter = 6 Triangle vertices: Row: 0 1 Col 0 : 4 2 1 : 5 4 2 : 6 6 Diameter = 4.47214 Triangle vertices: Row: 0 1 Col 0 : 4 2 1 : 1 5 2 : 4 2 Diameter = 4.24264 triangle_edge_length_test(): triangle_edge_length() computes the edge lengths of a triangle. Triangle vertices: Row: 0 1 Col 0 : 4 2 1 : 1 5 2 : -2 2 triangle edge lengths: [4.24264069 4.24264069 6. ] Triangle vertices: Row: 0 1 Col 0 : 4 2 1 : 5 4 2 : 6 6 triangle edge lengths: [2.23606798 2.23606798 4.47213595] Triangle vertices: Row: 0 1 Col 0 : 4 2 1 : 1 5 2 : 4 2 triangle edge lengths: [4.24264069 4.24264069 0. ] triangle_incircle_test(): triangle_incircle() computes the incircle of a triangle. Triangle vertices: Row: 0 1 Col 0 : 0 1 1 : 0 0 2 : 1 0 triangle incenter: [0.29289322 0.29289322] Incircle radius is 0.292893 triangle_orientation_test(): triangle_orientation() determines orientation of a triangle. Triangle vertices: Row: 0 1 Col 0 : 4 2 1 : 1 5 2 : -2 2 The points are counterclockwise. Triangle vertices: Row: 0 1 Col 0 : 1 5 1 : 4 2 2 : 1 -1 The points are clockwise. Triangle vertices: Row: 0 1 Col 0 : 1 5 1 : 2 7 2 : 3 9 The points are colinear. Triangle vertices: Row: 0 1 Col 0 : 1 5 1 : 4 2 2 : 1 5 The points are not distinct. triangle_orthocenter_test(): triangle_orthocenter() computes the orthocenter of a triangle. Triangle vertices: Row: 0 1 Col 0 : 0 0 1 : 1 0 2 : 0 1 triangle orthocenter: [0. 0.] Triangle vertices: Row: 0 1 Col 0 : 0 0 1 : 1 0 2 : 0.5 0.866025 triangle orthocenter: [0.5 0.28867514] Triangle vertices: Row: 0 1 Col 0 : 0 0 1 : 1 0 2 : 0.5 10 triangle orthocenter: [0.5 0.025] Triangle vertices: Row: 0 1 Col 0 : 0 0 1 : 1 0 2 : 10 2 triangle orthocenter: [ 10. -45.] triangle_point_dist_test(): triangle_point_dist() computes the distance between a point and a triangle. Triangle vertices: Row: 0 1 Col 0 : 0 1 1 : 0 0 2 : 1 0 P DIST 0.25 0.25 0.25 0.75 0.25 0 1 1 0.707107 11 0.5 10.0125 0 1 0 0.5 -10 10 0.6 0.6 0.141421 triangle_point_near_test(): triangle_point_near() computes the nearest triangle point to a point. Triangle vertices: Row: 0 1 Col 0 : 0 1 1 : 0 0 2 : 1 0 P PN 0.25 0.25 0 0.25 0.75 0.25 0.75 0.25 1 1 0.5 0.5 11 0.5 1 0 0 1 0 1 0.5 -10 0.5 0 0.6 0.6 0.5 0.5 triangle_quality_test(): triangle_quality() computes the quality of a triangle. Triangle vertices: Row: 0 1 Col 0 : 0 0 1 : 1 0 2 : 0 1 Quality = 0.828427 Triangle vertices: Row: 0 1 Col 0 : 0 0 1 : 1 0 2 : 0.5 0.866025 Quality = 1 Triangle vertices: Row: 0 1 Col 0 : 0 0 1 : 1 0 2 : 0.5 10 Quality = 0.189775 Triangle vertices: Row: 0 1 Col 0 : 0 0 1 : 1 0 2 : 10 2 Quality = 0.00833469 triangle_reference_sample_test(): triangle_reference_sample() samples the reference triangle. Triangle vertices: Row: 0 1 Col 0 : 0 0 1 : 1 0 2 : 0 1 Sample points (X,Y) and (XSI1,XSI2,XSI3) coordinates: 0.326317 0.142153 0.53153 0.326317 0.142153 0.186897 0.130322 0.682781 0.186897 0.130322 0.0802376 0.708782 0.21098 0.0802376 0.708782 0.105454 0.0508712 0.843675 0.105454 0.0508712 0.69974 0.235264 0.0649954 0.69974 0.235264 0.0190054 0.827784 0.153211 0.0190054 0.827784 0.477005 0.297765 0.22523 0.477005 0.297765 0.18603 0.288658 0.525312 0.18603 0.288658 0.214878 0.259113 0.526009 0.214878 0.259113 0.319517 0.0830342 0.597449 0.319517 0.0830342 triangle_sample_test(): triangle_sample() samples a triangle. Triangle vertices: Row: 0 1 Col 0 : 4 2 1 : 1 5 2 : -2 2 Sample points (X,Y) and (XSI1,XSI2,XSI3) coordinates: 1.03346 3.70503 0.221403 0.568345 0.210252 0.868225 3.27387 0.265727 0.424622 0.309652 -0.00639793 2.3243 0.278218 0.108098 0.613684 -0.975869 2.92751 0.0161029 0.309171 0.674726 0.547519 3.37299 0.195756 0.457662 0.346583 1.47056 3.04281 0.404625 0.347604 0.24777 1.51556 2.14411 0.561909 0.0480356 0.390055 0.508268 2.37828 0.354998 0.126094 0.518908 1.26943 3.29659 0.328807 0.432196 0.238997 0.112685 3.9762 0.0227469 0.658735 0.318518 triangle_xsi_to_xy_test(): triangle_xsi_to_xy() converts XSI to XY coordinates. We verify that (X,Y) -> (XSI1,XSI2,XSI3) -> (X,Y) works properly. Triangle vertices: Row: 0 1 Col 0 : 4 2 1 : 1 5 2 : -2 2 Sample points: 1 3 0.333333 0.333333 0.333333 1 3 3 0 1.16667 -0.666667 0.5 3 2.22045e-16 0.0851228 3.38859 0.116088 0.462864 0.421048 0.0851228 3.38859 0.728937 3.4093 0.21994 0.469765 0.310295 0.728937 3.4093 -0.257328 2.79942 0.157209 0.266472 0.576319 -0.257328 2.79942 -0.967622 2.27297 0.126567 0.0909912 0.782441 -0.967622 2.27297 0.418996 2.32624 0.348793 0.108746 0.542461 0.418996 2.32624 0.739027 2.99481 0.290703 0.331602 0.377694 0.739027 2.99481 1.84937 3.95639 0.315498 0.652129 0.0323731 1.84937 3.95639 1.43094 4.47903 0.158651 0.826344 0.0150048 1.43094 4.47903 triangle_xy_to_xsi_test(): triangle_xy_to_xsi() converts XY to XSI coordinates. Verify that (X,Y) -> (XSI1,XSI2,XSI3) -> (X,Y) works properly. Triangle vertices: Row: 0 1 Col 0 : 4 2 1 : 1 5 2 : -2 2 Sample points: 1 3 0.333333 0.333333 0.333333 1 3 3 0 1.16667 -0.666667 0.5 3 2.22045e-16 0.0972683 3.18904 0.151371 0.396346 0.452282 0.0972683 3.18904 0.99412 3.53126 0.243811 0.510419 0.245771 0.99412 3.53126 -1.59964 2.06138 0.0564964 0.0204594 0.923044 -1.59964 2.06138 -0.463138 2.71764 0.136537 0.239213 0.62425 -0.463138 2.71764 0.68282 3.6597 0.170521 0.553232 0.276247 0.68282 3.6597 -0.799565 3.17703 0.00390059 0.392344 0.603756 -0.799565 3.17703 0.456455 2.3059 0.358426 0.101966 0.539608 0.456455 2.3059 1.80408 3.67824 0.354306 0.559414 0.0862803 1.80408 3.67824 triangle01_area_test(): triangle01_area() computes the area of the unit triangle. Triangle vertices (columns) Col: 0 1 2 Row 0 : 0 0 1 1 : 1 0 0 Triangle area is 0.5 triangle01_sample_test(): triangle01_sample() samples the unit triangle. Triangle vertices: Row: 0 1 Col 0 : 0 1 1 : 0 0 2 : 1 0 Sample points (X,Y): Sample points: Row: 0 1 Col 0 : 0.257272 0.307753 1 : 0.04733 0.2481 2 : 0.553432 0.172693 3 : 0.0734779 0.574007 4 : 0.475348 0.323481 5 : 0.76771 0.176583 6 : 0.0416226 0.390406 7 : 0.291082 0.108131 8 : 0.307748 0.472232 9 : 0.746163 0.251777 triangle_3d_area_cross_product_test(): triangle_3d_area_cross_product() computes the area of a triangle in 3D. Triangle vertices: [[1. 2. 3. ] [2.4142137 3.4142137 3. ] [1.7071068 2.7071068 4. ]] Computed area is 1.0000000973169176 triangle_3d_area_heron_test(): triangle_3d_area_heron() computes the area of a triangle in 3D. Triangle vertices: [[1. 2. 3. ] [2.4142137 3.4142137 3. ] [1.7071068 2.7071068 4. ]] Computed area is 1.0000000973169179 wedge01_volume_test(): wedge01_volume() returns the volume of the unit wedge. wedge01_volume() = 1 xy_to_polar_test(): xy_to_polar() converts (X,Y) to (R,Theta). polar_to_xy() converts (R,Theta) to (X,Y); X Y ===> R T => X Y -0.240753 -0.323138 0.402965 4.072065 -0.240753 -0.323138 -0.462314 1.191171 1.277741 1.941017 -0.462314 1.191171 0.874730 1.534869 1.766628 1.052799 0.874730 1.534869 -0.051478 -0.812319 0.813949 4.649102 -0.051478 -0.812319 0.184653 -2.465388 2.472293 4.787148 0.184653 -2.465388 -0.007640 -0.694479 0.694521 4.701388 -0.007640 -0.694479 -0.911985 0.512863 1.046301 2.629310 -0.911985 0.512863 -1.921699 1.790696 2.626693 2.391468 -1.921699 1.790696 0.873098 1.098702 1.403370 0.899318 0.873098 1.098702 -0.552591 -1.263166 1.378747 4.300008 -0.552591 -1.263166 xyz_to_radec_test(): xyz_to_radec() converts RADEC to XYZ coordinates. radec_to_xyz() converts XYZ to RADEC coordinates. P1 RA DEC P2 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 1.000000 0.000000 6.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 1.000000 0.000000 90.000000 0.000000 0.000000 1.000000 1.000000 1.000000 1.000000 3.000000 35.264390 0.577350 0.577350 0.577350 5.000000 -2.000000 -1.000000 -1.453427 -10.519735 0.912871 -0.365148 -0.182574 -2.000000 -2.000000 -2.000000 -9.000000 -35.264390 -0.577350 -0.577350 -0.577350 xyz_to_rtp_test(): xyz_to_rtp() converts (R,Theta,Phi) to XYZ coordinates. rtp_to_xyz() converts XYZ to (R,Theta,Phi) coordinates. X1 Y1 Z1 R THETA PHI X2 Y2 Z2 2.8457 -0.8817 0.7962 3.0837 5.9827 1.3096 2.8457 -0.8817 0.7962 -0.2802 -1.4165 1.0456 1.7828 4.5171 0.9440 -0.2802 -1.4165 1.0456 0.9560 -1.4036 0.0068 1.6983 5.3103 1.5668 0.9560 -1.4036 0.0068 1.4975 -0.0434 0.4352 1.5600 6.2542 1.2881 1.4975 -0.0434 0.4352 -0.7661 -1.0585 1.8667 2.2786 4.0859 0.6107 -0.7661 -1.0585 1.8667 xyz_to_tp_test(): xyz_to_tp() converts XYZ to (Theta,Phi) coordinates. tp_to_xyz() converts (Theta,Phi) to normalized XYZ coordinates. P1 T P P2 -0.394734 -0.295890 0.869847 3.784834 0.515903 -0.394734 -0.295890 0.869847 0.980769 -0.194692 0.013691 6.087224 1.557105 0.980769 -0.194692 0.013691 -0.666153 0.195756 -0.719666 2.855778 2.374118 -0.666153 0.195756 -0.719666 0.431486 -0.016984 -0.901960 6.243843 2.695083 0.431486 -0.016984 -0.901960 -0.953743 0.024881 -0.299591 3.115511 1.875060 -0.953743 0.024881 -0.299591 -0.081048 -0.991469 -0.102084 4.630825 1.673058 -0.081048 -0.991469 -0.102084 geometry_test(): Normal end of execution. Sun Aug 13 09:46:54 2023