Version: 9.16.0
SMESH_MeshAlgos::Intersector::Algo Struct Reference

Intersect faces of a mesh. More...

Public Member Functions

 Algo (SMDS_Mesh *mesh, double tol, const std::vector< gp_XYZ > &normals)
 
void Cut (const SMDS_MeshElement *face1, const SMDS_MeshElement *face2, const int nbCommonNodes)
 Intersect two faces. More...
 
void Cut (const SMDS_MeshElement *face, SMESH_NodeXYZ &lineEnd1, int edgeIndex1, SMESH_NodeXYZ &lineEnd2, int edgeIndex2)
 Store a face cut by a line given by its ends accompanied by indices of intersected face edges. More...
 
void MakeNewFaces (TElemIntPairVec &theNew2OldFaces, TNodeIntPairVec &theNew2OldNodes, const double theSign, const bool theOptimize)
 Split intersected faces. More...
 
void IntersectNewEdges (const CutFace &theCFace)
 Intersect edges added to myCutFaces. More...
 

Data Fields

SMDS_MeshmyMesh
 
double myTol
 
double myEps
 
const std::vector< gp_XYZ > & myNormals
 
TCutLinkMap myCutLinks
 assure sharing of new nodes More...
 
TCutFaceMap myCutFaces
 
TNNMap myRemove2KeepNodes
 node merge map More...
 
const SMDS_MeshElementmyFace1
 
const SMDS_MeshElementmyFace2
 
std::vector< SMESH_NodeXYZmyNodes1
 
std::vector< SMESH_NodeXYZmyNodes2
 
std::vector< double > myDist1
 
std::vector< double > myDist2
 
int myInd1
 
int myInd2
 
int myNbOnPlane1
 
int myNbOnPlane2
 
TIntPointSet myIntPointSet
 

Private Member Functions

bool isPlaneIntersected (const gp_XYZ &n2, const double d2, const std::vector< SMESH_NodeXYZ > &nodes1, std::vector< double > &dist1, int &nbOnPlane1, int &iNotOnPlane1)
 Check if a triangle intersects the plane of another triangle. More...
 
void computeIntervals (const std::vector< SMESH_NodeXYZ > &nodes, const std::vector< double > &dist, const int nbOnPln, const int iMaxCoo, double *u, int *iE)
 Compute parameters on the plane intersection line of intersections of edges of a triangle. More...
 
void cutCoplanar ()
 Intersect two co-planar faces. More...
 
void addLink (CutLink &link)
 Store a CutLink. More...
 
bool findLink (CutLink &link)
 Find a CutLink with an intersection point coincident with that of a given link. More...
 
bool coincide (const gp_XYZ &p1, const gp_XYZ &p2, const double tol) const
 
gp_XY p2D (const gp_XYZ &p) const
 
void intersectLink (const std::vector< SMESH_NodeXYZ > &nodes1, const std::vector< double > &dist1, const int iEdge1, const SMDS_MeshElement *face2, CutLink &link1)
 Compute intersection point of a link1 with a face2. More...
 
void findIntPointOnPlane (const std::vector< SMESH_NodeXYZ > &nodes, const std::vector< double > &dist, CutLink &link)
 Try to find an intersection node on a link collinear with the plane intersection line. More...
 
void replaceIntNode (const SMDS_MeshNode *nToKeep, const SMDS_MeshNode *nToRemove)
 Store node replacement in myCutFaces. More...
 
void computeIntPoint (const double u1, const double u2, const int iE1, const int iE2, CutLink &link, const SMDS_MeshNode *&node1, const SMDS_MeshNode *&node2)
 Compute intersection point on a link of either of faces by choosing a link whose parameter on the intersection line in maximal. More...
 
void cutCollinearLink (const int iNotOnPlane1, const std::vector< SMESH_NodeXYZ > &nodes1, const SMDS_MeshElement *face2, const CutLink &link1, const CutLink &link2)
 Add intersections to a link collinear with the intersection line. More...
 
void setPlaneIndices (const gp_XYZ &planeNorm)
 Choose indices on an axis-aligned plane. More...
 
bool intersectEdgeEdge (const gp_XY s1p0, const gp_XY s1p1, const gp_XY s2p0, const gp_XY s2p1, double &t1, double &t2, bool &isCollinear)
 Intersect two 2D line segments. More...
 
bool intersectEdgeEdge (int iE1, int iE2, IntPoint2D &intPoint)
 Intersect two edges of co-planar triangles. More...
 
bool isPointInTriangle (const gp_XYZ &p, const std::vector< SMESH_NodeXYZ > &nodes)
 Check if a point is contained in a triangle. More...
 
const SMDS_MeshNodecreateNode (const gp_XYZ &p)
 Store a CutLink. More...
 

Detailed Description

Intersect faces of a mesh.

Constructor & Destructor Documentation

◆ Algo()

SMESH_MeshAlgos::Intersector::Algo::Algo ( SMDS_Mesh mesh,
double  tol,
const std::vector< gp_XYZ > &  normals 
)

Member Function Documentation

◆ addLink()

void SMESH_MeshAlgos::Intersector::Algo::addLink ( CutLink &  link)
private

Store a CutLink.

◆ coincide()

bool SMESH_MeshAlgos::Intersector::Algo::coincide ( const gp_XYZ &  p1,
const gp_XYZ &  p2,
const double  tol 
) const
private

◆ computeIntervals()

void SMESH_MeshAlgos::Intersector::Algo::computeIntervals ( const std::vector< SMESH_NodeXYZ > &  nodes,
const std::vector< double > &  dist,
const int  nbOnPln,
const int  iMaxCoo,
double *  u,
int *  iE 
)
private

Compute parameters on the plane intersection line of intersections of edges of a triangle.

Parameters
[in]nodes- triangle nodes
[in]dist- distance of triangle nodes from the plane of another triangle
[in]nbOnPln- number of nodes lying on the plane of another triangle
[in]iMaxCoo- index of coordinate of max component of the plane intersection line
[out]u- two computed parameters on the plane intersection line
[out]iE- indices of intersected edges

◆ computeIntPoint()

void SMESH_MeshAlgos::Intersector::Algo::computeIntPoint ( const double  u1,
const double  u2,
const int  iE1,
const int  iE2,
CutLink &  link,
const SMDS_MeshNode *&  node1,
const SMDS_MeshNode *&  node2 
)
private

Compute intersection point on a link of either of faces by choosing a link whose parameter on the intersection line in maximal.

Parameters
[in]u1- parameter on the intersection line of link iE1 of myFace1
[in]u2- parameter on the intersection line of link iE2 of myFace2
[in]iE1- index of a link myFace1
[in]iE2- index of a link myFace2
[out]link- CutLink storing the intersection point
[out]node1- a node of the 2nd link if two links intersect
[out]node2- a node of the 2nd link if two links intersect

◆ createNode()

const SMDS_MeshNode * SMESH_MeshAlgos::Intersector::Algo::createNode ( const gp_XYZ &  p)
private

Store a CutLink.

References SMDS_Mesh::AddNode(), myMesh, and SMDS_MeshElement::setIsMarked().

◆ Cut() [1/2]

void SMESH_MeshAlgos::Intersector::Algo::Cut ( const SMDS_MeshElement face,
SMESH_NodeXYZ lineEnd1,
int  edgeIndex1,
SMESH_NodeXYZ lineEnd2,
int  edgeIndex2 
)

Store a face cut by a line given by its ends accompanied by indices of intersected face edges.

Edge index is <0 if a line end is inside the face.

Parameters
[in]face- a face to cut
[in,out]lineEnd1- line end coordinates + optional node existing at this point
[in]edgeIndex1- index of face edge cut by lineEnd1
[in,out]lineEnd2- line end coordinates + optional node existing at this point
[in]edgeIndex2- index of face edge cut by lineEnd2

References SMESH_TNodeXYZ::_node, SMDS_MeshElement::GetID(), SMDS_MeshElement::GetNode(), SMDS_MeshElement::GetNodeIndex(), SMDS_MeshElement::GetNodeWrap(), SMESH_TNodeXYZ::Node(), and SMESH_TNodeXYZ::Set().

◆ Cut() [2/2]

void SMESH_MeshAlgos::Intersector::Algo::Cut ( const SMDS_MeshElement face1,
const SMDS_MeshElement face2,
const int  nbCommonNodes 
)

◆ cutCollinearLink()

void SMESH_MeshAlgos::Intersector::Algo::cutCollinearLink ( const int  iNotOnPlane1,
const std::vector< SMESH_NodeXYZ > &  nodes1,
const SMDS_MeshElement face2,
const CutLink &  link1,
const CutLink &  link2 
)
private

Add intersections to a link collinear with the intersection line.

References Node.

◆ cutCoplanar()

void SMESH_MeshAlgos::Intersector::Algo::cutCoplanar ( )
private

Intersect two co-planar faces.

◆ findIntPointOnPlane()

void SMESH_MeshAlgos::Intersector::Algo::findIntPointOnPlane ( const std::vector< SMESH_NodeXYZ > &  nodes,
const std::vector< double > &  dist,
CutLink &  link 
)
private

Try to find an intersection node on a link collinear with the plane intersection line.

References Node.

◆ findLink()

bool SMESH_MeshAlgos::Intersector::Algo::findLink ( CutLink &  link)
private

Find a CutLink with an intersection point coincident with that of a given link.

◆ intersectEdgeEdge() [1/2]

bool SMESH_MeshAlgos::Intersector::Algo::intersectEdgeEdge ( const gp_XY  s1p0,
const gp_XY  s1p1,
const gp_XY  s2p0,
const gp_XY  s2p1,
double &  t1,
double &  t2,
bool isCollinear 
)
private

Intersect two 2D line segments.

◆ intersectEdgeEdge() [2/2]

bool SMESH_MeshAlgos::Intersector::Algo::intersectEdgeEdge ( int  iE1,
int  iE2,
IntPoint2D &  intPoint 
)
private

Intersect two edges of co-planar triangles.

Parameters
[in,out]iE1- edge index of triangle 1
[in,out]iE2- edge index of triangle 2
[in,out]intPoints- intersection points
[in,out]nbIntPoints- nb of found intersection points

References Node, and SMESH_TNodeXYZ::Node().

◆ intersectLink()

void SMESH_MeshAlgos::Intersector::Algo::intersectLink ( const std::vector< SMESH_NodeXYZ > &  nodes1,
const std::vector< double > &  dist1,
const int  iEdge1,
const SMDS_MeshElement face2,
CutLink &  link1 
)
private

Compute intersection point of a link1 with a face2.

References SMESH_TNodeXYZ::Node(), and SMESH_TNodeXYZ::Set().

◆ IntersectNewEdges()

void SMESH_MeshAlgos::Intersector::Algo::IntersectNewEdges ( const CutFace &  theCFace)

Intersect edges added to myCutFaces.

References Node.

Referenced by SMESH_MeshAlgos::Intersector::CutByPlanes().

◆ isPlaneIntersected()

bool SMESH_MeshAlgos::Intersector::Algo::isPlaneIntersected ( const gp_XYZ &  n2,
const double  d2,
const std::vector< SMESH_NodeXYZ > &  nodes1,
std::vector< double > &  dist1,
int &  nbOnPlane1,
int &  iNotOnPlane1 
)
private

Check if a triangle intersects the plane of another triangle.

Parameters
[in]nodes1- nodes of triangle 1
[in]n2- normal of triangle 2
[in]d2- a constant of the plane equation 2
[out]dist1- distance of nodes1 from the plane 2
[out]nbOnPlane- number of nodes1 lying on the plane 2
Returns
bool - true if the triangle intersects the plane 2

◆ isPointInTriangle()

bool SMESH_MeshAlgos::Intersector::Algo::isPointInTriangle ( const gp_XYZ &  p,
const std::vector< SMESH_NodeXYZ > &  nodes 
)
private

Check if a point is contained in a triangle.

References SMESH_MeshAlgos::GetBarycentricCoords().

◆ MakeNewFaces()

void SMESH_MeshAlgos::Intersector::Algo::MakeNewFaces ( SMESH_MeshAlgos::TElemIntPairVec theNew2OldFaces,
SMESH_MeshAlgos::TNodeIntPairVec theNew2OldNodes,
const double  theSign,
const bool  theOptimize 
)

◆ p2D()

gp_XY SMESH_MeshAlgos::Intersector::Algo::p2D ( const gp_XYZ &  p) const
private

References myInd1, and myInd2.

◆ replaceIntNode()

void SMESH_MeshAlgos::Intersector::Algo::replaceIntNode ( const SMDS_MeshNode nToKeep,
const SMDS_MeshNode nToRemove 
)
private

Store node replacement in myCutFaces.

References SMDS_MeshElement::GetID().

◆ setPlaneIndices()

void SMESH_MeshAlgos::Intersector::Algo::setPlaneIndices ( const gp_XYZ &  planeNorm)
private

Choose indices on an axis-aligned plane.

References SMESH_MeshAlgos::MaxIndex().

Field Documentation

◆ myCutFaces

TCutFaceMap SMESH_MeshAlgos::Intersector::Algo::myCutFaces

◆ myCutLinks

TCutLinkMap SMESH_MeshAlgos::Intersector::Algo::myCutLinks

assure sharing of new nodes

◆ myDist1

std::vector< double > SMESH_MeshAlgos::Intersector::Algo::myDist1

◆ myDist2

std::vector< double > SMESH_MeshAlgos::Intersector::Algo::myDist2

◆ myEps

double SMESH_MeshAlgos::Intersector::Algo::myEps

◆ myFace1

const SMDS_MeshElement* SMESH_MeshAlgos::Intersector::Algo::myFace1

◆ myFace2

const SMDS_MeshElement* SMESH_MeshAlgos::Intersector::Algo::myFace2

◆ myInd1

int SMESH_MeshAlgos::Intersector::Algo::myInd1

Referenced by p2D().

◆ myInd2

int SMESH_MeshAlgos::Intersector::Algo::myInd2

Referenced by p2D().

◆ myIntPointSet

TIntPointSet SMESH_MeshAlgos::Intersector::Algo::myIntPointSet

◆ myMesh

SMDS_Mesh* SMESH_MeshAlgos::Intersector::Algo::myMesh

Referenced by createNode().

◆ myNbOnPlane1

int SMESH_MeshAlgos::Intersector::Algo::myNbOnPlane1

◆ myNbOnPlane2

int SMESH_MeshAlgos::Intersector::Algo::myNbOnPlane2

◆ myNodes1

std::vector< SMESH_NodeXYZ > SMESH_MeshAlgos::Intersector::Algo::myNodes1

◆ myNodes2

std::vector< SMESH_NodeXYZ > SMESH_MeshAlgos::Intersector::Algo::myNodes2

◆ myNormals

const std::vector< gp_XYZ >& SMESH_MeshAlgos::Intersector::Algo::myNormals

◆ myRemove2KeepNodes

TNNMap SMESH_MeshAlgos::Intersector::Algo::myRemove2KeepNodes

node merge map

◆ myTol

double SMESH_MeshAlgos::Intersector::Algo::myTol