|
@ -234,10 +234,12 @@ public: |
|
|
* @brief Union two visible primitive node |
|
|
* @brief Union two visible primitive node |
|
|
* @param[in] rep1 The first visible primitive node |
|
|
* @param[in] rep1 The first visible primitive node |
|
|
* @param[in] rep2 The second visible primitive node |
|
|
* @param[in] rep2 The second visible primitive node |
|
|
|
|
|
* @param[in] modify Whether the aabb of primitive node is need to modify |
|
|
* @return The unioned visible primitive |
|
|
* @return The unioned visible primitive |
|
|
*/ |
|
|
*/ |
|
|
algoim::organizer::VisiblePrimitiveRep unionNode(const algoim::organizer::VisiblePrimitiveRep& rep1, |
|
|
algoim::organizer::VisiblePrimitiveRep unionNode(const algoim::organizer::VisiblePrimitiveRep& rep1, |
|
|
const algoim::organizer::VisiblePrimitiveRep& rep2) |
|
|
const algoim::organizer::VisiblePrimitiveRep& rep2, |
|
|
|
|
|
const bool modify = true) |
|
|
{ |
|
|
{ |
|
|
auto tree = createEmptyBlobTree(); |
|
|
auto tree = createEmptyBlobTree(); |
|
|
tree.structure[2].nodeOp = 0; |
|
|
tree.structure[2].nodeOp = 0; |
|
@ -251,9 +253,26 @@ public: |
|
|
result.aabb = rep1.aabb; |
|
|
result.aabb = rep1.aabb; |
|
|
result.aabb.extend(rep2.aabb); |
|
|
result.aabb.extend(rep2.aabb); |
|
|
|
|
|
|
|
|
for (auto& iter : minimalReps) |
|
|
if (modify) |
|
|
{ |
|
|
{ |
|
|
result.tensors.push_back(iter.tensor); |
|
|
for (auto& iter : minimalReps) |
|
|
|
|
|
{ |
|
|
|
|
|
result.tensors.push_back(iter.tensor); |
|
|
|
|
|
result.aabbs.push_back(iter.aabb); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
for (auto& iter : rep1.tensors) |
|
|
|
|
|
{ |
|
|
|
|
|
result.tensors.push_back(iter); |
|
|
|
|
|
} |
|
|
|
|
|
for (auto& iter : rep2.tensors) |
|
|
|
|
|
{ |
|
|
|
|
|
result.tensors.push_back(iter); |
|
|
|
|
|
} |
|
|
|
|
|
result.aabbs = rep1.aabbs; |
|
|
|
|
|
result.aabbs.insert(result.aabbs.end(), rep2.aabbs.begin(), rep2.aabbs.end()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return result; |
|
|
return result; |
|
@ -263,10 +282,12 @@ public: |
|
|
* @brief Intersect two visible primitive node |
|
|
* @brief Intersect two visible primitive node |
|
|
* @param[in] rep1 The first visible primitive node |
|
|
* @param[in] rep1 The first visible primitive node |
|
|
* @param[in] rep2 The second visible primitive node |
|
|
* @param[in] rep2 The second visible primitive node |
|
|
|
|
|
* @param[in] modify Whether the aabb of primitive node is need to modify |
|
|
* @return The intersected visible primitive |
|
|
* @return The intersected visible primitive |
|
|
*/ |
|
|
*/ |
|
|
algoim::organizer::VisiblePrimitiveRep intersectNode(const algoim::organizer::VisiblePrimitiveRep& rep1, |
|
|
algoim::organizer::VisiblePrimitiveRep intersectNode(const algoim::organizer::VisiblePrimitiveRep& rep1, |
|
|
const algoim::organizer::VisiblePrimitiveRep& rep2) |
|
|
const algoim::organizer::VisiblePrimitiveRep& rep2, |
|
|
|
|
|
const bool modify = true) |
|
|
{ |
|
|
{ |
|
|
auto tree = createEmptyBlobTree(); |
|
|
auto tree = createEmptyBlobTree(); |
|
|
tree.structure[2].nodeOp = 1; |
|
|
tree.structure[2].nodeOp = 1; |
|
@ -280,9 +301,26 @@ public: |
|
|
result.aabb = rep1.aabb; |
|
|
result.aabb = rep1.aabb; |
|
|
result.aabb.intersect(rep2.aabb); |
|
|
result.aabb.intersect(rep2.aabb); |
|
|
|
|
|
|
|
|
for (auto& iter : minimalReps) |
|
|
if (modify) |
|
|
{ |
|
|
{ |
|
|
result.tensors.push_back(iter.tensor); |
|
|
for (auto& iter : minimalReps) |
|
|
|
|
|
{ |
|
|
|
|
|
result.tensors.push_back(iter.tensor); |
|
|
|
|
|
result.aabbs.push_back(iter.aabb); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
for (auto& iter : rep1.tensors) |
|
|
|
|
|
{ |
|
|
|
|
|
result.tensors.push_back(iter); |
|
|
|
|
|
} |
|
|
|
|
|
for (auto& iter : rep2.tensors) |
|
|
|
|
|
{ |
|
|
|
|
|
result.tensors.push_back(iter); |
|
|
|
|
|
} |
|
|
|
|
|
result.aabbs = rep1.aabbs; |
|
|
|
|
|
result.aabbs.insert(result.aabbs.end(), rep2.aabbs.begin(), rep2.aabbs.end()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return result; |
|
|
return result; |
|
@ -292,10 +330,12 @@ public: |
|
|
* @brief Difference two visible primitive node |
|
|
* @brief Difference two visible primitive node |
|
|
* @param[in] rep1 The first visible primitive node |
|
|
* @param[in] rep1 The first visible primitive node |
|
|
* @param[in] rep2 The second visible primitive node |
|
|
* @param[in] rep2 The second visible primitive node |
|
|
|
|
|
* @param[in] modify Whether the aabb of primitive node is need to modify |
|
|
* @return The differenced visible primitive |
|
|
* @return The differenced visible primitive |
|
|
*/ |
|
|
*/ |
|
|
algoim::organizer::VisiblePrimitiveRep differentNode(const algoim::organizer::VisiblePrimitiveRep& rep1, |
|
|
algoim::organizer::VisiblePrimitiveRep differentNode(const algoim::organizer::VisiblePrimitiveRep& rep1, |
|
|
const algoim::organizer::VisiblePrimitiveRep& rep2) |
|
|
const algoim::organizer::VisiblePrimitiveRep& rep2, |
|
|
|
|
|
const bool modify = true) |
|
|
{ |
|
|
{ |
|
|
auto tree = createEmptyBlobTree(); |
|
|
auto tree = createEmptyBlobTree(); |
|
|
tree.structure[2].nodeOp = 2; |
|
|
tree.structure[2].nodeOp = 2; |
|
@ -308,9 +348,26 @@ public: |
|
|
result.subBlobTree = tree; |
|
|
result.subBlobTree = tree; |
|
|
result.aabb = rep1.aabb; |
|
|
result.aabb = rep1.aabb; |
|
|
|
|
|
|
|
|
for (auto& iter : minimalReps) |
|
|
if (modify) |
|
|
|
|
|
{ |
|
|
|
|
|
for (auto& iter : minimalReps) |
|
|
|
|
|
{ |
|
|
|
|
|
result.tensors.push_back(iter.tensor); |
|
|
|
|
|
result.aabbs.push_back(iter.aabb); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
{ |
|
|
{ |
|
|
result.tensors.push_back(iter.tensor); |
|
|
for (auto& iter : rep1.tensors) |
|
|
|
|
|
{ |
|
|
|
|
|
result.tensors.push_back(iter); |
|
|
|
|
|
} |
|
|
|
|
|
for (auto& iter : rep2.tensors) |
|
|
|
|
|
{ |
|
|
|
|
|
result.tensors.push_back(iter); |
|
|
|
|
|
} |
|
|
|
|
|
result.aabbs = rep1.aabbs; |
|
|
|
|
|
result.aabbs.insert(result.aabbs.end(), rep2.aabbs.begin(), rep2.aabbs.end()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return result; |
|
|
return result; |
|
@ -320,8 +377,20 @@ public: |
|
|
{ |
|
|
{ |
|
|
auto& rep1 = this->m_allVisible[body1]; |
|
|
auto& rep1 = this->m_allVisible[body1]; |
|
|
auto& rep2 = this->m_allVisible[body2]; |
|
|
auto& rep2 = this->m_allVisible[body2]; |
|
|
|
|
|
algoim::organizer::VisiblePrimitiveRep result; |
|
|
|
|
|
|
|
|
auto result = this->unionNode(rep1, rep2); |
|
|
if (rep1.isEmpty()) |
|
|
|
|
|
{ |
|
|
|
|
|
result = rep2; |
|
|
|
|
|
} |
|
|
|
|
|
else if (rep2.isEmpty()) |
|
|
|
|
|
{ |
|
|
|
|
|
result = rep1; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
result = this->differentNode(rep1, rep2, false); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
this->m_allVisible[body1] = result; |
|
|
this->m_allVisible[body1] = result; |
|
|
} |
|
|
} |
|
@ -330,8 +399,16 @@ public: |
|
|
{ |
|
|
{ |
|
|
auto& rep1 = this->m_allVisible[body1]; |
|
|
auto& rep1 = this->m_allVisible[body1]; |
|
|
auto& rep2 = this->m_allVisible[body2]; |
|
|
auto& rep2 = this->m_allVisible[body2]; |
|
|
|
|
|
algoim::organizer::VisiblePrimitiveRep result; |
|
|
|
|
|
|
|
|
auto result = this->intersectNode(rep1, rep2); |
|
|
if (rep1.isEmpty() || rep2.isEmpty()) |
|
|
|
|
|
{ |
|
|
|
|
|
result = algoim::organizer::VisiblePrimitiveRep{}; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
result = this->differentNode(rep1, rep2, false); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
this->m_allVisible[body1] = result; |
|
|
this->m_allVisible[body1] = result; |
|
|
} |
|
|
} |
|
@ -340,8 +417,16 @@ public: |
|
|
{ |
|
|
{ |
|
|
auto& rep1 = this->m_allVisible[body1]; |
|
|
auto& rep1 = this->m_allVisible[body1]; |
|
|
auto& rep2 = this->m_allVisible[body2]; |
|
|
auto& rep2 = this->m_allVisible[body2]; |
|
|
|
|
|
algoim::organizer::VisiblePrimitiveRep result; |
|
|
|
|
|
|
|
|
auto result = this->differentNode(rep1, rep2); |
|
|
if (rep1.isEmpty() || rep2.isEmpty()) |
|
|
|
|
|
{ |
|
|
|
|
|
result = rep1; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
result = this->differentNode(rep1, rep2, false); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
this->m_allVisible[body1] = result; |
|
|
this->m_allVisible[body1] = result; |
|
|
} |
|
|
} |
|
@ -365,7 +450,7 @@ public: |
|
|
{ |
|
|
{ |
|
|
auto& rep = this->m_allVisible[body]; |
|
|
auto& rep = this->m_allVisible[body]; |
|
|
auto halfPlane = this->createHalfPlane(basePoint, -normal); |
|
|
auto halfPlane = this->createHalfPlane(basePoint, -normal); |
|
|
auto result = this->intersectNode(rep, halfPlane); |
|
|
auto result = this->intersectNode(rep, halfPlane, false); |
|
|
this->m_allVisible[body] = result; |
|
|
this->m_allVisible[body] = result; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -475,7 +560,7 @@ public: |
|
|
algoim::algoimSparkAllocHeapVector(temp, halfPlane.tensors); |
|
|
algoim::algoimSparkAllocHeapVector(temp, halfPlane.tensors); |
|
|
algoim::organizer::makeHalfPlane(halfPlaneDesc, halfPlane); |
|
|
algoim::organizer::makeHalfPlane(halfPlaneDesc, halfPlane); |
|
|
this->m_allPointer.push_back(temp[0]); |
|
|
this->m_allPointer.push_back(temp[0]); |
|
|
|
|
|
halfPlane.aabbs.push_back(halfPlane.aabb); |
|
|
return halfPlane; |
|
|
return halfPlane; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -489,8 +574,6 @@ public: |
|
|
const std::vector<double>& bulges, |
|
|
const std::vector<double>& bulges, |
|
|
const Vector3D& extusion) |
|
|
const Vector3D& extusion) |
|
|
{ |
|
|
{ |
|
|
assert(bulges[0] >= 0.0 && bulges[1] >= 0.0); |
|
|
|
|
|
|
|
|
|
|
|
auto normal = Direction3D(extusion); |
|
|
auto normal = Direction3D(extusion); |
|
|
auto& point1 = points[0]; |
|
|
auto& point1 = points[0]; |
|
|
auto& point2 = points[1]; |
|
|
auto& point2 = points[1]; |
|
@ -555,11 +638,16 @@ public: |
|
|
rep1 = getPrimitive(point1, point2, bulge1); |
|
|
rep1 = getPrimitive(point1, point2, bulge1); |
|
|
rep2 = getPrimitive(point2, point1, bulge2); |
|
|
rep2 = getPrimitive(point2, point1, bulge2); |
|
|
|
|
|
|
|
|
/* if the bulge == 1 and bulge == 2, it is a cylinder */ |
|
|
/* if the bulge == 1 and bulge == 1, it is a cylinder */ |
|
|
if (std::abs(bulge1 - 1.0) < 1e-8 && std::abs(bulge2 - 1.0) < 1e-8) |
|
|
if (std::abs(bulge1 - 1.0) < 1e-8 && std::abs(bulge2 - 1.0) < 1e-8) |
|
|
{ |
|
|
{ |
|
|
result = getPrimitive(point1, point2, bulge1); |
|
|
result = getPrimitive(point1, point2, bulge1); |
|
|
} |
|
|
} |
|
|
|
|
|
/* if the bulge == -1 and bulge == -1, it is a cylinder */ |
|
|
|
|
|
else if (std::abs(bulge1 + 1.0) < 1e-8 && std::abs(bulge2 + 1.0) < 1e-8) |
|
|
|
|
|
{ |
|
|
|
|
|
result = getPrimitive(point1, point2, bulge1); |
|
|
|
|
|
} |
|
|
/* if the bulge1 and bulge2 has the same symbol, it is merge */ |
|
|
/* if the bulge1 and bulge2 has the same symbol, it is merge */ |
|
|
else if (bulge1 * bulge2 > 0.0) |
|
|
else if (bulge1 * bulge2 > 0.0) |
|
|
{ |
|
|
{ |
|
@ -707,6 +795,11 @@ public: |
|
|
base = this->unionNode(base, halfPlane1); |
|
|
base = this->unionNode(base, halfPlane1); |
|
|
base = this->unionNode(base, halfPlane2); |
|
|
base = this->unionNode(base, halfPlane2); |
|
|
|
|
|
|
|
|
|
|
|
for (size_t i = 0; i < base.aabbs.size(); i++) |
|
|
|
|
|
{ |
|
|
|
|
|
base.aabbs[i] = base.aabb; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
this->m_allVisible.push_back(base); |
|
|
this->m_allVisible.push_back(base); |
|
|
|
|
|
|
|
|
return this->m_allVisible.size() - 1; |
|
|
return this->m_allVisible.size() - 1; |
|
@ -743,19 +836,155 @@ public: |
|
|
algoim::algoimSparkAllocHeapVector(temp, cone.tensors); |
|
|
algoim::algoimSparkAllocHeapVector(temp, cone.tensors); |
|
|
algoim::organizer::makeCone(coneDesc, cone); |
|
|
algoim::organizer::makeCone(coneDesc, cone); |
|
|
|
|
|
|
|
|
|
|
|
for (auto& pointer : temp) |
|
|
|
|
|
{ |
|
|
|
|
|
this->m_allPointer.push_back(pointer); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 3; i++) |
|
|
|
|
|
{ |
|
|
|
|
|
cone.aabbs.push_back(cone.aabb); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
this->m_allVisible.push_back(cone); |
|
|
this->m_allVisible.push_back(cone); |
|
|
|
|
|
return this->m_allVisible.size() - 1; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
BodyTag addBox(const Point3D& leftBottomPoint, const double length, const double width, const double height) |
|
|
|
|
|
{ |
|
|
|
|
|
auto size = Vector3D{length, width, height}; |
|
|
|
|
|
auto boxDesc = |
|
|
|
|
|
algoim::organizer::CuboidDesc{(leftBottomPoint + (size / 2.0)).getUVector3Data(), size.getUVector3Data()}; |
|
|
|
|
|
algoim::organizer::VisiblePrimitiveRep box; |
|
|
|
|
|
box.tensors.resize(6, algoim::tensor3(nullptr, 3)); |
|
|
|
|
|
std::vector<algoim::SparkStack<algoim::real>*> temp; |
|
|
|
|
|
algoim::algoimSparkAllocHeapVector(temp, box.tensors); |
|
|
|
|
|
algoim::organizer::makeMesh(boxDesc, box); |
|
|
|
|
|
|
|
|
for (auto& pointer : temp) |
|
|
for (auto& pointer : temp) |
|
|
{ |
|
|
{ |
|
|
this->m_allPointer.push_back(pointer); |
|
|
this->m_allPointer.push_back(pointer); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 6; i++) |
|
|
|
|
|
{ |
|
|
|
|
|
box.aabbs.push_back(box.aabb); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this->m_allVisible.push_back(box); |
|
|
return this->m_allVisible.size() - 1; |
|
|
return this->m_allVisible.size() - 1; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
BodyTag addCylinder(const Point3D& bottomOrigion, const double radius, const Vector3D& offset) |
|
|
|
|
|
{ |
|
|
|
|
|
auto normal = Direction3D{offset}; |
|
|
|
|
|
/* Determine which axis is aligned */ |
|
|
|
|
|
int alignAxis; |
|
|
|
|
|
if (normal.isParallel(Direction3D(1, 0, 0))) |
|
|
|
|
|
{ |
|
|
|
|
|
alignAxis = 0; |
|
|
|
|
|
} |
|
|
|
|
|
else if (normal.isParallel(Direction3D(0, 1, 0))) |
|
|
|
|
|
{ |
|
|
|
|
|
alignAxis = 1; |
|
|
|
|
|
} |
|
|
|
|
|
else if (normal.isParallel(Direction3D(0, 0, 1))) |
|
|
|
|
|
{ |
|
|
|
|
|
alignAxis = 2; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
throw std::runtime_error("Non align axis cylinder."); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
algoim::uvector3 ext = 3; |
|
|
|
|
|
ext(alignAxis) = 1; |
|
|
|
|
|
|
|
|
|
|
|
algoim::organizer::VisiblePrimitiveRep cylinder; |
|
|
|
|
|
cylinder.tensors.resize(3, algoim::tensor3(nullptr, 3)); |
|
|
|
|
|
cylinder.tensors[0].ext_ = ext; |
|
|
|
|
|
std::vector<algoim::SparkStack<algoim::real>*> temp; |
|
|
|
|
|
algoim::algoimSparkAllocHeapVector(temp, cylinder.tensors); |
|
|
|
|
|
algoim::organizer::CylinderDesc cylinderDesc( |
|
|
|
|
|
bottomOrigion.getUVector3Data(), radius, offset.length(), alignAxis); |
|
|
|
|
|
|
|
|
|
|
|
for (auto& pointer : temp) |
|
|
|
|
|
{ |
|
|
|
|
|
this->m_allPointer.push_back(pointer); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 3; i++) |
|
|
|
|
|
{ |
|
|
|
|
|
cylinder.aabbs.push_back(cylinder.aabb); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this->m_allVisible.push_back(cylinder); |
|
|
|
|
|
return this->m_allVisible.size() - 1; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
BodyTag addEmpty() |
|
|
|
|
|
{ |
|
|
|
|
|
algoim::organizer::VisiblePrimitiveRep empty; |
|
|
|
|
|
this->m_allVisible.push_back(empty); |
|
|
|
|
|
return this->m_allVisible.size() - 1; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
std::pair<double, double> getAreaAndVolume(const BodyTag& tag) |
|
|
|
|
|
{ |
|
|
|
|
|
auto& rep = this->m_allVisible[tag]; |
|
|
|
|
|
assert(rep.tensors.size() == rep.aabbs.size()); |
|
|
|
|
|
|
|
|
|
|
|
std::vector<algoim::organizer::MinimalPrimitiveRep> minimalReps; |
|
|
|
|
|
algoim::uvector3 range = rep.aabb.max - rep.aabb.min; |
|
|
|
|
|
for (size_t i = 0; i < rep.tensors.size(); i++) |
|
|
|
|
|
{ |
|
|
|
|
|
auto& tenser = rep.tensors[i]; |
|
|
|
|
|
|
|
|
|
|
|
algoim::organizer::detail::powerTransformation(range, rep.aabb.min, tenser); |
|
|
|
|
|
algoim::organizer::detail::power2BernsteinTensor(tenser); |
|
|
|
|
|
|
|
|
|
|
|
algoim::organizer::MinimalPrimitiveRep minimalRep{tenser, rep.aabbs[i]}; |
|
|
|
|
|
minimalReps.push_back(minimalRep); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
auto size = rep.aabb.size(); |
|
|
|
|
|
algoim::organizer::Scene scene{minimalReps, |
|
|
|
|
|
algoim::organizer::AABB(rep.aabb.min - size * 1e-5, rep.aabb.max + size * 1e-5)}; |
|
|
|
|
|
algoim::organizer::OcTreeNode rootNode(0, 1, rep.subBlobTree); |
|
|
|
|
|
for (int i = 0; i < minimalReps.size(); ++i) |
|
|
|
|
|
{ |
|
|
|
|
|
rootNode.polyIntersectIndices.emplace_back(i); |
|
|
|
|
|
} |
|
|
|
|
|
int cnt = 1; |
|
|
|
|
|
std::vector<algoim::organizer::OcTreeNode> leaves; |
|
|
|
|
|
algoim::organizer::buildOcTreeV0(scene, rootNode, leaves, 1, cnt, 0, -1); |
|
|
|
|
|
std::cout << "octree built over" << std::endl; |
|
|
|
|
|
// basicTask(scene, leaves[14], q);
|
|
|
|
|
|
|
|
|
|
|
|
int i = 0; |
|
|
|
|
|
int q = 10; |
|
|
|
|
|
double volume = 0; |
|
|
|
|
|
double area = 0; |
|
|
|
|
|
for (const auto& leaf : leaves) |
|
|
|
|
|
{ |
|
|
|
|
|
auto basicRes = algoim::organizer::basicTask(scene, leaf, q); |
|
|
|
|
|
if (std::isinf(basicRes.volume)) |
|
|
|
|
|
{ |
|
|
|
|
|
std::cout << "inf volume when solving leaf: " << i << std::endl; |
|
|
|
|
|
} |
|
|
|
|
|
volume += basicRes.volume; |
|
|
|
|
|
std::cout << "Solved leaves: " << ++i << "/" << leaves.size() |
|
|
|
|
|
<< ", primitive cnt: " << leaf.polyIntersectIndices.size() << ", volume: " << volume << std::endl; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
volume *= algoim::prod(rep.aabb.max - rep.aabb.min); |
|
|
|
|
|
std::cout << "Volume xxx: " << volume << std::endl; |
|
|
|
|
|
|
|
|
|
|
|
return std::make_pair(area, volume); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
void output(const BodyTag& tag) |
|
|
void output(const BodyTag& tag) |
|
|
{ |
|
|
{ |
|
|
auto rep = this->m_allVisible[tag]; |
|
|
|
|
|
auto result = rep.tensors[0].m(algoim::uvector3(0)); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private: |
|
|
private: |
|
|