mirror of https://github.com/vitalif/openscad
Added testcase for concave polygons in polyhedrons
parent
0eaa5333db
commit
c7cea0082e
|
@ -11,10 +11,35 @@ module polyhedrons() {
|
|||
translate([4,0,0])
|
||||
polyhedron(points = [[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],
|
||||
triangles = [[0,2,4],[0,5,2],[0,4,3],[0,3,5],[1,4,2],[1,2,5],[1,3,4], [1,5,3]]);
|
||||
|
||||
// Containing concave polygons
|
||||
translate([6,0,0])
|
||||
polyhedron(points=[
|
||||
[-0.8,-0.8,-0.8],
|
||||
[0,0,-0.8],
|
||||
[0.8,-0.8,-0.8],
|
||||
[0.8,0.8,-0.8],
|
||||
[-0.8,0.8,-0.8],
|
||||
[-0.8,-0.8,0.8],
|
||||
[0,0,0.8],
|
||||
[0.8,-0.8,0.8],
|
||||
[0.8,0.8,0.8],
|
||||
[-0.8,0.8,0.8],
|
||||
],
|
||||
triangles=[
|
||||
[0,1,2,3,4],
|
||||
[5,6,1,0],
|
||||
[6,7,2,1],
|
||||
[7,8,3,2],
|
||||
[8,9,4,3],
|
||||
[9,5,0,4],
|
||||
[9,8,7,6,5],
|
||||
], convexity=2);
|
||||
}
|
||||
|
||||
polyhedrons();
|
||||
translate([0,2,0]) difference() {
|
||||
polyhedrons();
|
||||
translate([2,0,2]) cube([8,3,3], center=true);
|
||||
translate([3,0,2]) cube([8,3,3], center=true);
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 9.0 KiB After Width: | Height: | Size: 8.5 KiB |
|
@ -7,6 +7,9 @@ group() {
|
|||
multmatrix([[1, 0, 0, 4], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
|
||||
polyhedron(points = [[1, 0, 0], [-1, 0, 0], [0, 1, 0], [0, -1, 0], [0, 0, 1], [0, 0, -1]], triangles = [[0, 2, 4], [0, 5, 2], [0, 4, 3], [0, 3, 5], [1, 4, 2], [1, 2, 5], [1, 3, 4], [1, 5, 3]], convexity = 1);
|
||||
}
|
||||
multmatrix([[1, 0, 0, 6], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
|
||||
polyhedron(points = [[-0.8, -0.8, -0.8], [0, 0, -0.8], [0.8, -0.8, -0.8], [0.8, 0.8, -0.8], [-0.8, 0.8, -0.8], [-0.8, -0.8, 0.8], [0, 0, 0.8], [0.8, -0.8, 0.8], [0.8, 0.8, 0.8], [-0.8, 0.8, 0.8]], triangles = [[0, 1, 2, 3, 4], [5, 6, 1, 0], [6, 7, 2, 1], [7, 8, 3, 2], [8, 9, 4, 3], [9, 5, 0, 4], [9, 8, 7, 6, 5]], convexity = 2);
|
||||
}
|
||||
}
|
||||
multmatrix([[1, 0, 0, 0], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) {
|
||||
difference() {
|
||||
|
@ -18,8 +21,11 @@ group() {
|
|||
multmatrix([[1, 0, 0, 4], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
|
||||
polyhedron(points = [[1, 0, 0], [-1, 0, 0], [0, 1, 0], [0, -1, 0], [0, 0, 1], [0, 0, -1]], triangles = [[0, 2, 4], [0, 5, 2], [0, 4, 3], [0, 3, 5], [1, 4, 2], [1, 2, 5], [1, 3, 4], [1, 5, 3]], convexity = 1);
|
||||
}
|
||||
multmatrix([[1, 0, 0, 6], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
|
||||
polyhedron(points = [[-0.8, -0.8, -0.8], [0, 0, -0.8], [0.8, -0.8, -0.8], [0.8, 0.8, -0.8], [-0.8, 0.8, -0.8], [-0.8, -0.8, 0.8], [0, 0, 0.8], [0.8, -0.8, 0.8], [0.8, 0.8, 0.8], [-0.8, 0.8, 0.8]], triangles = [[0, 1, 2, 3, 4], [5, 6, 1, 0], [6, 7, 2, 1], [7, 8, 3, 2], [8, 9, 4, 3], [9, 5, 0, 4], [9, 8, 7, 6, 5]], convexity = 2);
|
||||
}
|
||||
}
|
||||
multmatrix([[1, 0, 0, 2], [0, 1, 0, 0], [0, 0, 1, 2], [0, 0, 0, 1]]) {
|
||||
multmatrix([[1, 0, 0, 3], [0, 1, 0, 0], [0, 0, 1, 2], [0, 0, 0, 1]]) {
|
||||
cube(size = [8, 3, 3], center = true);
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 9.7 KiB |
Binary file not shown.
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 10 KiB |
Loading…
Reference in New Issue