Skip to content

Instantly share code, notes, and snippets.

@Alexs0901
Forked from madhephaestus/sphere.groovy
Last active March 14, 2016 21:13
Show Gist options
  • Select an option

  • Save Alexs0901/4956648b56ab00153ee6 to your computer and use it in GitHub Desktop.

Select an option

Save Alexs0901/4956648b56ab00153ee6 to your computer and use it in GitHub Desktop.
CSG head = new Sphere (30).toCSG()
.movex(0)
.movey(0)
.movez(40)
CSG base = new Cylinder (50,1,100).toCSG()
.movex(0)
.movey(0)
.movez(-77)
CSG orangering2 = new Sphere (30.1).toCSG()
.movex(0)
.movey(0)
.movez(40)
CSG orangecutter21 = new Cylinder(51,50,20).toCSG()
.movex(0)
.movey(0)
.movez(45)
CSG orangecutter22 = new Cylinder(55,50,20).toCSG()
.movex(0)
.movey(0)
.movez(-9)
CSG orangecutter23 = new Cylinder(19,50,20).toCSG()
.movex(-8)
.movey(20)
.movez(0)
CSG orangeline21 = orangering2.difference(orangecutter21)
CSG orangeline22 = orangeline21.difference(orangecutter22)
CSG orangeline23 = orangeline22.difference(orangecutter23)
CSG orangering = new Sphere (30.1).toCSG()
.movex(0)
.movey(0)
.movez(40)
CSG eyewithlight = new Sphere (2).toCSG()
.movex(-15)
.movey(30)
.movez(47)
CSG blueeye = new Sphere (2.1).toCSG()
.movex(-15)
.movey(30)
.movez(47)
CSG bit1 = new Sphere (10).toCSG()
.movex(10)
.movey(18)
.movez(43)
CSG cutbit1 = new Cylinder (10,10,10).toCSG()
.movex(10)
.movey(18)
.movez(30)
CSG cutbit2 = new Cylinder (10,10,10).toCSG()
.movex(4)
.movey(22)
.movez(38)
CSG cutbit3 = new Cylinder (10,10,10).toCSG()
.movex(10)
.movey(18)
.movez(46)
CSG bit1part1 = bit1.difference(cutbit1)
CSG bit1part2 = bit1part1.difference(cutbit2)
CSG bit1part3 = bit1part2.difference(cutbit3)
CSG bodydec1 = new Sphere (30).toCSG()
.movex(0)
.movey(24)
.movez(-12)
CSG bodydec2 = new Sphere (30).toCSG()
.movex(0)
.movey(-24)
.movez(-12)
CSG bodydec3 = new Sphere (30).toCSG()
.movex(-24)
.movey(0)
.movez(-12)
CSG bodydec4= new Sphere (30).toCSG()
.movex(24)
.movey(0)
.movez(-12)
CSG bodydec5= new Sphere (30).toCSG()
.movex(0)
.movey(0)
.movez(-37)
CSG bodydec6= new Sphere (30).toCSG()
.movex(0)
.movey(0)
.movez(12)
CSG headring = new Sphere (30.1).toCSG()
.movex(0)
.movey(0)
.movez(40)
CSG cutpiece = new Cylinder (31,50,16).toCSG()
.movex(0)
.movey(0)
.movez(13)
CSG cutpiece2 = new Cylinder (31,50,16).toCSG()
.movex(0)
.movey(0)
.movez(66)
CSG ringcutter = headring.difference(cutpiece);
CSG silverheadring = ringcutter.difference(cutpiece2);
CSG testshape = new Cylinder (30,30,16).toCSG()
.movex(0)
.movey(0)
.movez(10)
CSG basepiece = new Sphere(17).toCSG()
.movez(-60)
CSG body = new Sphere (50).toCSG()
.movex(0)
.movey(0)
.movez(-12)
CSG rotatortemplete = new Cylinder (15,1,16).toCSG()
.movex(0)
.movey(0)
.movez(33)
CSG cube = new Cube( 2,2,2).toCSG()
CSG rotator = rotatortemplete.union(body).hull();
CSG headcutter = head.difference(testshape);
CSG bigantenna = new Cylinder(1,20,20).toCSG()
.movex(-5)
.movey(0)
.movez(68)
CSG antennapiece = new Cylinder(2,2,4).toCSG()
.movex(-5)
.movey(0)
.movez(88)
CSG silverring = new Cylinder(31,2,20).toCSG()
.movex(0)
.movey(0)
.movez(39)
CSG rotator3 = new Cylinder(30,2,20).toCSG()
.movex(0)
.movey(0)
.movez(39)
CSG rotator2 = rotatortemplete.union(rotator3).hull();
CSG smallantenna = new Cylinder(0.5,10,20).toCSG()
.movex(2)
.movey(0)
.movez(68)
CSG antennapiece2 = new Cylinder(2,2,10).toCSG()
.movex(-5)
.movey(0)
.movez(68.5)
CSG eye = new Sphere (10).toCSG()
.movex(0)
.movey(22)
.movez(55)
CSG eye2 = new Sphere (4).toCSG()
.movex(-12)
.movey(25)
.movez(46)
CSG orangecutter = new Cylinder (50,40,30).toCSG()
.movex(0)
.movey(0)
.movez(60)
CSG orangecutter2 = new Cylinder (50,42,35).toCSG()
.movex(0)
.movey(0)
.movez(15)
CSG orangecutter3 = new Cylinder (30,40,30).toCSG()
.movex(0)
.movey(47)
.movez(25)
CSG finaleye2 = eye2.union(eyewithlight).hull();
CSG orangeline1 = orangering.difference(orangecutter)
CSG orangeline2 = orangeline1.difference(orangecutter2)
CSG finalorange = orangeline2.difference(orangecutter3)
CSG thebase = base.union(basepiece).hull();
eye.setColor(javafx.scene.paint.Color.BLACK);
rotator.setColor(javafx.scene.paint.Color.WHITE);
headcutter.setColor(javafx.scene.paint.Color.WHITE);
bigantenna.setColor(javafx.scene.paint.Color.SILVER);
antennapiece.setColor(javafx.scene.paint.Color.BLACK);
silverring.setColor(javafx.scene.paint.Color.SILVER);
smallantenna.setColor(javafx.scene.paint.Color.SILVER);
antennapiece2.setColor(javafx.scene.paint.Color.BLACK);
finalorange.setColor(javafx.scene.paint.Color.DARKORANGE);
rotator2.setColor(javafx.scene.paint.Color.WHITE);
silverheadring.setColor(javafx.scene.paint.Color.SILVER);
bodydec1.setColor(javafx.scene.paint.Color.DARKORANGE);
bodydec2.setColor(javafx.scene.paint.Color.DARKORANGE);
bodydec3.setColor(javafx.scene.paint.Color.DARKORANGE);
bodydec4.setColor(javafx.scene.paint.Color.DARKORANGE);
bodydec5.setColor(javafx.scene.paint.Color.DARKORANGE);
bodydec6.setColor(javafx.scene.paint.Color.DARKORANGE);
bit1part3.setColor(javafx.scene.paint.Color.DARKORANGE);
blueeye.setColor(javafx.scene.paint.Color.DARKBLUE);
orangeline23.setColor(javafx.scene.paint.Color.DARKORANGE);
finaleye2.setColor(javafx.scene.paint.Color.BLACK);
blueeye.setColor(javafx.scene.paint.Color.BLUE);
thebase.setColor(javafx.scene.paint.Color.GOLD);
def myStuff = [rotator,eye,bigantenna,antennapiece,silverring,
smallantenna,antennapiece2,rotator2,silverheadring,bodydec1,
bodydec2,bodydec3,bodydec4,bodydec5,bodydec6,finalorange,orangeline23,finaleye2,blueeye,
thebase]
return headcutter.union(myStuff)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment