I am using JCSG libraries to cut 3D object, but after difference operation resultant 3D mesh is not completely closed i.e. many edges of the cutting surface are open, they didn't belong to any triangle.
I am using below source code to cut 3D mesh.
MeshView box = new MeshView(cube);
CSG boxCSG = MeshUtils.mesh2CSG(box);
CSG testmesh = MeshUtils.mesh2CSG(test.getMesh());
CSG cutCSG = testmesh.difference(boxCSG.transformed(Transform.unity().translateZ(-10000)));
CSGMesh cutMesh = new CSGMesh(cutCSG);
Test object is displayed as below
After performing difference operation on test mesh, resultant mesh looks like :
In above image, if you see cut surface, there are only 5 triangles and many edges are open. Also triangles present on top surface are distorted.
Is there any other API to get completely closed surface and which also retains symmetry of triangle after difference operation?
Points and Faces of initial 3D shape is as below:
Points : [3143.0,643.8,-3391.5,2843.1,643.8,-3391.0,3143.0,-643.8,-3391.5,2000.0,-227.0,-3367.2,2000.0,227.0,-3367.2,2000.0,559.9,-3367.2,2000.0,-559.9,-3367.2,2843.1,-643.8,-3391.0,3143.0,0.0,-3391.5,2264.4,586.2,-3378.7,2273.1,-587.1,-3379.0,3143.0,378.2,-3391.5,2560.1,-615.6,-3387.1,3143.0,-381.1,-3391.5,2525.3,612.2,-3386.4,2433.3,28.1,-3384.3,2788.8,84.0,-3390.5,2670.6,347.8,-3389.0,2751.3,-352.0,-3390.1,2312.6,-300.8,-3380.4,2373.0,329.8,-3382.4,2000.0,559.9,-3000.0,3205.0,650.0,-3000.0,2905.0,650.0,-3000.0,2276.6,587.4,-3000.0,2560.3,615.7,-3000.0,2000.0,-559.9,-3000.0,3205.0,-650.0,-3000.0,2905.0,-650.0,-3000.0,2298.6,-589.6,-3000.0,2653.1,-624.9,-3000.0,3205.0,332.5,-3000.0,3205.0,16.6,-3000.0,3205.0,-237.5,-3000.0,2000.0,-227.0,-3000.0,2000.0,227.0,-3000.0,2287.6,104.2,-3000.0,2635.5,238.3,-3000.0,2273.2,-151.8,-3000.0,2650.8,-252.1,-3000.0,2912.7,239.9,-3000.0,2922.2,-23.5,-3000.0,2937.4,-339.6,-3000.0,]
Faces : [6, 0, 26, 0, 3, 0, 26, 0, 34, 0, 3, 0, 5, 0, 4, 0, 21, 0, 21, 0, 4, 0, 35, 0, 4, 0, 3, 0, 34, 0, 35, 0, 4, 0, 34, 0, 35, 0, 36, 0, 21, 0, 38, 0, 36, 0, 34, 0, 38, 0, 34, 0, 26, 0, 39, 0, 36, 0, 38, 0, 40, 0, 31, 0, 37, 0, 31, 0, 23, 0, 37, 0, 31, 0, 22, 0, 23, 0, 31, 0, 40, 0, 32, 0, 32, 0, 40, 0, 41, 0, 39, 0, 37, 0, 36, 0, 39, 0, 41, 0, 37, 0, 37, 0, 41, 0, 40, 0, 39, 0, 32, 0, 41, 0, 39, 0, 33, 0, 32, 0, 28, 0, 42, 0, 39, 0, 28, 0, 27, 0, 42, 0, 28, 0, 39, 0, 30, 0, 39, 0, 42, 0, 33, 0, 38, 0, 29, 0, 39, 0, 39, 0, 29, 0, 30, 0, 29, 0, 38, 0, 26, 0, 34, 0, 36, 0, 35, 0, 25, 0, 37, 0, 23, 0, 24, 0, 21, 0, 36, 0, 24, 0, 37, 0, 25, 0, 24, 0, 36, 0, 37, 0, 33, 0, 42, 0, 27, 0, 8, 0, 31, 0, 32, 0, 11, 0, 31, 0, 8, 0, 13, 0, 32, 0, 33, 0, 8, 0, 32, 0, 13, 0, 27, 0, 2, 0, 33, 0, 33, 0, 2, 0, 13, 0, 31, 0, 0, 0, 22, 0, 11, 0, 0, 0, 31, 0, 12, 0, 7, 0, 28, 0, 29, 0, 10, 0, 12, 0, 30, 0, 29, 0, 12, 0, 30, 0, 12, 0, 28, 0, 28, 0, 2, 0, 27, 0, 28, 0, 7, 0, 2, 0, 29, 0, 6, 0, 10, 0, 26, 0, 6, 0, 29, 0, 9, 0, 21, 0, 24, 0, 22, 0, 0, 0, 23, 0, 24, 0, 14, 0, 9, 0, 25, 0, 14, 0, 24, 0, 1, 0, 14, 0, 25, 0, 1, 0, 25, 0, 23, 0, 9, 0, 5, 0, 21, 0, 0, 0, 1, 0, 23, 0, 5, 0, 9, 0, 4, 0, 15, 0, 4, 0, 9, 0, 15, 0, 9, 0, 20, 0, 9, 0, 17, 0, 20, 0, 10, 0, 6, 0, 3, 0, 3, 0, 15, 0, 19, 0, 15, 0, 16, 0, 18, 0, 10, 0, 19, 0, 18, 0, 16, 0, 11, 0, 8, 0, 17, 0, 1, 0, 11, 0, 1, 0, 9, 0, 14, 0, 1, 0, 16, 0, 9, 0, 1, 0, 17, 0, 16, 0, 7, 0, 13, 0, 2, 0, 7, 0, 18, 0, 13, 0, 19, 0, 10, 0, 3, 0, 15, 0, 3, 0, 4, 0, 17, 0, 15, 0, 20, 0, 8, 0, 18, 0, 16, 0, 17, 0, 9, 0, 16, 0, 17, 0, 16, 0, 15, 0, 13, 0, 18, 0, 8, 0, 15, 0, 18, 0, 19, 0, 12, 0, 18, 0, 7, 0, 12, 0, 10, 0, 18, 0, 15, 0, 16, 0, 17, 0, 15, 0, 17, 0, 16, 0, 1, 0, 0, 0, 11, 0, 16, 0, 17, 0, 11, 0,]