Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenlib/intern/delaunay_2d.cc')
-rw-r--r--source/blender/blenlib/intern/delaunay_2d.cc45
1 files changed, 22 insertions, 23 deletions
diff --git a/source/blender/blenlib/intern/delaunay_2d.cc b/source/blender/blenlib/intern/delaunay_2d.cc
index 842e6cb6135..53e881a9fc7 100644
--- a/source/blender/blenlib/intern/delaunay_2d.cc
+++ b/source/blender/blenlib/intern/delaunay_2d.cc
@@ -25,10 +25,11 @@
#include <sstream>
#include "BLI_array.hh"
+#include "BLI_double2.hh"
#include "BLI_linklist.h"
#include "BLI_math_boolean.hh"
#include "BLI_math_mpq.hh"
-#include "BLI_math_vec_mpq_types.hh"
+#include "BLI_mpq2.hh"
#include "BLI_set.hh"
#include "BLI_task.hh"
#include "BLI_vector.hh"
@@ -37,8 +38,6 @@
namespace blender::meshintersect {
-using namespace blender::math;
-
/* Throughout this file, template argument T will be an
* arithmetic-like type, like float, double, or mpq_class. */
@@ -789,11 +788,11 @@ bool in_line<mpq_class>(const FatCo<mpq_class> &a,
}
vec2<mpq_class> exact_ab = b.exact - a.exact;
vec2<mpq_class> exact_ac = c.exact - a.exact;
- if (dot(exact_ab, exact_ac) < 0) {
+ if (vec2<mpq_class>::dot(exact_ab, exact_ac) < 0) {
return false;
}
vec2<mpq_class> exact_bc = c.exact - b.exact;
- return dot(exact_bc, exact_ac) >= 0;
+ return vec2<mpq_class>::dot(exact_bc, exact_ac) >= 0;
}
#endif
@@ -802,11 +801,11 @@ bool in_line<double>(const FatCo<double> &a, const FatCo<double> &b, const FatCo
{
vec2<double> ab = b.approx - a.approx;
vec2<double> ac = c.approx - a.approx;
- if (dot(ab, ac) < 0) {
+ if (vec2<double>::dot(ab, ac) < 0) {
return false;
}
vec2<double> bc = c.approx - b.approx;
- return dot(bc, ac) >= 0;
+ return vec2<double>::dot(bc, ac) >= 0;
}
template<> CDTVert<double>::CDTVert(const vec2<double> &pt)
@@ -1082,7 +1081,7 @@ template<typename T> CDTEdge<T> *CDTArrangement<T>::split_edge(SymEdge<T> *se, T
SymEdge<T> *sesymprev = prev(sesym);
SymEdge<T> *sesymprevsym = sym(sesymprev);
SymEdge<T> *senext = se->next;
- CDTVert<T> *v = this->add_vert(interpolate(*a, *b, lambda));
+ CDTVert<T> *v = this->add_vert(vec2<T>::interpolate(*a, *b, lambda));
CDTEdge<T> *e = this->add_edge(v, se->next->vert, se->face, sesym->face);
sesym->vert = v;
SymEdge<T> *newse = &e->symedges[0];
@@ -1705,16 +1704,16 @@ void fill_crossdata_for_intersect(const FatCo<T> &curco,
BLI_assert(se_vcva->vert == vc && se_vcva->next->vert == va);
BLI_assert(se_vcvb->vert == vc && se_vcvb->next->vert == vb);
UNUSED_VARS_NDEBUG(vc);
- auto isect = isect_seg_seg<vec2<T>>(va->co.exact, vb->co.exact, curco.exact, v2->co.exact);
+ auto isect = vec2<T>::isect_seg_seg(va->co.exact, vb->co.exact, curco.exact, v2->co.exact);
T &lambda = isect.lambda;
switch (isect.kind) {
- case isect_result<vec2<T>>::LINE_LINE_CROSS: {
+ case vec2<T>::isect_result::LINE_LINE_CROSS: {
#ifdef WITH_GMP
if (!std::is_same<T, mpq_class>::value) {
#else
if (true) {
#endif
- double len_ab = distance(va->co.approx, vb->co.approx);
+ double len_ab = vec2<double>::distance(va->co.approx, vb->co.approx);
if (lambda * len_ab <= epsilon) {
fill_crossdata_for_through_vert(va, se_vcva, cd, cd_next);
}
@@ -1736,7 +1735,7 @@ void fill_crossdata_for_intersect(const FatCo<T> &curco,
}
break;
}
- case isect_result<vec2<T>>::LINE_LINE_EXACT: {
+ case vec2<T>::isect_result::LINE_LINE_EXACT: {
if (lambda == 0) {
fill_crossdata_for_through_vert(va, se_vcva, cd, cd_next);
}
@@ -1751,7 +1750,7 @@ void fill_crossdata_for_intersect(const FatCo<T> &curco,
}
break;
}
- case isect_result<vec2<T>>::LINE_LINE_NONE: {
+ case vec2<T>::isect_result::LINE_LINE_NONE: {
#ifdef WITH_GMP
if (std::is_same<T, mpq_class>::value) {
BLI_assert(false);
@@ -1767,9 +1766,9 @@ void fill_crossdata_for_intersect(const FatCo<T> &curco,
}
break;
}
- case isect_result<vec2<T>>::LINE_LINE_COLINEAR: {
- if (distance_squared(va->co.approx, v2->co.approx) <=
- distance_squared(vb->co.approx, v2->co.approx)) {
+ case vec2<T>::isect_result::LINE_LINE_COLINEAR: {
+ if (vec2<double>::distance_squared(va->co.approx, v2->co.approx) <=
+ vec2<double>::distance_squared(vb->co.approx, v2->co.approx)) {
fill_crossdata_for_through_vert(va, se_vcva, cd, cd_next);
}
else {
@@ -1846,7 +1845,7 @@ void get_next_crossing_from_edge(CrossData<T> *cd,
{
CDTVert<T> *va = cd->in->vert;
CDTVert<T> *vb = cd->in->next->vert;
- vec2<T> curco = interpolate(va->co.exact, vb->co.exact, cd->lambda);
+ vec2<T> curco = vec2<T>::interpolate(va->co.exact, vb->co.exact, cd->lambda);
FatCo<T> fat_curco(curco);
SymEdge<T> *se_ac = sym(cd->in)->next;
CDTVert<T> *vc = se_ac->next->vert;
@@ -2387,7 +2386,7 @@ template<typename T> void remove_non_constraint_edges_leave_valid_bmesh(CDT_stat
dissolvable_edges[i].e = e;
const vec2<double> &co1 = e->symedges[0].vert->co.approx;
const vec2<double> &co2 = e->symedges[1].vert->co.approx;
- dissolvable_edges[i].len_squared = distance_squared(co1, co2);
+ dissolvable_edges[i].len_squared = vec2<double>::distance_squared(co1, co2);
i++;
}
}
@@ -2570,18 +2569,18 @@ template<typename T> void detect_holes(CDT_state<T> *cdt_state)
if (e->symedges[0].face->visit_index == e->symedges[1].face->visit_index) {
continue; /* Don't count hits on edges between faces in same region. */
}
- auto isect = isect_seg_seg<vec2<T>>(ray_end.exact,
+ auto isect = vec2<T>::isect_seg_seg(ray_end.exact,
mid.exact,
e->symedges[0].vert->co.exact,
e->symedges[1].vert->co.exact);
switch (isect.kind) {
- case isect_result<vec2<T>>::LINE_LINE_CROSS: {
+ case vec2<T>::isect_result::LINE_LINE_CROSS: {
hits++;
break;
}
- case isect_result<vec2<T>>::LINE_LINE_EXACT:
- case isect_result<vec2<T>>::LINE_LINE_NONE:
- case isect_result<vec2<T>>::LINE_LINE_COLINEAR:
+ case vec2<T>::isect_result::LINE_LINE_EXACT:
+ case vec2<T>::isect_result::LINE_LINE_NONE:
+ case vec2<T>::isect_result::LINE_LINE_COLINEAR:
break;
}
}