mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: surfaceCheck: do self-intersection more efficiently
This commit is contained in:
@ -1,7 +1,9 @@
|
|||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
|
-I$(LIB_SRC)/surfMesh/lnInclude \
|
||||||
-I$(LIB_SRC)/triSurface/lnInclude
|
-I$(LIB_SRC)/triSurface/lnInclude
|
||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
-ltriSurface \
|
-ltriSurface \
|
||||||
|
-lsurfMesh \
|
||||||
-lmeshTools
|
-lmeshTools
|
||||||
|
|||||||
@ -35,6 +35,7 @@ Description
|
|||||||
#include "triSurfaceSearch.H"
|
#include "triSurfaceSearch.H"
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
|
#include "OBJstream.H"
|
||||||
#include "surfaceIntersection.H"
|
#include "surfaceIntersection.H"
|
||||||
#include "SortableList.H"
|
#include "SortableList.H"
|
||||||
#include "PatchTools.H"
|
#include "PatchTools.H"
|
||||||
@ -615,8 +616,6 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
subSurf.write(subFileName);
|
subSurf.write(subFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -654,61 +653,75 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
triSurfaceSearch querySurf(surf);
|
triSurfaceSearch querySurf(surf);
|
||||||
|
|
||||||
//{
|
const indexedOctree<treeDataTriSurface>& tree = querySurf.tree();
|
||||||
// OBJstream intStream("selfInter2.obj");
|
|
||||||
// const indexedOctree<treeDataTriSurface>& tree = querySurf.tree();
|
|
||||||
// forAll(surf.edges(), edgeI)
|
|
||||||
// {
|
|
||||||
// const edge& e = surf.edges()[edgeI];
|
|
||||||
//
|
|
||||||
// pointIndexHit hitInfo
|
|
||||||
// (
|
|
||||||
// tree.findLine
|
|
||||||
// (
|
|
||||||
// surf.points()[surf.meshPoints()[e[0]]],
|
|
||||||
// surf.points()[surf.meshPoints()[e[1]]],
|
|
||||||
// treeDataTriSurface::findSelfIntersectOp
|
|
||||||
// (
|
|
||||||
// tree,
|
|
||||||
// edgeI
|
|
||||||
// )
|
|
||||||
// )
|
|
||||||
// );
|
|
||||||
//
|
|
||||||
// if (hitInfo.hit())
|
|
||||||
// {
|
|
||||||
// Pout<< "Found hit:" << hitInfo.hitPoint() << endl;
|
|
||||||
// intStream.write(hitInfo.hitPoint());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
surfaceIntersection inter(querySurf);
|
OBJstream intStream("selfInterPoints.obj");
|
||||||
|
|
||||||
if (inter.cutEdges().empty() && inter.cutPoints().empty())
|
label nInt = 0;
|
||||||
|
|
||||||
|
forAll(surf.edges(), edgeI)
|
||||||
|
{
|
||||||
|
const edge& e = surf.edges()[edgeI];
|
||||||
|
|
||||||
|
pointIndexHit hitInfo
|
||||||
|
(
|
||||||
|
tree.findLine
|
||||||
|
(
|
||||||
|
surf.points()[surf.meshPoints()[e[0]]],
|
||||||
|
surf.points()[surf.meshPoints()[e[1]]],
|
||||||
|
treeDataTriSurface::findSelfIntersectOp
|
||||||
|
(
|
||||||
|
tree,
|
||||||
|
edgeI
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (hitInfo.hit())
|
||||||
|
{
|
||||||
|
intStream.write(hitInfo.hitPoint());
|
||||||
|
nInt++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nInt == 0)
|
||||||
{
|
{
|
||||||
Info<< "Surface is not self-intersecting" << endl;
|
Info<< "Surface is not self-intersecting" << endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Info<< "Surface is self-intersecting" << endl;
|
Info<< "Surface is self-intersecting at " << nInt
|
||||||
Info<< "Writing edges of intersection to selfInter.obj" << endl;
|
<< " locations." << endl;
|
||||||
|
Info<< "Writing intersection points to " << intStream.name()
|
||||||
OFstream intStream("selfInter.obj");
|
<< endl;
|
||||||
forAll(inter.cutPoints(), cutPointI)
|
|
||||||
{
|
|
||||||
const point& pt = inter.cutPoints()[cutPointI];
|
|
||||||
|
|
||||||
intStream << "v " << pt.x() << ' ' << pt.y() << ' ' << pt.z()
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
forAll(inter.cutEdges(), cutEdgeI)
|
|
||||||
{
|
|
||||||
const edge& e = inter.cutEdges()[cutEdgeI];
|
|
||||||
|
|
||||||
intStream << "l " << e.start()+1 << ' ' << e.end()+1 << endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//surfaceIntersection inter(querySurf);
|
||||||
|
//
|
||||||
|
//if (inter.cutEdges().empty() && inter.cutPoints().empty())
|
||||||
|
//{
|
||||||
|
// Info<< "Surface is not self-intersecting" << endl;
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// Info<< "Surface is self-intersecting" << endl;
|
||||||
|
// Info<< "Writing edges of intersection to selfInter.obj" << endl;
|
||||||
|
//
|
||||||
|
// OFstream intStream("selfInter.obj");
|
||||||
|
// forAll(inter.cutPoints(), cutPointI)
|
||||||
|
// {
|
||||||
|
// const point& pt = inter.cutPoints()[cutPointI];
|
||||||
|
//
|
||||||
|
// intStream << "v " << pt.x() << ' ' << pt.y() << ' ' << pt.z()
|
||||||
|
// << endl;
|
||||||
|
// }
|
||||||
|
// forAll(inter.cutEdges(), cutEdgeI)
|
||||||
|
// {
|
||||||
|
// const edge& e = inter.cutEdges()[cutEdgeI];
|
||||||
|
//
|
||||||
|
// intStream << "l " << e.start()+1 << ' ' << e.end()+1 << endl;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
Info<< endl;
|
Info<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user