Newer
Older
* Copyright (c) 2012, OpenGeoSys Community (http://www.opengeosys.com)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.com/LICENSE.txt
*/
#include "Face.h"
Karsten Rink
committed
#include "Edge.h"
Karsten Rink
committed
#include "Node.h"
#include "MathTools.h"
namespace MeshLib {
Karsten Rink
committed
Face::Face(Node** nodes, MshElemType::type type, unsigned value)
: Element(nodes, type, value)
{
}
Karsten Rink
committed
Face::Face(MshElemType::type type, unsigned value)
: Element(type, value)
{
}
Face::~Face()
{
Karsten Rink
committed
void Face::getSurfaceNormal(double normal[3]) const
Karsten Rink
committed
{
const double edge1[3] = { (*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 double edge2[3] = { (*this->_nodes[1])[0]-(*this->_nodes[2])[0],
(*this->_nodes[1])[1]-(*this->_nodes[2])[1],
(*this->_nodes[1])[2]-(*this->_nodes[2])[2] };
MathLib::crossProd(edge1, edge2, normal);
}
Karsten Rink
committed