From eaa587ccd04aa7c3488570fa28688cf45f9ec41c Mon Sep 17 00:00:00 2001
From: Karsten Rink <karsten.rink@ufz.de>
Date: Thu, 27 Mar 2014 11:12:20 +0100
Subject: [PATCH] used abbreviated initialisation of Vector3 class

---
 MeshLib/Elements/Cell.cpp |  4 ++--
 MeshLib/Elements/Face.cpp | 10 +++-------
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/MeshLib/Elements/Cell.cpp b/MeshLib/Elements/Cell.cpp
index b4acf4dd00f..9f3cb643618 100644
--- a/MeshLib/Elements/Cell.cpp
+++ b/MeshLib/Elements/Cell.cpp
@@ -47,8 +47,8 @@ bool Cell::testElementNodeOrder() const
 	for (unsigned j=0; j<nFaces; ++j)
 	{
 		MeshLib::Face const*const face (dynamic_cast<const MeshLib::Face*>(this->getFace(j)));
-		const MeshLib::Node x (*(face->getNode(0)));
-		const MathLib::Vector3 cx (c[0]-x[0], c[1]-x[1], c[2]-x[2]);
+		const MeshLib::Node x (*(face->getNode(1)));
+		const MathLib::Vector3 cx (c, x);
 		const double s = MathLib::scalarProduct(face->getSurfaceNormal(), cx);
 		delete face;
 		if (s >= 0)
diff --git a/MeshLib/Elements/Face.cpp b/MeshLib/Elements/Face.cpp
index 0e54b1e71a6..10744de3af6 100644
--- a/MeshLib/Elements/Face.cpp
+++ b/MeshLib/Elements/Face.cpp
@@ -40,19 +40,15 @@ Face::~Face()
 
 MathLib::Vector3 Face::getSurfaceNormal() const
 {
-	const MathLib::Vector3 u ((*this->_nodes[0])[0]-(*this->_nodes[1])[0],
-				 		      (*this->_nodes[0])[1]-(*this->_nodes[1])[1],
-						      (*this->_nodes[0])[2]-(*this->_nodes[1])[2]);
-	const MathLib::Vector3 v ((*this->_nodes[1])[0]-(*this->_nodes[2])[0],
-							  (*this->_nodes[1])[1]-(*this->_nodes[2])[1],
-							  (*this->_nodes[1])[2]-(*this->_nodes[2])[2]);
+	const MathLib::Vector3 u (*_nodes[1], *_nodes[0]);
+	const MathLib::Vector3 v (*_nodes[1], *_nodes[2]);
 	return MathLib::crossProduct(u,v);
 }
 
 bool Face::testElementNodeOrder() const
 {
 	MathLib::Vector3 up_vec (0,0,1);
-	return (MathLib::scalarProduct(this->getSurfaceNormal(), up_vec) > 0) ? true : false;
+	return (MathLib::scalarProduct(this->getSurfaceNormal(), up_vec) < 0) ? true : false;
 }
 
 }
-- 
GitLab