Closed andreasala98 closed 3 years ago
@andreasala98, could you show us the build that you used for that complicated shape? Also, did you have problems when you made a CSG shape out of CSG Shapes, or was it already bugged when you tried a CSG with "primitive" Shapes?
Hey @PietroKlausner, below is the code I used to (try to) generate that shape. As you can see from this the cylinder part works fine, because it is made of CSG Unions only. On the other hand, the CSG intersection between the Cube and the Sphere fails when the sphere exceeds the faces of the cube. It works fine when the sphere is fully inside the cube (i.e. the result of the intersection is just the blue sphere)
Shape C1 = new Cylinder(Tsf.Scaling(0.5f, 0.5f, 1.5f), cylMat);
Shape C2 = new Cylinder(Tsf.RotationY(Utility.DegToRad(45)) *
Tsf.RotationX(CC.PI / 2f) *
Tsf.Scaling(0.5f, 0.5f, 1.5f), cylMat);
Shape C3 = new Cylinder(Tsf.RotationX(Utility.DegToRad(-45)) *
Tsf.RotationY(CC.PI / 2f) *
Tsf.Scaling(0.5f, 0.5f, 1.5f), cylMat);
Shape S1 = new Sphere(Tsf.Scaling(1.5f), BrightBlueMat);
Shape B1 = new Box(material: BrightRedMat);
Shape left = S1 * B1; // intersection
Shape right = (C1 + C2) + C3; //union
Shape tot = left - right; //difference
world.addShape(tot);
This bug should be' fixed now. Can I close the issue?
Ok for me!
Hi, I was trying to implement this shape and I found a bug in CSGIntersection (it could also be in CSGDifference). The error log is quite long, it says something like
so it's probably related to the RayIntersectionList method.
We will need to spend some time on this, soon or later!