Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Triangular Prism Module
- module triangular_prism(base=20, height=15, depth=30) {
- polyhedron(
- points=[
- [0, 0, 0], // 0: base left
- [base, 0, 0], // 1: base right
- [base/2, height, 0], // 2: top
- [0, 0, depth], // 3: back base left
- [base, 0, depth], // 4: back base right
- [base/2, height, depth] // 5: back top
- ],
- faces=[
- [0, 1, 2], // front triangle
- [3, 5, 4], // back triangle
- [0, 2, 5, 3], // left side
- [1, 4, 5, 2], // right side
- [0, 3, 4, 1] // bottom rectangle
- ]
- );
- }
- // Equilateral Triangular Prism
- module equilateral_prism(side=20, depth=30) {
- h = side * sqrt(3) / 2; // height of equilateral triangle
- polyhedron(
- points=[
- [0, 0, 0], // 0: base left
- [side, 0, 0], // 1: base right
- [side/2, h, 0], // 2: top center
- [0, 0, depth], // 3: back base left
- [side, 0, depth], // 4: back base right
- [side/2, h, depth] // 5: back top center
- ],
- faces=[
- [0, 1, 2], // front triangle
- [3, 5, 4], // back triangle
- [0, 2, 5, 3], // left side
- [1, 4, 5, 2], // right side
- [0, 3, 4, 1] // bottom rectangle
- ]
- );
- }
- module box(){
- cube([5,5,2]);
- }
- module cyl(){
- cylinder([5,5,5]);
- }
- //triangular_prism();
- equilateral_prism();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement