≡
Stefan Triess
Home
News
Über uns
Leistungen
Projekte
Persönlich
Kooperation
Kontakt
Lab
Demo 1
WebGl CSG-3D-Demo
Demo 2
mehr CSG-Möglichkeiten
Demo 3
Abbund-Animation
Impressum
Abbund WebGl CSG-3D-Demo
Surface
Wire
Line Overlay
Auswahl löschen
Anschlag
Anschnitt links
Säge links
unten
Alle
Keiner
Kleine Nut oben links
Freimachung oben
Nut oben rechts
Bohrung vorne rechts
Zapfen rechts
Alle
Keiner
Zapfenloch hinten
Fräser hinten
Alle
Keiner
Bohrungen kreuz. links
X-Nut oben
Halbkugel vorne
Alle
Keiner
Schlitz R,4
Schlitz R,1
Kerve oben rechts
Alle
Keiner
Kugel
Maßlinien (...)
Alle auswählen
function checked(name) { var chk = document.getElementById(name); if (!chk) return true; return chk.checked; } function union(base) { if(arguments.length <= 1) return base; var ret = base; for (var i = 1; i < arguments.length; i++) { if(arguments[i]) ret = ret.union(arguments[i]); } return ret; } // var plane_1 = CSG.Plane.fromPoints(new CSG.Vector(1,0,0), new CSG.Vector(0,1,0), new CSG.Vector(0,0,1)); if(checked("chkAnschlag")) { var anschlag_unten = CSG.cube({ radius: [2.2, 0.01, 0.6], center: [0, -0.51, 0.1] }); var anschlag_hinten = CSG.cube({ radius: [2.2, 0.1, 0.01], center: [0, -0.45, -0.51] }); var anschlag = anschlag_hinten.union(anschlag_unten); anschlag.setColor(1.3,1.3,3); if(checked("chkSaege")) { var anschlag_gap = CSG.cube({ radius: [0.05, 0.1, 0.61], center: [-1.81, -0.45, 0.09]}); anschlag = anschlag.subtract(anschlag_gap) } } var left = CSG.cube({ center: [-1.9, 0, 0], radius: [0.1, 0.5, 0.5] }); left.setColor(0.5, 2, 0.5); var cube = CSG.cube({ center: [0, 0, 0], radius: [1.8, 0.5, 0.5] }); cube.setColor(1, 3, 0.5); if(checked("chkFrei")) { var frei = CSG.cube({ center: [-0.5, 0.45, 0], radius: [0.4, 0.05, 0.15] }); frei.setColor(0.8, 2, 0.4); } if(checked("chkNut")) { var nut = CSG.cube({ center: [1, 0.4, 0], radius: [0.1, 0.1, 0.5] }); nut.setColor(1, 1, 3); } if(checked("chkNut2")) { var nut2 = CSG.cube({ center: [-1.4, 0.45, 0], radius: [0.05, 0.05, 0.5] }); } if(checked("chkBohrung")) { var loch = CSG.cylinder({ radius: 0.1, start: [1.45,0,-0.5], end: [1.45,0,0.5] }); loch.setColor(3, 0.5, 1); } if(checked("chkXNut")) { var xnut = CSG.cylinder({ radius: 0.1, start: [0.7,0.5,-0.7], end: [0.1,0.5,0.7] }) .union(CSG.cylinder({ radius: 0.1, start: [0.1,0.5,-0.7], end: [0.7,0.5,0.7] })) ; xnut.setColor(1, 3, 0.5); } if(checked("chkSphere")) { var sphere = CSG.sphere({radius: 0.4 , center: [0,0,0.6]}); sphere.setColor(1, 3, 0.5); } if(checked("chkKLoch")) { var kloch = CSG.cylinder({ radius: 0.25, start: [-1.4, 0, -0.5], end: [-1.4, 0, 0.5] }) .union(CSG.cylinder({ radius: 0.25, start: [-1.4, 0.5, 0], end: [-1.4, -0.5, 0] })) .union(CSG.cylinder({ radius: 0.25, start: [-1.8, 0 ,0], end: [-1.4, 0, 0] })) ; kloch.setColor(0.5, 2, 1); } if(checked("chkZapfen")) { var zapfen = CSG.cylinder({ radius: 0.25, start: [2, 0.15, 0], end: [1.8, 0.15, 0]}) .union(CSG.cylinder({ radius: 0.25, start: [2, -0.15, 0], end: [1.8, -0.15, 0]})) .union(CSG.cube({ radius: [0.1, 0.15, 0.25], center: [1.9,0,0] })) ; zapfen.setColor(0, 2, 0); } else { var zapfen = CSG.cube({ radius: [0.1, 0.5, 0.5], center: [1.9,0,0] }); zapfen.setColor(1, 3, 0.5); } if(checked("chkZLoch")) { var zloch = CSG.cylinder({ radius: 0.25, start: [-0.15, 0, -0.3], end: [-0.15, 0, -0.501]}) .union(CSG.cylinder({ radius: 0.25, start: [0.15, 0, -0.3], end: [0.15, 0, -0.501]})) .union(CSG.cube({ radius: [0.15, 0.25, 0.1], center: [0,0,-0.401] })) ; zloch.setColor(0, 2.8, 0); } if(checked("chkMLines")) { var mline_1 = CSG.cylinder({ radius: 0.001, start: [-1.8, 0.5, -0.5], end: [-1.8, 0.8, -0.5]}) .union(CSG.cylinder({ radius: 0.001, start: [-1.8, 0.5, 0.5], end: [-1.8, 0.8, 0.5]})) .union(CSG.cylinder({ radius: 0.001, start: [-1.8, 0.75, -0.5], end: [-1.8, 0.75, 0.5]})) ; if(checked("chkZapfen")) { var mline_2 = CSG.cylinder({ radius: 0.001, start: [-1.8, 0.5, -0.5], end: [-1.8, 0.8, -0.5]}) .union(CSG.cylinder({ radius: 0.001, start: [1.8, 0.5, -0.5], end: [1.8, 0.8, -0.5]})) .union(CSG.cylinder({ radius: 0.001, start: [-1.8, 0.75, -0.5], end: [1.8, 0.75, -0.5]})) ; } else { var mline_2 = CSG.cylinder({ radius: 0.001, start: [-1.8, 0.5, -0.5], end: [-1.8, 0.8, -0.5]}) .union(CSG.cylinder({ radius: 0.001, start: [2, 0.5, -0.5], end: [2, 0.8, -0.5]})) .union(CSG.cylinder({ radius: 0.001, start: [-1.8, 0.75, -0.5], end: [2, 0.75, -0.5]})) ; } var mline_3 = CSG.cylinder({ radius: 0.001, start: [-1.8, 0.5, 0.5], end: [-1.8, 0.5, 0.8]}) .union(CSG.cylinder({ radius: 0.001, start: [-1.8, -0.5, 0.5], end: [-1.8, -0.5, 0.8]})) .union(CSG.cylinder({ radius: 0.001, start: [-1.8, 0.5, 0.75], end: [-1.8, -0.5, 0.75]})) ; var mlines = union(mline_1, mline_2, mline_3); mlines.setColor(0,0,0); } if(checked("chkSchlitz1")) { var schlitz1 = CSG.cube({ radius: [0.4, 0.03, 0.5], center: [0, 0, 0] }); schlitz1.setColor(0,2,0); } if(checked("chkSchlitz2")) { var schlitz2 = CSG.cube({ radius: [0.4, 0.5, 0.03], center: [0, 0, 0] }); schlitz2.setColor(0,2,0); } if(checked("chkSaege")) { var saege = (function () { var y = checked("chkSaegeUnten") ? -0.83 : 0.83, z = -0.5; var c = [1.5, 1.5, 1.65]; function cyl(args, color) { var ret = CSG.cylinder(args); var cx = color ? color : c; ret.setColor(cx[0], cx[1], cx[2]); return ret; } var dn = 0.0725; return cyl({ radius: 1.4, start: [-1.79995, y, z], end: [-1.82, y, z], slices: 64}) .union(cyl({ radius: 0.3, start: [-1.78, y, z], end: [-1.84, y, z], slices: 32}, [1.3, 1.3, 1.4])) .union(cyl({ radius: 0.17, start: [-1.7, y, z], end: [-1.92, y, z], slices: 32}, [1.4, 1.4, 1.5])) .subtract(cyl({ radius: 0.1, start: [-1.7, y, z], end: [-1.92, y, z], slices: 32})) .subtract(cyl({ radius: 0.03, start: [-1.7, y-dn, z-dn], end: [-1.92, y-dn, z-dn], slices: 4})) ; })(); } if(checked("chkFraeser")) { var fraeser = CSG.cylinder({ radius: 0.2, start: [-0.15, -0.05, -0.3], end: [-0.15, -0.05, -0.7], slices: 64}) .union(CSG.cylinder({ radius: 0.13, start: [-0.15, -0.05, -0.7], end: [-0.15, -0.05, -1.2]})) // .union(CSG.cube({ radius: [0.15, 0.25, 0.1], center: [0,0,-0.401] })) ; fraeser.setColor(1,0.8,1); } if(checked("chkKerve")) { var kerve = CSG.cylinder({ radius: 0.25, start: [1.55,0.5,0.5], end: [1.55,0.5,-0.5], slices: 3 }); kerve.setColor(0, 3, 0); } var balken = cube.union(zapfen); if(checked("chkKugel")) { var l = 0.5; var cube2 = CSG.cube({ center: [l, 0, 0], radius: [0.67, 0.5, 0.5] }); cube2.setColor(1, 3, 0.5); var sphere2 = CSG.sphere({radius: 0.5, center: [l,0,0], stacks: 16, slices: 32}) .union(CSG.sphere({radius: 1, center: [l + 1.32,0,0], stacks: 16, slices: 32})) .union(CSG.sphere({radius: 1, center: [l - 1.32,0,0], stacks: 16, slices: 32})) ; sphere2.setColor(1, 1, 0); sphere2 = cube2.intersect(sphere2); } var ret = balken; if(checked("chkKugel")) ret = ret.subtract(cube2).union(sphere2); if(checked("chkFrei")) ret = ret.subtract(frei); if(checked("chkNut")) ret = ret.subtract(nut); if(checked("chkNut2")) ret = ret.subtract(nut2); if(checked("chkBohrung")) ret = ret.subtract(loch); if(checked("chkKLoch")) ret = ret.subtract(kloch); if(checked("chkLeft")) ret = ret.union(left); if(checked("chkXNut")) ret = ret.subtract(xnut); if(checked("chkSphere")) ret = ret.subtract(sphere); if(checked("chkZLoch")) ret = ret.subtract(zloch); if(checked("chkMLines")) ret = ret.union(mlines); if(checked("chkSchlitz1")) ret = ret.subtract(schlitz1); if(checked("chkSchlitz2")) ret = ret.subtract(schlitz2); if(checked("chkKerve")) ret = ret.subtract(kerve); if(checked("chkAnschlag")) ret = anschlag.union(ret); if(checked("chkSaege")) ret = ret.union(saege); if(checked("chkFraeser")) ret = ret.union(fraeser); return ret;
Run
Status
© Copyright Stefan Triess. All rights reserved.