为什么一个三角形隐藏在一个透明的立方体内

huangapple go评论93阅读模式
英文:

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:

为什么一个三角形隐藏在一个透明的立方体内

huangapple
  • 本文由 发表于 2023年5月14日 12:48:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/76245858.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定