Sat Jan 11 14:52:20 2025 triangle_test(): python version: 3.10.12 numpy version: 1.26.4 Test triangle(). 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 segment_point_dist_2d_test segment_point_dist_2d computes the distance from a point to a line segment. Segment endpoint 1: [1. 2.] Segment endpoint 2: [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 triangle_angles_test triangle_angles computes the angles of a triangle. Triangle vertices: [[0. 0. 1.] [1. 0. 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: [[0. 0. 1.] [1. 0. 0.]] Triangle area is 0.5 triangle_centroid_test triangle_centroid computes the centroid of a triangle Triangle vertices: [[0. 1. 0.] [0. 0. 1.]] Centroid: [0.33333333 0.33333333] Triangle vertices: [[0. 1. 0.5 ] [0. 0. 0.86602539]] Centroid: [0.5 0.28867513] Triangle vertices: [[ 0. 1. 0.5] [ 0. 0. 10. ]] Centroid: [0.5 3.33333333] Triangle vertices: [[ 0. 1. 10.] [ 0. 0. 2.]] Centroid: [3.66666667 0.66666667] triangle_circumcircle_test triangle_circumcircle computes the circumcenter of a triangle. Triangle vertices: [[0. 1. 0.] [0. 0. 1.]] Circumcenter: [0.5 0.5] Circumradius: 0.707107 Triangle vertices: [[0. 1. 0.5 ] [0. 0. 0.86602539]] Circumcenter: [0.5 0.28867513] Circumradius: 0.57735 Triangle vertices: [[ 0. 1. 0.5] [ 0. 0. 10. ]] Circumcenter: [0.5 4.9875] Circumradius: 5.0125 Triangle vertices: [[ 0. 1. 10.] [ 0. 0. 2.]] 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: [[0. 0. 1.] [1. 0. 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): [[1. 0. 0.] [0. 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_diameter_test triangle_diameter computes the diameter of the SMALLEST circle around a triangle. Triangle vertices: [[ 4. 1. -2.] [ 2. 5. 2.]] Diameter = 6 Triangle vertices: [[4. 5. 6.] [2. 4. 6.]] Diameter = 4.47214 Triangle vertices: [[4. 1. 4.] [2. 5. 2.]] Diameter = 4.24264 triangle_edge_length_test triangle_edge_length computes the edge lengths of a triangle. Triangle vertices: [[ 4. 1. -2.] [ 2. 5. 2.]] edge lengths: [4.24264069 4.24264069 6. ] Triangle vertices: [[4. 5. 6.] [2. 4. 6.]] edge lengths: [2.23606798 2.23606798 4.47213595] Triangle vertices: [[4. 1. 4.] [2. 5. 2.]] edge lengths: [4.24264069 4.24264069 0. ] triangle_incircle_test triangle_incircle computes the incircle of a triangle. Triangle vertices: [[0. 0. 1.] [1. 0. 0.]] incenter: [0.29289322 0.29289322] Incircle radius is 0.292893 triangle_orientation_test triangle_orientation_determines orientation of a triangle. Triangle vertices: [[ 4. 1. -2.] [ 2. 5. 2.]] The points are counterclockwise. Triangle vertices: [[ 1. 4. 1.] [ 5. 2. -1.]] The points are clockwise. Triangle vertices: [[1. 2. 3.] [5. 7. 9.]] The points are colinear. Triangle vertices: [[1. 4. 1.] [5. 2. 5.]] The points are not distinct. triangle_orthocenter_test triangle_orthocenter computes the orthocenter of a triangle. Triangle vertices: [[0. 1. 0.] [0. 0. 1.]] orthocenter: [0. 0.] Triangle vertices: [[0. 1. 0.5 ] [0. 0. 0.86602539]] orthocenter: [0.5 0.28867514] Triangle vertices: [[ 0. 1. 0.5] [ 0. 0. 10. ]] orthocenter: [0.5 0.025] Triangle vertices: [[ 0. 1. 10.] [ 0. 0. 2.]] orthocenter: [ 10. -45.] triangle_point_dist_test triangle_point_dist computes the distance between a point and a triangle. Triangle vertices: [[0. 0. 1.] [1. 0. 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: [[0. 0. 1.] [1. 0. 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 Python version: 3.10.12 triangle_quality computes the quality of a triangle. Triangle vertices: [[0. 1. 0.] [0. 0. 1.]] Quality = 0.828427 Triangle vertices: [[0. 1. 0.5 ] [0. 0. 0.86602539]] Quality = 1 Triangle vertices: [[ 0. 1. 0.5] [ 0. 0. 10. ]] Quality = 0.189775 Triangle vertices: [[ 0. 1. 10.] [ 0. 0. 2.]] Quality = 0.00833469 triangle_reference_sample_test(): triangle_reference_sample() samples the reference triangle. Triangle vertices: [[0. 1. 0.] [0. 0. 1.]] Sample points (X,Y) and (XSI1,XSI2,XSI3) coordinates: 0.648955 0.00282668 0.348218 0.648955 0.00282668 0.239176 0.585802 0.175022 0.239176 0.585802 0.5237 0.185116 0.291183 0.5237 0.185116 0.113971 0.734113 0.151916 0.113971 0.734113 0.430352 0.212863 0.356785 0.430352 0.212863 0.297991 0.571283 0.130726 0.297991 0.571283 0.113485 0.268055 0.618461 0.113485 0.268055 0.77563 0.115682 0.108688 0.77563 0.115682 0.236341 0.0643063 0.699353 0.236341 0.0643063 0.10123 0.549655 0.349115 0.10123 0.549655 triangle_sample_test(): triangle_sample() samples a triangle. Triangle vertices: [[ 4. 1. -2.] [ 2. 5. 2.]] Sample points (X,Y) and (XSI1,XSI2,XSI3) coordinates: 0.257115 4.05845 0.0331103 0.686151 0.280739 -0.0507395 3.40002 0.0915407 0.466672 0.441787 3.00436 2.70906 0.715883 0.236354 0.0477631 1.81688 3.03881 0.463011 0.34627 0.190718 1.13862 3.90431 0.205718 0.634769 0.159513 2.06508 3.79915 0.377655 0.599717 0.0226276 1.14161 3.52725 0.269059 0.509085 0.221857 0.240616 3.92456 0.0526762 0.64152 0.305804 2.02987 2.44807 0.596967 0.149357 0.253676 -0.610504 2.05315 0.222724 0.0177176 0.759559 triangle_sample_reflect_test(): triangle_sample_reflect() samples a triangle using reflection. Triangle vertices: [[ 4. 2.] [ 1. 5.] [-2. 2.]] Sample points (X,Y) and (XSI1,XSI2,XSI3) coordinates: 1.04681 3.58053 0.244379 0.526844 0.228777 0.797419 2.01949 0.462989 0.00649569 0.530516 3.04367 2.47324 0.761737 0.157747 0.0805152 2.30724 3.11639 0.531808 0.372129 0.0960631 -0.18333 3.06394 0.125455 0.354646 0.519899 2.07467 2.31438 0.626714 0.104795 0.268491 2.2233 2.31486 0.651407 0.104952 0.243641 0.753524 4.51345 0.0400118 0.837818 0.122171 0.368105 4.34117 0.00448861 0.780391 0.21512 1.17985 3.03715 0.357116 0.345718 0.297167 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: [[ 4. 1. -2.] [ 2. 5. 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.315387 2.80908 0.251051 0.269694 0.479255 0.315387 2.80908 0.0429052 2.05819 0.330786 0.0193955 0.649818 0.0429052 2.05819 1.05235 2.6687 0.397274 0.222901 0.379825 1.05235 2.6687 -0.415215 3.35267 0.038685 0.450892 0.510423 -0.415215 3.35267 0.927782 2.75297 0.362468 0.250991 0.386541 0.927782 2.75297 2.09236 3.71672 0.39594 0.572239 0.0318211 2.09236 3.71672 -0.695183 2.0155 0.214885 0.0051683 0.779946 -0.695183 2.0155 2.42346 3.38613 0.506223 0.462042 0.0317354 2.42346 3.38613 triangle_xy_to_xsi_test triangle_xy_to_xsi converts XY to XSI coordinates. We verify that (X,Y) -> (XSI1,XSI2,XSI3) -> (X,Y) works properly. Triangle vertices: [[ 4. 1. -2.] [ 2. 5. 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.816244 2.45111 0.122108 0.150369 0.727523 -0.816244 2.45111 0.135848 2.77587 0.226662 0.258625 0.514713 0.135848 2.77587 1.78596 2.53644 0.541587 0.178812 0.279601 1.78596 2.53644 1.14226 2.95224 0.365004 0.317412 0.317584 1.14226 2.95224 2.22004 3.48279 0.456209 0.494263 0.0495285 2.22004 3.48279 -0.310808 3.34935 0.0566398 0.449785 0.493576 -0.310808 3.34935 -0.0317077 2.6049 0.227233 0.201632 0.571135 -0.0317077 2.6049 0.385984 3.13767 0.208052 0.379223 0.412724 0.385984 3.13767 triangle_test(): Normal end of execution. Sat Jan 11 14:52:20 2025