From 5f3d5870a03e30143c31905548e11e581619b60c Mon Sep 17 00:00:00 2001
From: Karsten Rink <karsten.rink@ufz.de>
Date: Wed, 26 Feb 2014 16:46:27 +0100
Subject: [PATCH] removed convexity check for zero-volume quads

---
 MeshLib/Elements/TemplateQuad.tpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/MeshLib/Elements/TemplateQuad.tpp b/MeshLib/Elements/TemplateQuad.tpp
index 029e5bd5718..045c9eb7c7f 100644
--- a/MeshLib/Elements/TemplateQuad.tpp
+++ b/MeshLib/Elements/TemplateQuad.tpp
@@ -125,8 +125,10 @@ ElementErrorCode TemplateQuad<NNODES,CELLQUADTYPE>::validate() const
 	ElementErrorCode error_code;
 	error_code[ElementErrorFlag::ZeroVolume]  = this->hasZeroVolume();
 	error_code[ElementErrorFlag::NonCoplanar] = (!GeoLib::pointsOnAPlane(*_nodes[0], *_nodes[1], *_nodes[2], *_nodes[3]));
-	error_code[ElementErrorFlag::NonConvex]   = (!(GeoLib::dividedByPlane(*_nodes[0], *_nodes[2], *_nodes[1], *_nodes[3]) &&
-		                                           GeoLib::dividedByPlane(*_nodes[1], *_nodes[3], *_nodes[0], *_nodes[2])));
+	// for collapsed quads (i.e. reduced to a line) this test might result "false" as all four points are actually located on a line.
+	if (!error_code[ElementErrorFlag::ZeroVolume]) 
+		error_code[ElementErrorFlag::NonConvex]   = (!(GeoLib::dividedByPlane(*_nodes[0], *_nodes[2], *_nodes[1], *_nodes[3]) &&
+			                                           GeoLib::dividedByPlane(*_nodes[1], *_nodes[3], *_nodes[0], *_nodes[2])));
 	return error_code;
 }
 
-- 
GitLab