{"push_id":878716127,"size":1,"distinct_size":1,"ref":"refs/heads/master","head":"87f6dd6d46a0308a4ded3481e5ffac66103173d9","before":"58f14009695af7e3f17ae1fbd5923468785be60f","commits":[{"sha":"87f6dd6d46a0308a4ded3481e5ffac66103173d9","author":{"email":"320bca71fc381a4a025636043ca86e734e31cf8b@bronosky.com","name":"Richard Bronosky"},"message":"Simplify prism module.\n\nWhile it appears to have more lines because of the detailed comments,\nusing a single polyhedron() call is much less computationally intensive\nthan chaining translate(), rotate(), linear_extrude(), and polygon().\nSince polyhedron() is hard to get right (sometimes they will Preview\n[F5] fine but fail to Render [F6] all faces) I am including a more\ndemonstrative example in this commit message.\n\nmodule prism(l, w, h) {\n    translate([0, l, 0]) rotate( a= [90, 0, 0])\n    linear_extrude(height = l) polygon(points = [\n        [0, 0],\n        [w, 0],\n        [0, h]\n    ], paths=[[0,1,2,0]]);\n}\n\nmodule polyprism(l, w, h) {\npolyhedron(\n    points=[\n        [0,0,h],           // 0    front top corner\n        [0,0,0],[w,0,0],   // 1, 2 front left & right bottom corners\n        [0,l,h],           // 3    back top corner\n        [0,l,0],[w,l,0]    // 4, 5 back left & right bottom corners\n    ],faces=[\n        [0,2,1],    // top face clockwise looking in\n        [3,4,5],    // base face clockwise looking in\n        [0,1,4,3],  // h face clockwise looking in\n        [1,2,5,4],  //  clockwise looking in\n        [0,3,5,2],  //  clockwise looking in\n    ]\n);\n\n/*DELETE ME*/color([.5,  0,  0, 1])translate([0,0,h])sphere(.5, $fn=8);\n// 0 Dark Red\n/*DELETE ME*/color([ 0, .5,  0, 1])translate([0,0,0])sphere(.5, $fn=8);\n// 1 Dark Green\n/*DELETE ME*/color([ 0,  0, .5, 1])translate([w,0,0])sphere(.5, $fn=8);\n// 2 Dark Blue\n/*DELETE ME*/color([ 1, .5, .5, 1])translate([0,l,h])sphere(.5, $fn=8);\n// 3 Light Red\n/*DELETE ME*/color([.5,  1, .5, 1])translate([0,l,0])sphere(.5, $fn=8);\n// 4 Light Green\n/*DELETE ME*/color([.5, .5,  1, 1])translate([w,l,0])sphere(.5, $fn=8);\n// 5 Light Blue\n}\n\n// Use Preview [F5] to see the colors that will help you associate the\n// corners in code with the corners in 3D.\n// Use Render [F6] to prove that the faces all render, and therefore\n// have their point ordered correctly.\n\ntranslate([0,0,5]) prism(5, 3, 2); // original prism\npolyprism(5, 3, 2); // simplified prism\n\n// NOTE: Polyhedrons require that the points for all faces must be\n// ordered clockwise when looking in. If you accidentally get the order\n// wrong on one, that face and all subsequent faces will fail to Render.\n// However, they will still show up in Preview.","distinct":true,"url":"https://api.github.com/repos/RichardBronosky/OpenSCAD-Parts-Library/commits/87f6dd6d46a0308a4ded3481e5ffac66103173d9"}]}