implement trimming of a mesh with a plane
This commit is contained in:
@@ -50,6 +50,7 @@
|
||||
#include "Core/SetOperations.h"
|
||||
#include "Core/Triangulation.h"
|
||||
#include "Core/Trim.h"
|
||||
#include "Core/TrimByPlane.h"
|
||||
#include "Core/Visitor.h"
|
||||
#include "Core/Decimation.h"
|
||||
|
||||
@@ -60,7 +61,7 @@ using namespace Mesh;
|
||||
|
||||
float MeshObject::Epsilon = 1.0e-5f;
|
||||
|
||||
TYPESYSTEM_SOURCE(Mesh::MeshObject, Data::ComplexGeoData);
|
||||
TYPESYSTEM_SOURCE(Mesh::MeshObject, Data::ComplexGeoData)
|
||||
|
||||
MeshObject::MeshObject()
|
||||
{
|
||||
@@ -1053,6 +1054,21 @@ void MeshObject::trim(const Base::Polygon2d& polygon2d,
|
||||
this->_kernel.AddFacets(triangle);
|
||||
}
|
||||
|
||||
void MeshObject::trim(const Base::Vector3f& base, const Base::Vector3f& normal)
|
||||
{
|
||||
MeshCore::MeshTrimByPlane trim(this->_kernel);
|
||||
std::vector<unsigned long> trimFacets, removeFacets;
|
||||
std::vector<MeshCore::MeshGeomFacet> triangle;
|
||||
|
||||
MeshCore::MeshFacetGrid meshGrid(this->_kernel);
|
||||
trim.CheckFacets(meshGrid, base, normal, trimFacets, removeFacets);
|
||||
trim.TrimFacets(trimFacets, base, normal, triangle);
|
||||
if (!removeFacets.empty())
|
||||
this->deleteFacets(removeFacets);
|
||||
if (!triangle.empty())
|
||||
this->_kernel.AddFacets(triangle);
|
||||
}
|
||||
|
||||
MeshObject* MeshObject::unite(const MeshObject& mesh) const
|
||||
{
|
||||
MeshCore::MeshKernel result;
|
||||
|
||||
Reference in New Issue
Block a user