plunkerでopenjscad その2
1472 ワード
概要
plunkerでopenjscadやってみる。
union使ってみた。
プリミティブを表示。
写真
サンプルコード
function main() {
//var a = CSG.cube();
var a = CSG.cube({
center: [4, 0, 0],
radius: [1, 1, 1]
});
var b = CSG.sphere({
radius: 1.35,
center: [0, 4, 0],
resolution: 32
});
var c = CSG.cylinder({
start: [0, 0, 3],
end: [0, 0, 5],
radius: 1,
resolution: 32
});
var d = CSG.roundedCube({
center: [4, 0, 3],
radius: 1,
roundradius: 0.2,
resolution: 16
});
var e = CSG.roundedCylinder({
start: [4, -1, 6],
end: [4, 1, 6],
radius: 1,
resolution: 16
});
var f = CSG.polyhedron({
points: [[1, 1, 0], [1, -1, 0], [-1, -1, 0], [-1, 1, 0], [0, 0, 1]],
faces: [[0, 1, 4], [1, 2, 4], [2, 3, 4], [3, 0, 4], [1, 0, 3], [2, 1, 3]]
});
return a.union(b.union(c.union(d.union(e.union(f)))));
}
成果物
function main() {
//var a = CSG.cube();
var a = CSG.cube({
center: [4, 0, 0],
radius: [1, 1, 1]
});
var b = CSG.sphere({
radius: 1.35,
center: [0, 4, 0],
resolution: 32
});
var c = CSG.cylinder({
start: [0, 0, 3],
end: [0, 0, 5],
radius: 1,
resolution: 32
});
var d = CSG.roundedCube({
center: [4, 0, 3],
radius: 1,
roundradius: 0.2,
resolution: 16
});
var e = CSG.roundedCylinder({
start: [4, -1, 6],
end: [4, 1, 6],
radius: 1,
resolution: 16
});
var f = CSG.polyhedron({
points: [[1, 1, 0], [1, -1, 0], [-1, -1, 0], [-1, 1, 0], [0, 0, 1]],
faces: [[0, 1, 4], [1, 2, 4], [2, 3, 4], [3, 0, 4], [1, 0, 3], [2, 1, 3]]
});
return a.union(b.union(c.union(d.union(e.union(f)))));
}
以上。
Author And Source
この問題について(plunkerでopenjscad その2), 我々は、より多くの情報をここで見つけました https://qiita.com/ohisama@github/items/794de9b10a03f7c935a0著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .