42 #include <gtest/gtest.h> 44 #include <ACG/Math/VectorT.hh> 45 #include <ACG/Geometry/Algorithms.hh> 47 #include "../Math/MatrixTestHelper.hh" 51 TEST(Algorithms_ClosestPoints, closestPointTri_inside) {
54 ACG::Vec3d closest_point = ACG::Geometry::closestPointTri(
55 ACG::Vec3d(0.180189728737, 0.284434795380, 0.685222446918),
56 ACG::Vec3d(0.780881822109, -0.711405277252, 0.000000000000),
57 ACG::Vec3d(-1.080165147781, 0.470909714699, 0.000000000000),
58 ACG::Vec3d(0.663306236267, 1.208429455757, 0.000000000000)
60 EXPECT_TRUE(areClose(closest_point,
ACG::Vec3d(0.180189728737, 0.284434795380, 0.000000000000)));
63 ACG::Vec3d closest_point = ACG::Geometry::closestPointTri(
64 ACG::Vec3d(0.180189728737, 0.284434795380, 0.685222446918),
65 ACG::Vec3d(0.898327171803, -0.711405336857, 0.402669787407),
66 ACG::Vec3d(-1.138887882233, 0.470909774303, -0.511726200581),
67 ACG::Vec3d(0.738806843758, 1.208429455757, -0.109056398273)
69 EXPECT_TRUE(areClose(closest_point,
ACG::Vec3d(0.379620872542, 0.129005603666, 0.039932640059)));
72 ACG::Vec3d closest_point = ACG::Geometry::closestPointTri(
73 ACG::Vec3d(0.383401751518, -0.044320285320, -0.729106009007),
74 ACG::Vec3d(0.898327171803, -0.711405336857, 0.402669787407),
75 ACG::Vec3d(-1.138887882233, 0.470909774303, -0.511726200581),
76 ACG::Vec3d(0.738806843758, 1.208429455757, -0.109056398273)
78 EXPECT_TRUE(areClose(closest_point,
ACG::Vec3d(0.165861088939, 0.125222789570, -0.025220099004)));
82 TEST(Algorithms_ClosestPoints, closestPointTri_onEdge) {
85 ACG::Vec3d closest_point = ACG::Geometry::closestPointTri(
86 ACG::Vec3d(2.194746255875, 0.654435634613, 1.605020284653),
87 ACG::Vec3d(0.898327171803, -0.711405336857, 0.402669787407),
88 ACG::Vec3d(-1.138887882233, 0.470909774303, -0.511726200581),
89 ACG::Vec3d(0.738806843758, 1.208429455757, -0.109056398273)
91 EXPECT_TRUE(areClose(closest_point,
ACG::Vec3d(0.826052171821, 0.158427751505, 0.170818395715)));
94 ACG::Vec3d closest_point = ACG::Geometry::closestPointTri(
95 ACG::Vec3d(-1.639497995377, -1.687432765961, 0.645231306553),
96 ACG::Vec3d(0.898327171803, -0.711405336857, 0.402669787407),
97 ACG::Vec3d(-1.138887882233, 0.470909774303, -0.511726200581),
98 ACG::Vec3d(0.738806843758, 1.208429455757, -0.109056398273)
100 EXPECT_TRUE(areClose(closest_point,
ACG::Vec3d(-0.312445889897, -0.008722876212, -0.140780953244)));
103 ACG::Vec3d closest_point = ACG::Geometry::closestPointTri(
104 ACG::Vec3d(-0.954960584641, 3.141639709473, -0.399959266186),
105 ACG::Vec3d(0.898327171803, -0.711405336857, 0.402669787407),
106 ACG::Vec3d(-1.138887882233, 0.470909774303, -0.511726200581),
107 ACG::Vec3d(0.738806843758, 1.208429455757, -0.109056398273)
109 EXPECT_TRUE(areClose(closest_point,
ACG::Vec3d(-0.091698979114, 0.882223932862, -0.287157561834)));
112 ACG::Vec3d closest_point = ACG::Geometry::closestPointTri(
113 ACG::Vec3d(-0.326786577702, -0.595147013664, -0.012022850104),
114 ACG::Vec3d(0.898327171803, -0.711405336857, 0.402669787407),
115 ACG::Vec3d(-1.138887882233, 0.470909774303, -0.511726200581),
116 ACG::Vec3d(0.738806843758, 1.208429455757, -0.109056398273)
118 EXPECT_TRUE(areClose(closest_point,
ACG::Vec3d(-0.062953975601, -0.153517634035, -0.028797485905)));
122 TEST(Algorithms_ClosestPoints, closestPointTri_onCorner) {
124 ACG::Vec3d closest_point = ACG::Geometry::closestPointTri(
125 ACG::Vec3d(-1.840421676636, 0.351687341928, -1.691396117210),
126 ACG::Vec3d(0.898327171803, -0.711405336857, 0.402669787407),
127 ACG::Vec3d(-1.138887882233, 0.470909774303, -0.511726200581),
128 ACG::Vec3d(0.738806843758, 1.208429455757, -0.109056398273)
130 EXPECT_TRUE(areClose(closest_point,
ACG::Vec3d(-1.138887882233, 0.470909774303, -0.511726200581)));
133 ACG::Vec3d closest_point = ACG::Geometry::closestPointTri(
134 ACG::Vec3d(1.548038601875, 1.783731102943, -0.995657980442),
135 ACG::Vec3d(0.898327171803, -0.711405336857, 0.402669787407),
136 ACG::Vec3d(-1.138887882233, 0.470909774303, -0.511726200581),
137 ACG::Vec3d(0.738806843758, 1.208429455757, -0.109056398273)
139 EXPECT_TRUE(areClose(closest_point,
ACG::Vec3d(0.738806843758, 1.208429455757, -0.109056398273)));
142 ACG::Vec3d closest_point = ACG::Geometry::closestPointTri(
143 ACG::Vec3d(1.674694657326, -1.574745774269, -0.140889823437),
144 ACG::Vec3d(0.898327171803, -0.711405336857, 0.402669787407),
145 ACG::Vec3d(-1.138887882233, 0.470909774303, -0.511726200581),
146 ACG::Vec3d(0.738806843758, 1.208429455757, -0.109056398273)
148 EXPECT_TRUE(areClose(closest_point,
ACG::Vec3d(0.898327171803, -0.711405336857, 0.402669787407)));
152 TEST(Algorithms_ClosestPoints, closestPointTri_degenerate) {
154 ACG::Vec3d closest_point = ACG::Geometry::closestPointTri(
155 ACG::Vec3d(0.379400968552, -0.866840600967, -1.375681400299),
156 ACG::Vec3d(-2.827600002289, -1.685648560524, -0.758169531822),
157 ACG::Vec3d(-1.744661808014, -0.029072359204, -0.470070630312),
158 ACG::Vec3d(-0.661723732948, 1.627503752708, -0.181971758604)
160 EXPECT_TRUE(areClose(closest_point,
ACG::Vec3d(-1.568279320469, 0.240740866643, -0.423146806300)));
163 ACG::Vec3d closest_point = ACG::Geometry::closestPointTri(
164 ACG::Vec3d(0.842265009880, 3.628707885742, -0.395066857338),
165 ACG::Vec3d(-2.827600002289, -1.685648560524, -0.758169531822),
166 ACG::Vec3d(-1.744661808014, -0.029072359204, -0.470070630312),
167 ACG::Vec3d(-0.661723732948, 1.627503752708, -0.181971758604)
169 EXPECT_TRUE(areClose(closest_point,
ACG::Vec3d(-0.661723732948, 1.627503752708, -0.181971758604)));
172 ACG::Vec3d closest_point = ACG::Geometry::closestPointTri(
173 ACG::Vec3d(0.842265009880, 3.628707885742, -0.395066857338),
174 ACG::Vec3d(-1.744661808014, -0.029072359204, -0.470070600510),
175 ACG::Vec3d(-1.744661808014, -0.029072359204, -0.470070630312),
176 ACG::Vec3d(-0.661723732948, 1.627503752708, -0.181971758604)
178 EXPECT_TRUE(areClose(closest_point,
ACG::Vec3d(-0.661723732948, 1.627503752708, -0.181971758604)));
181 ACG::Vec3d closest_point = ACG::Geometry::closestPointTri(
182 ACG::Vec3d(-3.731231689453, -2.141752481461, -0.150896072388),
183 ACG::Vec3d(-1.744661808014, -0.029072359204, -0.470070600510),
184 ACG::Vec3d(-1.744661808014, -0.029072359204, -0.470070630312),
185 ACG::Vec3d(-0.661723732948, 1.627503752708, -0.181971758604)
187 EXPECT_TRUE(areClose(closest_point,
ACG::Vec3d(-1.744661808014, -0.029072359204, -0.470070600510)));
190 ACG::Vec3d closest_point = ACG::Geometry::closestPointTri(
191 ACG::Vec3d(-0.966588973999, 0.534245491028, 0.345366060734),
192 ACG::Vec3d(-1.744661808014, -0.029072359204, -0.470070600510),
193 ACG::Vec3d(-1.744661808014, -0.029072359204, -0.470070630312),
194 ACG::Vec3d(-0.661723732948, 1.627503752708, -0.181971758604)
196 EXPECT_TRUE(areClose(closest_point,
ACG::Vec3d(-1.200293249127, 0.803651109932, -0.325249806970)));
199 ACG::Vec3d closest_point = ACG::Geometry::closestPointTri(
200 ACG::Vec3d(-0.966588973999, 0.534245491028, 0.345366060734),
201 ACG::Vec3d(-1.744661808014, -0.029072359204, -0.470070600510),
202 ACG::Vec3d(-1.744661808014, -0.029072359204, -0.470070630312),
203 ACG::Vec3d(-1.744661808014, -0.029072403908, -0.470070600510)
205 EXPECT_TRUE(areClose(closest_point,
ACG::Vec3d(-1.744661808014, -0.029072359204, -0.470070600510)));