英文:
Why is a triangle hidden inside a transparent cube
问题
I have this OpenSCAD script:
color([1, 1, 1, 0.2]) cube(80, center=false);
p1 = [80/2, 0, 0];
p2 = [80, 80/2, 0];
p3 = [80, 0, 80/2];
color([0, 1, 0, 0.9]) polyhedron(points=[p1, p2, p3], faces=[[0, 1, 2]]);
For some reason the triangle is hidden inside the transparent cube:
But when I comment out the cube statement, the triangle can be seen:
Why should a triangle be hidden inside a transparent cube? How can I display the triangle inside the transparent cube?
英文:
I have this OpenSCAD script:
color([1, 1, 1, 0.2]) cube(80, center=false);
p1 = [80/2, 0, 0];
p2 = [80, 80/2, 0];
p3 = [80, 0, 80/2];
color([0, 1, 0, 0.9]) polyhedron(points=[p1, p2, p3], faces=[[0, 1, 2]]);
For some reason the triangle is hidden inside the transparent cube:
But when I comment out the cube statement, the triangle can be seen:
Why should a triangle be hidden inside a transparent cube? How can I display the triangle inside the transparent cube?
答案1
得分: 0
这段代码已经生效。看起来应该先绘制三角形,然后再绘制立方体。
英文:
This code worked. Looks like triangle should be drawn first and then the cube:
p1 = [80/2, 0, 0];
p2 = [80, 80/2, 0];
p3 = [80, 0, 80/2];
color([0, 1, 0, 0.9]) polyhedron(points=[p1, p2, p3], faces=[[0, 1, 2]]);
color([1, 1, 1, 0.2]) cube(80, center=false);
Now both triangle and cube are shown properly:
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论