08 May 2022 11:05:31 AM tetrahedron_test: C++ version Test tetrahedron() 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 0 0 2 2 1 1 3 1 2 1 4 0 1 0 Exact area is 2.44949 The computed area is 2.44949 The polygon vertices: Row: 1 2 3 Col 1 0 0 0 2 2.62679 1.26009 -0.715657 3 1.48153 3.973 -0.142512 4 0.605932 3.55297 0.0960401 5 1.36944 1.74437 -0.286056 6 0.493842 1.32433 -0.0475041 7 0.11209 2.22864 0.143544 8 -0.763505 1.80861 0.382097 Exact area is 6 The computed area is 6 tetrahedron_barycentric_test(): tetrahedron_barycentric() converts Cartesian to barycentric coordinates. We are computing the barycentric coordinates just to verify that the points are inside the tetrahedron. Tetrahedron vertices Row: 1 2 3 Col 1 1 4 3 2 2 4 3 3 1 6 3 4 1 4 4 P Barycentric: 1.0133 4.97705 3.10041 0.397769 0.0133003 0.488523 0.100407 1.29337 4.07031 3.49657 0.174912 0.293366 0.0351568 0.496566 1.42528 4.01849 3.20174 0.363738 0.425279 0.00924717 0.201736 1.64562 4.19189 3.11749 0.140943 0.645625 0.0959462 0.117486 1.09683 5.02176 3.12989 0.262393 0.0968335 0.510881 0.129893 1.00645 4.08141 3.07535 0.877498 0.00644768 0.0407064 0.0753482 1.4024 4.09134 3.00749 0.54444 0.4024 0.0456696 0.00749041 1.61269 4.00498 3.32868 0.056144 0.612693 0.00248782 0.328675 1.02858 4.13865 3.54059 0.361502 0.0285791 0.0693259 0.540593 1.06555 4.34207 3.46924 0.294179 0.0655487 0.171037 0.469235 tetrahedron_centroid_test(): tetrahedron_centroid() computes the centroid; Tetrahedron vertices: Row: 1 2 3 Col 1 0 0.942809 -0.333333 2 -0.816496 -0.816496 -0.333333 3 0.816496 -0.816496 -0.333333 4 0 0 1 Centroid: 0 0 1 -0.172546 2 2.5e-07 tetrahedron_contains_point_test(): tetrahedron_contains_point() finds if a point is inside; Tetrahedron vertices: Row: 1 2 3 Col 1 0 0.942809 -0.333333 2 -0.816496 -0.816496 -0.333333 3 0.816496 -0.816496 -0.333333 4 0 0 1 P Inside_Tetra? 0.0816496 -0.244949 0.6 1 -1.46969 -3.02194 -0.2 0 -0.898146 0.672598 -0.2 0 tetrahedron_circumsphere_test(): tetrahedron_circumsphere() computes the circumsphere; Tetrahedron vertices: Row: 1 2 3 Col 1 0.57735 0 0 2 -0.288675 0.5 0 3 -0.288675 -0.5 0 4 0 0 0.816497 Circumsphere center: 0 1.11022e-16 1 0 2 0.204124 Circumsphere radius is 0.612372 tetrahedron_edge_length_test(): tetrahedron_edge_length() computes the edge lengths; Tetrahedron vertices: Row: 1 2 3 Col 1 0.57735 0 0 2 -0.288675 0.5 0 3 -0.288675 -0.5 0 4 0 0 0.816497 Edge lengths: 0 1 1 1 2 1 3 1 4 1 5 1 tetrahedron_insphere_test(): tetrahedron_insphere() computes the insphere; Tetrahedron vertices: Row: 1 2 3 Col 1 0.57735 0 0 2 -0.288675 0.5 0 3 -0.288675 -0.5 0 4 0 0 0.816497 Insphere center: 0 -3.20494e-17 1 0 2 0.204124 Insphere radius is 0.204124 tetrahedron_lattice_layer_point_next_test(): tetrahedron_lattice_layer_point_next() returns the next point in a tetrahedron lattice layer defined by: C[3] - 1 < X[0]/C[0] + X[1]/C[1] +X[2]/C[2] <= C[3]. 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. tetrahedron_lattice_point_next_test(): tetrahedron_lattice_point_next() returns the next lattice point in a tetrahedron defined by: 0 <= X(1)/C(1) + X(2)/C(2) + X(3)/C(3) <= C(4). N = 3 C = 4 3 2 1 1 0 0 0 2 1 0 0 3 2 0 0 4 0 1 0 5 1 1 0 No more. tetrahedron_quality1_test(): tetrahedron_quality1() computes quality measure #1; Tetrahedron vertices: Row: 1 2 3 Col 1 0.57735 0 0 2 -0.288675 0.5 0 3 -0.288675 -0.5 0 4 0 0 0.816497 Tetrahedron quality is 1 Tetrahedron vertices: Row: 1 2 3 Col 1 0.57735 0 0 2 -0.288675 0.5 0 3 -0.288675 -0.5 0 4 0 0 0.408248 Tetrahedron quality is 0.732051 tetrahedron_quality2_test(): tetrahedron_quality2() computes quality measure #2; Tetrahedron vertices: Row: 1 2 3 Col 1 0.57735 0 0 2 -0.288675 0.5 0 3 -0.288675 -0.5 0 4 0 0 0.816497 Tetrahedron quality is 1 Tetrahedron vertices: Row: 1 2 3 Col 1 0.57735 0 0 2 -0.288675 0.5 0 3 -0.288675 -0.5 0 4 0 0 0.408248 Tetrahedron quality is 0.732051 tetrahedron_quality3_test(): tetrahedron_quality3() computes quality measure #3; Tetrahedron vertices: Row: 1 2 3 Col 1 0.57735 0 0 2 -0.288675 0.5 0 3 -0.288675 -0.5 0 4 0 0 0.816497 Tetrahedron quality is 1 Tetrahedron vertices: Row: 1 2 3 Col 1 0.57735 0 0 2 -0.288675 0.5 0 3 -0.288675 -0.5 0 4 0 0 0.408248 Tetrahedron quality is 0.839947 tetrahedron_quality4_test(): tetrahedron_quality4() computes quality measure #4; Tetrahedron vertices: Row: 1 2 3 Col 1 0.57735 0 0 2 -0.288675 0.5 0 3 -0.288675 -0.5 0 4 0 0 0.816497 Tetrahedron quality is 1 Tetrahedron vertices: Row: 1 2 3 Col 1 0.57735 0 0 2 -0.288675 0.5 0 3 -0.288675 -0.5 0 4 0 0 0.408248 Tetrahedron quality is 0.62132 tetrahedron_rhombic_shape_test(): For the rhombic tetrahedron, tetrahedron_rhombic_size() returns dimension information; tetrahedron_rhombic_shape() returns face and order information. shape_print() prints this information. Number of vertices: 10 Number of edges : 6 Number of faces : 4 Maximum face order: 6 shape_print() Information about a polytope. The number of vertices is 10 Vertices: Index X Y Z 1 -0.81649658 0 0 2 0 -0.57735027 0 3 0 0.57735027 0 4 0 0 0.81649658 5 -0.40824829 -0.28867513 0 6 -0.40824829 0.28867513 0 7 -0.40824829 0 0.40824829 8 0 0 0 9 0 -0.28867513 0.40824829 10 0 0.28867513 0.40824829 The number of faces is 4 The maximum order of any face is 6 Index Order Indices of Nodes in Face 1 2 3 4 5 6 1 6 1 5 2 9 4 7 2 6 2 8 3 10 4 9 3 6 3 6 1 7 4 10 4 6 1 6 3 8 2 5 tetrahedron_sample_test(): tetrahedron_sample() samples a tetrahedron. We are computing the barycentric coordinates just to verify that the points are inside the tetrahedron. Tetrahedron vertices Row: 1 2 3 Col 1 1 4 3 2 2 4 3 3 1 6 3 4 1 4 4 P Barycentric: 1.0133003 4.9770466 3.1004072 0.39776914 0.013300321 0.48852332 0.10040722 1.2933656 4.0703136 3.4965656 0.17491194 0.29336564 0.035156813 0.4965656 1.4252794 4.0184943 3.2017357 0.36373778 0.42527936 0.0092471672 0.20173569 1.6456245 4.1918923 3.1174862 0.14094311 0.6456245 0.095946172 0.11748621 1.0968335 5.0217615 3.1298932 0.26239251 0.096833516 0.51088073 0.12989324 1.0064477 4.0814129 3.0753482 0.87749766 0.006447677 0.040706446 0.075348221 1.4024003 4.0913391 3.0074904 0.54443977 0.40240025 0.04566957 0.0074904081 1.6126931 4.0049756 3.3286751 0.056144008 0.6126931 0.0024878162 0.32867508 1.0285791 4.1386518 3.5405933 0.36150173 0.028579099 0.069325881 0.54059329 1.0655487 4.342075 3.4692352 0.29417871 0.065548659 0.17103748 0.46923515 tetrahedron_shape_test(): tetrahedron_size() returns dimension information; tetrahedron_shape() returns face and order information. shape_print() prints this information. Number of vertices: 4 Number of edges : 12 Number of faces : 4 Maximum face order: 3 shape_print() Information about a polytope. The number of vertices is 4 Vertices: Index X Y Z 1 0.942809 0 -0.333333 2 -0.471405 0.816497 -0.333333 3 -0.471405 -0.816497 -0.333333 4 0 0 1 The number of faces is 4 The maximum order of any face is 3 Index Order Indices of Nodes in Face 1 2 3 1 3 1 3 2 2 3 1 2 4 3 3 1 4 3 4 3 2 3 4 tetrahedron_solid_angles_test() tetrahedron_solid_angles() computes the solid angles associated with the vertices of a tetrahedron in 3D. Tetrahedron #1 Row: 1 2 3 Col 1 0 0.942809 -0.333333 2 -0.816496 -0.816496 -0.333333 3 0.816496 -0.816496 -0.333333 4 0 0 1 Solid angles for tetrahedron #1 0 0.45508702 1 0.53565626 2 0.53565626 3 0.64102502 Tetrahedron #2 Row: 1 2 3 Col 1 0 0 0 2 1 0 0 3 0 1 0 4 0 0 1 Solid angles for tetrahedron #2 0 1.5707963 1 0.33983691 2 0.33983691 3 0.33983691 Tetrahedron #3 Row: 1 2 3 Col 1 0 0 0 2 1 0 0 3 0 2 0 4 0 0 4 Solid angles for tetrahedron #3 0 1.5707963 1 0.89917491 2 0.2897517 3 0.058106238 Tetrahedron #4 Row: 1 2 3 Col 1 0 0 0 2 1 0 0 3 0 1 0 4 1 1 1 Solid angles for tetrahedron #4 0 0.52359878 1 0.44556125 2 0.44556125 3 0.18376187 tetrahedron_volume_test(): tetrahedron_volume() computes the volume; Tetrahedron vertices Row: 1 2 3 Col 1 0 0.942809 -0.333333 2 -0.816496 -0.816496 -0.333333 3 0.816496 -0.816496 -0.333333 4 0 0 1 Volume = 0.63842895 tetrahedron_test(): Normal end of execution. 08 May 2022 11:05:31 AM