Skip to content

Instantly share code, notes, and snippets.

@jyxiao1
Last active January 15, 2019 19:24
Show Gist options
  • Save jyxiao1/caded75975d824b4ebddbb2e3bf66a07 to your computer and use it in GitHub Desktop.
Save jyxiao1/caded75975d824b4ebddbb2e3bf66a07 to your computer and use it in GitHub Desktop.
Introduction to bowler studio
//make a rook
double baseHeight =12;
double totalHeight =60;
double topHeight =20;
CSG rookBase = new Cylinder(35,// bottom radius
35,// top radius
baseHeight,// height
40 // resolution
).toCSG()
CSG rookCenter = new Cylinder(30,// bottom radius
23,// top radius
totalHeight,// height
40 // resolution
).toCSG()
rookCenter = rookCenter.movez(rookBase.getMaxZ())
CSG rookTop = new Cylinder(30,// bottom radius
30,// top radius
topHeight,// height
40 // resolution
).toCSG()
rookTop = rookTop.movez(rookCenter.getMaxZ())
CSG rookCube = new Cube(10,80,10).toCSG()
rookCube = rookCube.movez(rookCenter.getMaxZ()+15)
for (i = 0; i < 360; i += 45){
rookTop = rookTop.difference(rookCube.rotz(i));
}
CSG cutMiddle = new Cylinder(25,// bottom radius
25,// top radius
topHeight,// height
40 // resolution
).toCSG()
cutMiddle = cutMiddle.movez(rookCenter.getMaxZ()+10)
rookTop = rookTop.difference(cutMiddle)
CSG rook = CSG.unionAll([rookBase,rookCenter,rookTop])
rook = rook.scalex(0.6).scaley(0.6).scalez(0.6)
rook = rook.setName("rook")
return rook
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment