added assertion for checking correct orientation of the future directions

This commit is contained in:
Dmitry Anisimov 2021-06-22 13:26:53 +02:00
parent 9b341c2292
commit dfd8e81f8f
2 changed files with 20 additions and 3 deletions

View File

@ -1459,6 +1459,8 @@ public:
CGAL_assertion(pvertices[idx] == null_pvertex());
pvertices[idx] = propagated;
CGAL_assertion(is_correctly_oriented(
propagated.first, future_direction, ivertex, iedge));
// CGAL_assertion_msg(false, "TODO: CREATE NEW PVERTEX!");
}
@ -2349,8 +2351,16 @@ public:
** CHECKING PROPERTIES **
********************************/
bool belongs_to_iedge(const PVertex& /*pvertex*/, const IEdge& /*iedge*/) const {
return true; // TODO: finish this using dot products and orientations!
bool is_correctly_oriented(
const std::size_t sp_idx, const Vector_2& direction,
const IVertex& ivertex, const IEdge& iedge) const {
CGAL_assertion(direction.squared_length() != FT(0));
const auto overtex = opposite(iedge, ivertex);
const Vector_2 ref_direction(
point_2(sp_idx, ivertex), point_2(sp_idx, overtex));
const FT vec_dot = direction * ref_direction;
return (vec_dot >= FT(0));
}
template<typename Pair>

View File

@ -1716,7 +1716,8 @@ private:
m_data.direction(cropped) = future_direction;
if (m_verbose) std::cout << "- cropped: " <<
m_data.str(cropped) << ", " << m_data.point_3(cropped) << std::endl;
// CGAL_assertion(m_data.belongs_to_iedge(cropped, iedge_0)); // Can we do it more precise?
CGAL_assertion(m_data.is_correctly_oriented(
cropped.first, future_direction, ivertex, iedge_0));
}
// Create new pfaces if any.
@ -1921,6 +1922,8 @@ private:
m_data.direction(cropped) = future_direction;
if (m_verbose) std::cout << "- cropped: " <<
m_data.str(cropped) << ", " << m_data.point_3(cropped) << std::endl;
CGAL_assertion(m_data.is_correctly_oriented(
cropped.first, future_direction, ivertex, iedge_0));
}
// Create new pfaces if any.
@ -2266,6 +2269,8 @@ private:
m_data.direction(cropped) = future_directions.front();
if (m_verbose) std::cout << "- cropped 1: " <<
m_data.str(cropped) << ", " << m_data.point_3(cropped) << std::endl;
CGAL_assertion(m_data.is_correctly_oriented(
cropped.first, future_directions.front(), ivertex, crossed_iedges.front().first));
}
{ // second crop
@ -2299,6 +2304,8 @@ private:
m_data.direction(cropped) = future_directions.back();
if (m_verbose) std::cout << "- cropped 2: " <<
m_data.str(cropped) << ", " << m_data.point_3(cropped) << std::endl;
CGAL_assertion(m_data.is_correctly_oriented(
cropped.first, future_directions.back(), ivertex, crossed_iedges.back().first));
}
// Create new pfaces if any.