Skip to content
Snippets Groups Projects
Commit 0f09ba0f authored by Tom Fischer's avatar Tom Fischer
Browse files

added virtual method isPntInside()

parent ed7f3efe
No related branches found
No related tags found
No related merge requests found
......@@ -13,8 +13,12 @@
#ifndef FACE_H_
#define FACE_H_
#include <limits>
#include "Element.h"
// GeoLib
#include "Point.h"
namespace MeshLib {
......@@ -48,6 +52,14 @@ public:
/// Destructor
virtual ~Face();
/**
* Check if the 3d GeoLib::Point is inside of the element.
* @param pnt the 3d GeoLib::Point object
* @param eps tolerance for numerical algorithm used or computing the property
* @return true if the point is inside the element, false otherwise
*/
virtual bool isPntInside(GeoLib::Point const& pnt, double eps = std::numeric_limits<double>::epsilon()) const = 0;
/**
* This method is pure virtual and is inherited from class @sa Element.
* It has to be implemented in the derived classes of class Face!
......
......@@ -73,6 +73,15 @@ public:
/// Returns true if these two indeces form an edge and false otherwise
bool isEdge(unsigned i, unsigned j) const;
/**
* Check if the 3d GeoLib::Point is inside of the quad element.
* @param pnt the 3d GeoLib::Point object
* @param eps tolerance for numerical algorithm used or computing the property
* @return true if the point is inside the element, false otherwise
*/
virtual bool isPntInside(GeoLib::Point const& pnt, double eps = std::numeric_limits<double>::epsilon()) const;
/**
* Method clone is inherited from class Element. It makes a deep copy of the TemplateQuad instance.
* @return an exact copy of the object
......
......@@ -13,7 +13,9 @@
#include "Node.h"
#include "Tri.h"
// MathLib
#include "MathTools.h"
#include "AnalyticalGeometry.h"
namespace MeshLib {
......@@ -70,6 +72,13 @@ bool TemplateQuad<NNODES,FEMQUADTYPE>::isEdge(unsigned idx1, unsigned idx2) cons
return false;
}
template <unsigned NNODES, FEMElemType::type FEMQUADTYPE>
bool TemplateQuad<NNODES,FEMQUADTYPE>::isPntInside(GeoLib::Point const& pnt, double eps) const
{
return (MathLib::isPointInTriangle(pnt, *_nodes[0], *_nodes[1], *_nodes[2], eps) ||
MathLib::isPointInTriangle(pnt, *_nodes[0], *_nodes[2], *_nodes[3], eps));
}
template <unsigned NNODES, FEMElemType::type FEMQUADTYPE>
Element* TemplateQuad<NNODES,FEMQUADTYPE>::clone() const
{
......
......@@ -80,6 +80,14 @@ public:
/// Returns true if these two indices form an edge and false otherwise
bool isEdge(unsigned idx1, unsigned idx2) const;
/**
* Check if the 3d GeoLib::Point is inside of the element.
* @param pnt the 3d GeoLib::Point object
* @param eps tolerance for numerical algorithm used or computing the property
* @return true if the point is inside the element, false otherwise
*/
virtual bool isPntInside(GeoLib::Point const& pnt, double eps = std::numeric_limits<double>::epsilon()) const;
/**
* Method clone is inherited from class Element. It makes a deep copy of the TemplateTri instance.
* @return an exact copy of the object
......
......@@ -9,6 +9,9 @@
* Created on Sep 27, 2012 by Thomas Fischer
*/
// MathLib
#include "AnalyticalGeometry.h"
namespace MeshLib {
template <unsigned NNODES, FEMElemType::type FEMTRITYPE>
......@@ -55,6 +58,12 @@ bool TemplateTri<NNODES,FEMTRITYPE>::isEdge(unsigned idx1, unsigned idx2) const
return false;
}
template <unsigned NNODES, FEMElemType::type FEMTRITYPE>
bool TemplateTri<NNODES,FEMTRITYPE>::isPntInside(GeoLib::Point const& pnt, double eps) const
{
return MathLib::isPointInTriangle(pnt, *_nodes[0], *_nodes[1], *_nodes[2], eps);
}
template <unsigned NNODES, FEMElemType::type FEMTRITYPE>
Element* TemplateTri<NNODES,FEMTRITYPE>::reviseElement() const
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment