Nabble has removed Mailing-list integration.
Posts created here DO NOT GET SENT TO THE MAILING LIST.
Mailing-list emails DO NOT GET POSTED TO THE FORUM.
So basically the Forum is now out of date, we are looking into migrating the history.

# Math help Classic List Threaded 3 messages Open this post in threaded view
|

## Math help

 Hi All, I am creating a digital design for a step stool to get into our camper trailer. It has splayed legs at each corner that are angled out in 2 direction by 15 degrees.  It has an apron to wrap around the outside of the legs and I'm having issues getting the apron mitered/beveled at the correct spot (at both ends of the part). I'm pretty certain it's my math at issue and not with OpenSCAD. Below is the code, I'd like to eliminate the fudge_factor variable by learning the proper math for the translation.  I'd don't know what this technique is called, so it's hard to search for answers/examples.  I'm all for approaching it a better way if there is a best practice that I don't know about. // OpenSCAD version 2021.01 (git 41f58fe) Linux appimage // // Apron part around a step stool with splayed out legs module apron() {     a_length = 22;    // Length of apron part     a_width = 3;      // Width of apron part     a_thick = 0.75;   // Thickness of apron part     a_side_angle = 90-15;     // 15 degree angle     a_corner_angle = 360/4;   // 90 degree corners (4 sides)         //Part features:     //    a miter on the end of the wide face     //    a bevel on the end of the miter         // Strategy: use a rectangle on each end to cut out (difference) the miter and bevel         // compound angle formula to adjust the 15 degree miter     a_miter = atan( cos(a_side_angle) * tan(a_corner_angle/2) );         // compound angle formula to adjust the 45 degree bevel     a_bevel = asin( sin(a_side_angle) * sin(a_corner_angle/2) );     echo("a_miter=", a_miter);     echo("a_bevel=", a_bevel);         // fudge_factor: positions the blocks so the sides meet at the corner     // otherwise the sides overlap.     // I'd like to get rid of this.     fudge_factor = 0.041;         difference() {         difference() {             // the apron part             translate([-a_length/2, -a_width/2, 0])  // move origin to center of part               linear_extrude(height=a_thick, center=true, \$fn=10)               polygon(                 points=[                 [0,0],                 [a_width*tan(a_miter), a_width],                 [a_length-a_width*tan(a_miter), a_width],                 [a_length, 0]                 ]);             // position the block at the right end of the part and             // subtract it             translate([a_length/2 - fudge_factor,0,0])               rotate([0,0,a_miter])               rotate([0,-a_bevel,0])               cube([1,4,3], true);         }         // position the block at the left end of the part and         // subtract it         translate([-a_length/2 + fudge_factor,0,0])           rotate([0,0,-a_miter])           rotate([0,a_bevel,0])           cube([1,4,3], true);     } } //apron(); color("yellow")   translate([11-0.75,0,0])     rotate([270+15,0,0])       apron(); color("red")   translate([0,11-0.75,0])     rotate([270+15,0,270])       apron(); // End Regards, Jake Sent from the OpenSCAD mailing list archive at Nabble.com._______________________________________________ OpenSCAD mailing list To unsubscribe send an email to [hidden email]