|
@ -135,6 +135,29 @@ void caseCubeSphere() |
|
|
basicTask({phi0, phi1}); |
|
|
basicTask({phi0, phi1}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void caseCone() |
|
|
|
|
|
{ |
|
|
|
|
|
const int PRIMITIVE_CNT = 4; |
|
|
|
|
|
std::vector<std::shared_ptr<PrimitiveDesc>> primitiveDescriptions(PRIMITIVE_CNT); |
|
|
|
|
|
primitiveDescriptions[0] = std::make_shared<CuboidDesc>(CuboidDesc(0.0, 1.6)); |
|
|
|
|
|
primitiveDescriptions[1] = std::make_shared<CuboidDesc>(CuboidDesc(uvector3(0.6, 0.6, -0.6), 2.)); |
|
|
|
|
|
primitiveDescriptions[2] = std::make_shared<SphereDesc>(SphereDesc(0.2, uvector3(0.2, -0.7, 0.), 1.)); |
|
|
|
|
|
primitiveDescriptions[3] = std::make_shared<ConeDesc>(ConeDesc(uvector3(0., -0.2, 0.), 0.4, -0.7, 1)); |
|
|
|
|
|
organizer::BlobTree blobTree; |
|
|
|
|
|
blobTree.structure.resize(PRIMITIVE_CNT * 2 - 1); |
|
|
|
|
|
blobTree.primitiveNodeIdx.resize(PRIMITIVE_CNT); |
|
|
|
|
|
// blobTree.structure[0] = {0, 0, NODE_IN_OUT_UNKNOWN, 0, 1, 2}; // cube1
|
|
|
|
|
|
blobTree.structure[0] = {1, 0, NODE_IN_OUT_UNKNOWN, 0, 1, 2 - 0}; // cube
|
|
|
|
|
|
blobTree.structure[1] = {1, 0, 0, 0, 0, 0}; // cube2
|
|
|
|
|
|
blobTree.structure[2] = {0, OP_UNION, 0, 0, 1, 6 - 2}; // Union of cubes = opNode1
|
|
|
|
|
|
blobTree.structure[3] = {1, 0, NODE_IN_OUT_UNKNOWN, 0, 1, 5 - 3}; // cone
|
|
|
|
|
|
blobTree.structure[4] = {1, 0, NODE_IN_OUT_UNKNOWN, 0, 0, 0}; // sphere
|
|
|
|
|
|
blobTree.structure[5] = {0, OP_UNION, NODE_IN_OUT_UNKNOWN, 0, 0, 0}; // cone u sphere = n1
|
|
|
|
|
|
blobTree.structure[6] = {0, OP_DIFFERENCE, NODE_IN_OUT_UNKNOWN, 0, 0, 0}; // cube - n1 = n2
|
|
|
|
|
|
blobTree.primitiveNodeIdx = {0, 1, 3, 4}; |
|
|
|
|
|
quadratureScene(primitiveDescriptions, uvector3(-0.8, -1.3, -1.6), uvector3(1.6, 1.6, 1.5), blobTree, 10); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
void caseScene() |
|
|
void caseScene() |
|
|
{ |
|
|
{ |
|
|
const int PRIMITIVE_CNT = 6; |
|
|
const int PRIMITIVE_CNT = 6; |
|
@ -152,23 +175,26 @@ void caseScene() |
|
|
}; |
|
|
}; |
|
|
// primitiveDescriptions[4] = std::make_shared<PyramidDesc>(pyramidBottomVertices, uvector3{0, 0, 1});
|
|
|
// primitiveDescriptions[4] = std::make_shared<PyramidDesc>(pyramidBottomVertices, uvector3{0, 0, 1});
|
|
|
primitiveDescriptions[4] = std::make_shared<SphereDesc>(SphereDesc(0.2, uvector3(0.2, -0.7, 0.), 1.)); |
|
|
primitiveDescriptions[4] = std::make_shared<SphereDesc>(SphereDesc(0.2, uvector3(0.2, -0.7, 0.), 1.)); |
|
|
|
|
|
|
|
|
|
|
|
// primitiveDescriptions[5] = std::make_shared<SphereDesc>(SphereDesc(0.2, uvector3(0., -0.5, 0.), 1));
|
|
|
primitiveDescriptions[5] = std::make_shared<ConeDesc>(ConeDesc(uvector3(0., -0.2, 0.), 0.4, -0.7, 1)); |
|
|
primitiveDescriptions[5] = std::make_shared<ConeDesc>(ConeDesc(uvector3(0., -0.2, 0.), 0.4, -0.7, 1)); |
|
|
// primitiveDescriptions[6] = std::make_shared<CylinderDesc>(CylinderDesc(uvector3(-0.3, 0.3, 2.3), 0.4, 3.6, 1));
|
|
|
// primitiveDescriptions[6] = std::make_shared<CylinderDesc>(CylinderDesc(uvector3(-0.3, 0.3, 2.3), 0.4, 3.6, 1));
|
|
|
organizer::BlobTree blobTree; |
|
|
organizer::BlobTree blobTree; |
|
|
blobTree.structure.resize(PRIMITIVE_CNT * 2 - 1); |
|
|
blobTree.structure.resize(PRIMITIVE_CNT * 2 - 1); |
|
|
blobTree.primitiveNodeIdx.resize(PRIMITIVE_CNT); |
|
|
blobTree.primitiveNodeIdx.resize(PRIMITIVE_CNT); |
|
|
blobTree.structure[0] = {1, 0, 0, 0, 1, 2}; // cube1
|
|
|
blobTree.structure[0] = {1, 0, 0, 0, 1, 2}; // cube1
|
|
|
blobTree.structure[1] = {1, 0, 0, 0, 0, 0}; // cube2
|
|
|
blobTree.structure[1] = {1, 0, 0, 0, 0, 0}; // cube2
|
|
|
blobTree.structure[2] = {0, 0, 0, 0, 1, 6 - 2}; // Union of cubes = opNode1
|
|
|
blobTree.structure[2] = {0, OP_UNION, 0, 0, 1, 6 - 2}; // Union of cubes = opNode1
|
|
|
blobTree.structure[3] = {1, 0, 0, 0, 1, 5 - 3}; // sphere1
|
|
|
blobTree.structure[3] = {1, 0, 0, 0, 1, 5 - 3}; // sphere1
|
|
|
blobTree.structure[4] = {1, 0, 0, 0, 0, 0}; // sphere2
|
|
|
blobTree.structure[4] = {1, 0, 0, 0, 0, 0}; // sphere2
|
|
|
blobTree.structure[5] = {0, 0, 0, 0, 0, 0}; // Union of spheres = opNode2
|
|
|
blobTree.structure[5] = {0, OP_UNION, 0, 0, 0, 0}; // Union of spheres = opNode2
|
|
|
blobTree.structure[6] = {0, 2, 0, 0, 1, 10 - 6}; // Difference of opNode1 and opNode2 = opNode3
|
|
|
blobTree.structure[6] = {0, OP_DIFFERENCE, 0, 0, 1, 10 - 6}; // Difference of opNode1 and opNode2 = opNode3
|
|
|
blobTree.structure[7] = {1, 0, 0, 0, 1, 9 - 7}; // Pyramid (sphere3)
|
|
|
blobTree.structure[7] = {1, 0, 0, 0, 1, 9 - 7}; // Pyramid (sphere3)
|
|
|
blobTree.structure[8] = {1, 0, 0, 0, 0, 0}; // Cone
|
|
|
blobTree.structure[8] = {1, 0, 0, 0, 0, 0}; // Cone
|
|
|
blobTree.structure[9] = {0, 0, 0, 0, 0, 0}; // UNION of Pyramid (sphere3) and Cone = opNode4
|
|
|
blobTree.structure[9] = {0, OP_UNION, 0, 0, 0, 0}; // UNION of Pyramid (sphere3) and Cone = opNode4
|
|
|
blobTree.structure[10] = {0, 2, 0, 0, 1, 12 - 10}; // Difference of opNode3 and opNode4 = opNode5
|
|
|
blobTree.structure[10] = { |
|
|
// blobTree.structure[11] = {1, 0, 0, 0, 0, 0}; // Cylinder
|
|
|
0, OP_DIFFERENCE, 0, 0, 1, 12 - 10}; // Difference of opNode3 and opNode4 = opNode5
|
|
|
|
|
|
// blobTree.structure[11] = {1, 0, 0, 0, 0, 0}; // Cylinder
|
|
|
// blobTree.structure[12] = {0, 2, 0, 0, 1, 0}; // Difference of opNode5 and Cylinder
|
|
|
// blobTree.structure[12] = {0, 2, 0, 0, 1, 0}; // Difference of opNode5 and Cylinder
|
|
|
// blobTree.primitiveNodeIdx = {0, 1, 3, 4, 7, 8, 11};
|
|
|
// blobTree.primitiveNodeIdx = {0, 1, 3, 4, 7, 8, 11};
|
|
|
// quadratureScene(primitiveDescriptions, uvector3(-1., -1.3, -1.6), uvector3(1.6, 1.6, 2.3), blobTree);
|
|
|
// quadratureScene(primitiveDescriptions, uvector3(-1., -1.3, -1.6), uvector3(1.6, 1.6, 2.3), blobTree);
|
|
@ -193,6 +219,35 @@ void caseScene1() |
|
|
quadratureScene(primitiveDescriptions, uvector3(-0.8, -1.3, -1.6), uvector3(1.6, 1.6, 1.5), blobTree); |
|
|
quadratureScene(primitiveDescriptions, uvector3(-0.8, -1.3, -1.6), uvector3(1.6, 1.6, 1.5), blobTree); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void caseScene2() |
|
|
|
|
|
{ |
|
|
|
|
|
const int PRIMITIVE_CNT = 4; |
|
|
|
|
|
std::vector<std::shared_ptr<PrimitiveDesc>> primitiveDescriptions(PRIMITIVE_CNT); |
|
|
|
|
|
primitiveDescriptions[0] = std::make_shared<CuboidDesc>(CuboidDesc(0., 1.6)); |
|
|
|
|
|
primitiveDescriptions[1] = std::make_shared<CuboidDesc>(CuboidDesc(uvector3(0.6, 0.6, -0.6), 2.)); |
|
|
|
|
|
primitiveDescriptions[2] = std::make_shared<SphereDesc>(SphereDesc(0.7, uvector3(0.8, 0.8, 0.8), 1.)); |
|
|
|
|
|
primitiveDescriptions[3] = std::make_shared<SphereDesc>(SphereDesc(0.5, uvector3(-0.3, -0.8, 0.8), 1.)); |
|
|
|
|
|
std::vector<uvector3> pyramidBottomVertices = { |
|
|
|
|
|
uvector3{-1, -1, 0}, |
|
|
|
|
|
uvector3{1, -1, 0}, |
|
|
|
|
|
uvector3{1, 1, 0}, |
|
|
|
|
|
uvector3{-1, 1, 0} |
|
|
|
|
|
}; |
|
|
|
|
|
organizer::BlobTree blobTree; |
|
|
|
|
|
blobTree.structure.resize(PRIMITIVE_CNT * 2 - 1); |
|
|
|
|
|
blobTree.primitiveNodeIdx.resize(PRIMITIVE_CNT); |
|
|
|
|
|
// blobTree.structure[0] = {0, 0, NODE_IN_OUT_UNKNOWN, 0, 1, 2}; // cube1
|
|
|
|
|
|
blobTree.structure[0] = {1, 0, NODE_IN_OUT_UNKNOWN, 0, 1, 2 - 0}; // cube1
|
|
|
|
|
|
blobTree.structure[1] = {1, 0, NODE_IN_OUT_UNKNOWN, 0, 0, 0}; // cube2
|
|
|
|
|
|
blobTree.structure[2] = {0, OP_UNION, NODE_IN_OUT_UNKNOWN, 0, 1, 6 - 2}; // INTERSECTION of cubes = opNode1
|
|
|
|
|
|
blobTree.structure[3] = {1, 0, 0, 0, 1, 5 - 3}; // sphere1
|
|
|
|
|
|
blobTree.structure[4] = {1, 0, 0, 0, 0, 0}; // sphere2
|
|
|
|
|
|
blobTree.structure[5] = {0, OP_UNION, 0, 0, 0, 0}; // Union of spheres = opNode2
|
|
|
|
|
|
blobTree.structure[6] = {0, OP_DIFFERENCE, 0, 0, 1, 10 - 6}; // Difference of opNode1 and opNode2 = opNode3
|
|
|
|
|
|
blobTree.primitiveNodeIdx = {0, 1, 3, 4}; |
|
|
|
|
|
quadratureScene(primitiveDescriptions, uvector3(-0.8, -1.3, -1.6), uvector3(1.6, 1.6, 1.5), blobTree); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
void testDeCasteljau() |
|
|
void testDeCasteljau() |
|
|
{ |
|
|
{ |
|
|
auto phiDesc = std::make_shared<SphereDesc>(SphereDesc(0.8, uvector3(0), 1.)); |
|
|
auto phiDesc = std::make_shared<SphereDesc>(SphereDesc(0.8, uvector3(0), 1.)); |
|
@ -360,8 +415,10 @@ void testPrimitive() |
|
|
// casePolyhedronSphere();
|
|
|
// casePolyhedronSphere();
|
|
|
// testSubDivideWithDeCasteljau();
|
|
|
// testSubDivideWithDeCasteljau();
|
|
|
// testBlob();
|
|
|
// testBlob();
|
|
|
// caseScene();
|
|
|
caseScene(); |
|
|
caseScene1(); |
|
|
// caseScene1();
|
|
|
|
|
|
// caseScene2();
|
|
|
|
|
|
// caseCone();
|
|
|
// testPlaneWithinSubcell();
|
|
|
// testPlaneWithinSubcell();
|
|
|
// caseCubeSphere();
|
|
|
// caseCubeSphere();
|
|
|
// caseTwoCube();
|
|
|
// caseTwoCube();
|
|
|