Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions regular_shapes.scad
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ module ellipse(width, height) {
scale([1, height/width, 1]) circle(r=width/2);
}

// The ratio of lenght and width is about 1.39 for a real egg
// The ratio of length and width is about 1.39 for a real egg
module egg_outline(width, length){
translate([0, width/2, 0]) union(){
rotate([0, 0, 180]) difference(){
Expand Down Expand Up @@ -235,12 +235,15 @@ module square_pyramid(base_x, base_y,height)
polyhedron(points=[[-w,-h,0],[-w,h,0],[w,h,0],[w,-h,0],[0,0,height]],triangles=[[0,3,2,1], [0,1,4], [1,2,4], [2,3,4], [3,0,4]]);
}

module egg(width, lenght){
rotate_extrude()
difference(){
egg_outline(width, lenght);
translate([-lenght, 0, 0]) cube(2*lenght, center=true);
}
module egg(width, length)
{
rotate_extrude(){
difference(){
egg_outline(width, length);
// Cut off half of egg so all x corrdinates are positive for rotate_extrude()
translate([-width/2-1, 0]) square([width/2+1, max(length, width)+2]); // egg_outline(...) makes a circle of radius width if width > length.
}
}
}

// Tests:
Expand Down