≡
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 erweitertes CSG-3D-Demo
Surface
Wire
Line Overlay
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 cube = CSG.cube({ center: [0, 0, 0], radius: [0.5, 1.8, 0.5] }).setColor(1, 3, 0.5); var cube2 = CSG.cube({ center: [0, 0.3, 0], radius: [0.5, 1.5, 0.5] }).setColor(0.9, 2.7, 0.4); update ([ cube2.translate([1.2, 0, 0]), cube2.translate([-1.2, 0, 0]), cube ]); var delta = CSG.cube({ center: [0.15, 0.9, 0], radius: [0.35, 0.9, 0.51] }) .setColor(0.8, 2.5, 0.3) .rotate([-0.2, 1.8, 0],[0,0,1],25) ; cube2 = cube2 .subtract(delta) .rotate([-0.5, 1.8, 0],[0,0,1],-30) .translate([0, -0.5, 0]); cube3 = cube2.mirroredX(); cube = cube.subtract(cube2).subtract(cube3); // (1) var tmp = [ cube2.translate([-0.4, 0, 0]), cube3.translate([0.4, 0, 0]), cube ]; var bohrung = CSG.cylinder({radius: 0.12, start: [-1,0,0], end: [1,0,0]}) .union(CSG.cylinder({radius: 0.3, start: [0.9,0,0], end: [1.3,0,0]})) .union(CSG.cylinder({radius: 0.3, start: [-0.9,0,0], end: [-1.3,0,0]})) .translate([0,0.3,0]) ; // -> (1) update(tmp); // (2) cube = cube.subtract(bohrung); cube2 = cube2.subtract(bohrung); cube3 = cube3.subtract(bohrung); // -> (2) update ([ cube, cube2.translate([-0.4, 0, 0]), cube3.translate([0.4, 0, 0]) ]); var mutter = CSG.cylinder({ radius: 0.18, start:[-0.07,0,0], end:[0.07,0,0], resolution: 6 }) .union(CSG.cylinder({ radius: 0.14, start:[-0.07,0,0], end:[-0.09,0,0] })) .union(CSG.cylinder({ radius: 0.14, start:[0.07,0,0], end:[0.09,0,0] })) .subtract(CSG.cylinder({radius: 0.1, start:[-0.09,0,0], end:[0.09,0,0] })) .setColor(1,1,1.1) ; var scheibe = CSG.cylinder({ radius: 0.25, start:[-0.01,0,0], end:[0.01,0,0]}) .subtract(CSG.cylinder({radius: 0.1, start:[-0.01,0,0], end:[0.01,0,0] })) .setColor(1,1,1.1) ; var schraube = CSG.cylinder({ radius: 0.18, start:[0.07,0,0], end:[-0.07,0,0], resolution: 6 }) .union(CSG.cylinder({ radius: 0.14, start:[0.07,0,0], end:[0.09,00,] })) .union(CSG.cylinder({ radius: 0.09, start:[-0.07,0,0], end:[-2.12,0,0] })) .setColor(1,1,1.1) var ret = [ cube, cube2.translate([-0.6, 0, 0]).rotate([-1, 0, 0], [0, 1, 0], -30), union( mutter.translate([-2.2, 0.3, 0]), scheibe.translate([-2, 0.3, 0]) ).rotate([-1.5, 0, 0], [0, 1, 0], 30), cube3.translate([0.4, 0, 0]), schraube.translate([1 + 0.7, 0.3, 0]), scheibe.translate([0.92 + 0.65, 0.3, 0]), ]; setTimeout(function(){ var ret = [ cube, cube2.translate([-0.002, 0, 0]), mutter.translate([-1.02, 0.3, 0]), scheibe.translate([-0.92, 0.3, 0]), cube3.translate([0.002, 0, 0]), schraube.translate([1, 0.3, 0]), scheibe.translate([0.92, 0.3, 0]), ]; flashWired(); update(ret, "ready"); },1000) return ret;
Run
Status
© Copyright Stefan Triess. All rights reserved.