28 switch (
size(collection))
30 case 3: list[2] = collection[2].GetIndexPair();
31 case 2: list[1] = collection[1].GetIndexPair();
32 case 1: list[0] = collection[0].GetIndexPair();
39 switch (
size(simplexEdges))
49 const auto sgn =
Cross(e12, -e0);
56 assert(
size(simplexEdges) < 4);
67 assert(s0.GetIndexPair() != s1.GetIndexPair() || s0 == s1);
95 const auto e12 = w2 - w1;
98 const auto d12_2 = -
Dot(w1, e12);
106 const auto d12_1 =
Dot(w2, e12);
114 const auto inv_sum =
Real{1} / (d12_1 + d12_2);
115 return Simplex{{s0, s1}, {d12_1 * inv_sum, d12_2 * inv_sum}};
136 const auto e12 = w2 - w1;
137 const auto d12_1 =
Dot(w2, e12);
138 const auto d12_2 = -
Dot(w1, e12);
144 const auto e13 = w3 - w1;
145 const auto d13_1 =
Dot(w3, e13);
146 const auto d13_2 = -
Dot(w1, e13);
152 const auto e23 = w3 - w2;
153 const auto d23_1 =
Dot(w3, e23);
154 const auto d23_2 = -
Dot(w2, e23);
157 if ((d12_2 <= 0_m2) && (d13_2 <= 0_m2))
163 if ((d12_1 <= 0_m2) && (d23_2 <= 0_m2))
169 if ((d13_1 <= 0_m2) && (d23_1 <= 0_m2))
175 const auto n123 =
Cross(e12, e13);
178 const auto cp_w1_w2 =
Cross(w1, w2);
179 const auto d123_3 = n123 * cp_w1_w2;
182 const auto inv_sum =
Real{1} / (d12_1 + d12_2);
183 return Simplex{{s0, s1}, {d12_1 * inv_sum, d12_2 * inv_sum}};
187 const auto cp_w3_w1 =
Cross(w3, w1);
188 const auto d123_2 = n123 * cp_w3_w1;
191 const auto inv_sum =
Real{1} / (d13_1 + d13_2);
192 return Simplex{{s0, s2}, {d13_1 * inv_sum, d13_2 * inv_sum}};
196 const auto cp_w2_w3 =
Cross(w2, w3);
197 const auto d123_1 = n123 * cp_w2_w3;
200 const auto inv_sum =
Real{1} / (d23_1 + d23_2);
201 return Simplex{{s2, s1}, {d23_2 * inv_sum, d23_1 * inv_sum}};
205 const auto inv_sum =
Real{1} / (d123_1 + d123_2 + d123_3);
206 return Simplex{{s0, s1, s2}, {d123_1 * inv_sum, d123_2 * inv_sum, d123_3 * inv_sum}};
211 const auto count = edges.
size();
215 case 1:
return Get(edges[0]);
216 case 2:
return Get(edges[0], edges[1]);
217 case 3:
return Get(edges[0], edges[1], edges[2]);
225 assert(simplexEdges.size() < 4);
226 switch (simplexEdges.size())
228 case 1:
return Real{0};