Revision 734261b3ee2ff9a172b90739f1cf7e2ae9823c25 authored by rinkk on 11 February 2021, 14:52:44 UTC, committed by rinkk on 15 February 2021, 10:13:16 UTC
1 parent 8cacbd1
FaceRule.cpp
/**
* \file
* \copyright
* Copyright (c) 2012-2021, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
*/
#include "FaceRule.h"
#include "MathLib/MathTools.h"
#include "MeshLib/Node.h"
#include "Element.h"
namespace MeshLib
{
bool FaceRule::testElementNodeOrder(const Element* e)
{
return getSurfaceNormal(e)[2] < 0;
}
Eigen::Vector3d FaceRule::getFirstSurfaceVector(Element const* const e)
{
auto const a =
Eigen::Map<Eigen::Vector3d const>(e->getNode(0)->getCoords());
auto const b =
Eigen::Map<Eigen::Vector3d const>(e->getNode(1)->getCoords());
Eigen::Vector3d const v = a - b;
return v;
}
Eigen::Vector3d FaceRule::getSecondSurfaceVector(Element const* const e)
{
auto const a =
Eigen::Map<Eigen::Vector3d const>(e->getNode(1)->getCoords());
auto const b =
Eigen::Map<Eigen::Vector3d const>(e->getNode(2)->getCoords());
Eigen::Vector3d const v = b - a;
return v;
}
Eigen::Vector3d FaceRule::getSurfaceNormal(const Element* e)
{
Eigen::Vector3d const u = getFirstSurfaceVector(e);
Eigen::Vector3d const v = getSecondSurfaceVector(e);
return u.cross(v);
}
} // namespace MeshLib
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...