Commit 7241bda9 authored by Martin Heistermann's avatar Martin Heistermann

wip

parent fdb6bca3
Pipeline #11749 failed with stage
in 3 minutes and 40 seconds
......@@ -89,7 +89,22 @@ bool isInsideOrOnBoundary(Parameter u, Parameter v, Parameter w, Parameter x, Pa
bool isInPlane(Parameter u, Parameter v, Parameter w, Parameter x)
{
return (sign_orient3d(u.data(), v.data(), w.data(), x.data()) == ORI_ZERO);
return signOrient3d(u, v, w, x) == ORI_ZERO;
}
bool isDegenerate(Parameter u, Parameter v, Parameter w, Parameter x)
{
return signOrient3d(u, v, w, x) == ORI_ZERO;
}
bool isRegular(Parameter u, Parameter v, Parameter w, Parameter x)
{
return signOrient3d(u, v, w, x) == ORI_ABOVE;
}
bool isFlipped(Parameter u, Parameter v, Parameter w, Parameter x)
{
return signOrient3d(u, v, w, x) == ORI_BELOW;
}
bool isOnLine(Parameter u, Parameter v, Parameter w)
......@@ -138,11 +153,6 @@ bool isOnLineBetween(Parameter u, Parameter v, Parameter w)
return false;
}
bool isFlipped(Parameter u, Parameter v, Parameter w, Parameter x)
{
return sign_orient3d(u.data(), v.data(), w.data(), x.data()) == ORI_BELOW;
}
bool pointsIntoTet(Parameter u, Parameter v, Parameter w, Parameter x, Direction y)
{
auto z = u + y;
......@@ -235,15 +245,6 @@ bool pointsIntoProjectedTriangleFromEdge(Parameter u, Parameter v, Parameter w,
}
bool isDegenerate(Parameter u, Parameter v, Parameter w, Parameter x)
{
return sign_orient3d(u.data(), v.data(), w.data(), x.data()) == ORI_ZERO;
}
bool isRegular(Parameter u, Parameter v, Parameter w, Parameter x)
{
return sign_orient3d(u.data(), v.data(), w.data(), x.data()) == ORI_ABOVE;
}
// false if intersection lies on edge, false if line in plane
bool intersectsTriangle(Parameter u, Parameter v, Parameter w, Parameter x, Parameter y)
......
......@@ -21,6 +21,7 @@
#pragma once
#include "ExactPredicates.hh"
#include "Typedefs.hh"
namespace HexEx {
......@@ -60,4 +61,10 @@ bool intersectsTriangleRelaxed(Parameter u, Parameter v, Parameter w, Parameter
bool isRegular(Vec2d u, Vec2d v, Vec2d w);
inline ORIENTATION signOrient3d(Parameter u, Parameter v, Parameter w, Parameter x) {
return sign_orient3d(u.data(), v.data(), w.data(), x.data());
}
}
......@@ -32,6 +32,8 @@
extern "C" {
#endif
#include "assert.h"
/**
* @brief Initializes the exact predicates.
*
......
......@@ -68,7 +68,7 @@ public:
HalfFaceHandle incidentHalfFaceHandle();
CellHandle incidentCellHandle();
HalfEdgeHandle& halfedge();
HalfEdgeHandle& halfedge(); // TODO: implementation missing!
bool isValid() const { return hport.get() != nullptr; }
......
......@@ -1005,7 +1005,7 @@ bool HexExtractor::connectDartToPreviousSecondaryDart(Dart& dart)
auto transitionFace = alpha1NextFace(lastFace, currentCell, currentParameter, traceDir, refDir, normalDir);
if (!transitionFace.is_valid())
connectDartToNeighborSecondaryDart2(dart);
return connectDartToNeighborSecondaryDart2(dart);
if (isFaceDegenerate(transitionFace))
{
......@@ -1199,7 +1199,7 @@ bool HexExtractor::connectDartToOppositeSecondaryDart(Dart& dart)
auto transitionFace = alpha3NextFace(lastFace, currentCell, currentParameter, traceDir, refDir, normalDir);
if (inputMesh.is_boundary(inputMesh.opposite_halfface_handle(transitionFace)))
if (!transitionFace.is_valid() || inputMesh.is_boundary(inputMesh.opposite_halfface_handle(transitionFace)))
{
// reached boundary, leave dart without opposite dart;
return false;
......@@ -1267,12 +1267,19 @@ bool HexExtractor::alpha0FaceTest(HalfFaceHandle hfh, Parameter param, Direction
{
auto params = getParameters(hfh);
auto ori_tri_orig = signOrient3d(params[0], params[1], params[2], param);
auto ori_tri_traced = signOrient3d(params[0], params[1], params[2], param + traceDir);
// start and end of grid edge must be on opposite sides of the triangles
auto b1 = (isRegular(params[0], params[1], params[2], param) && isRegular(params[0], params[2], params[1], param + traceDir)) ||
(isFlipped(params[0], params[1], params[2], param) && isFlipped(params[0], params[2], params[1], param + traceDir));
if (ori_tri_orig == ori_tri_traced)
return false;
if (!b1)
if (ori_tri_traced == ORI_ZERO) {
return true;
}
if (ori_tri_orig == ORI_ZERO) {
return false;
}
std::array<ORIENTATION, 3> oris;
oris[0] = sign_orient3d(params[0].data(), params[1].data(), param.data(), (param + traceDir).data());
......
......@@ -30,6 +30,8 @@
namespace HexEx {
//#define HEXEX_VERBOSE
#ifdef HEXEX_VERBOSE
#define HEXEX_DEBUG_ONLY(x) x
#else
......@@ -429,9 +431,11 @@ private:
if (localCellUVs[ch].find(*cv_it) == localCellUVs[ch].end())
continue;
auto localUV = localCellUVs[ch][*cv_it];
/*
assert((localUV[0] == 0) || (localUV[0] == 1));
assert((localUV[1] == 0) || (localUV[1] == 1));
assert((localUV[2] == 0) || (localUV[2] == 1));
*/
if (!((localUV[0] == 0) || (localUV[0] == 1)) ||
!((localUV[1] == 0) || (localUV[1] == 1)) ||
......@@ -484,17 +488,24 @@ private:
auto tmp_d = d;
// rotate backwards as far as possible or back to d
int steps = 0;
do
{
if (++steps>50)
break;
if ((tmp_d->getAlpha<1>() == nullptr) || (tmp_d->getAlpha<1>()->getAlpha<0>() == nullptr))
break;
tmp_d = tmp_d->getAlpha<1>()->getAlpha<0>();
// endless loop possible (4 different values of tmp_d, != d)!
}
while (tmp_d != d);
steps = 0;
do
{
if (++steps>50)
break;
processed_darts.insert(tmp_d);
auto equivalenceClassId = equivalenceClassIds[tmp_d->getVertex()];
auto newVh = equivalenceClassVertices[equivalenceClassId];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment