You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given this function where "triangle_" is the library's triangle, the split results are radically different and not even sane. The only sanity they have is positional based on the objects involved.
The "side markings" and all other data are completely unused in the sanity checks, and those are all that I'm worried about. This code should not result in dead zones of zero area polygons (checked against LibGDX in java for a throwaway), but it does result in void spaces when used with the library.
Far too often splitting a triangle by a plane results in a split that does not make sense when flipping the plane. A split of 2 followed by a split of 2, or a split of 1 followed by a split of 1. That involves this library because those splits come from this library's planar functions and triangle functions.
void MeshMerger::SplitTriangles(std::vector<CSGTriangle>& lhs, std::vector<CSGTriangle>& rhs)
{
for (unsigned leftIndex = 0; leftIndex < lhs.size(); ++leftIndex)
{
CSGTriangle& current = lhs[leftIndex];
for (unsigned j = 0; j < rhs.size(); ++j)
{
// Don't allow a polygon to split a product more than once, triangle-to-triangle test is false alarm
if (rhs[j].lastSplitter_ == leftIndex)
continue;
if (!current.triangle_.Intersects(rhs[j].triangle_))
continue;
Triangle a0, b0;
Triangle a1, b1;
Plane splitPlane = current.triangle_.PlaneCCW();
int ret = splitPlane.Clip(rhs[j].triangle_, a0, b0);
if (ret > 0)
{
CSGTriangle aa0;
aa0.triangle_ = a0;
aa0.lastSplitter_ = leftIndex;
aa0.backSideMarked_ = 1;
rhs.push_back(aa0);
if (ret == 2)
{
CSGTriangle bb0;
bb0.backSideMarked_ = 1;
bb0.lastSplitter_ = leftIndex;
bb0.triangle_ = b0;
rhs.push_back(bb0);
}
splitPlane.ReverseNormal();
ret = splitPlane.Clip(rhs[j].triangle_, a1, b1);
if (ret > 0)
{
CSGTriangle aa1;
aa1.triangle_ = a1;
aa1.backSideMarked_ = -1;
aa1.lastSplitter_ = leftIndex;
rhs.push_back(aa1);
if (ret == 2)
{
CSGTriangle bb1;
bb1.backSideMarked_ = -1;
bb1.triangle_ = b1;
bb1.lastSplitter_ = leftIndex;
rhs.push_back(bb1);
}
}
// Remove the triangle that we have split
rhs.erase(rhs.begin() + j);
--j;
}
}
}
}
The text was updated successfully, but these errors were encountered:
Given this function where "triangle_" is the library's triangle, the split results are radically different and not even sane. The only sanity they have is positional based on the objects involved.
The "side markings" and all other data are completely unused in the sanity checks, and those are all that I'm worried about. This code should not result in dead zones of zero area polygons (checked against LibGDX in java for a throwaway), but it does result in void spaces when used with the library.
Far too often splitting a triangle by a plane results in a split that does not make sense when flipping the plane. A split of 2 followed by a split of 2, or a split of 1 followed by a split of 1. That involves this library because those splits come from this library's planar functions and triangle functions.
The text was updated successfully, but these errors were encountered: