function length(point_1, point_2) = sqrt(
    (point_1-point_2).x^2 +
    (point_1-point_2).y^2 +
    (point_1-point_2).z^2
);

// todo fix this
// units in m, the size is the min bond pad size
module bond_pad(
    leg_length = 0.000075, 
    leg_width = 0.00001875,
    leg_length_tweak = 0,
    leg_angle = 45, 
    size = 0.000075, 
    bond_pad_shape = "square", 
    post_scale = false
) {
    if (post_scale) {
        circle(r=leg_width*post_scale);

        rotate([0, 0, leg_angle+180]) {
            translate([-leg_length*post_scale-leg_length_tweak, -leg_width*post_scale/2, 0]) {
                // color([0, 255/255, 255/255]) {
                    // arm
                    square(size=[(leg_length)*post_scale+leg_length_tweak, leg_width*post_scale]);                
                // }
            }
        }
        // pad
        translate([post_scale*leg_length*cos(leg_angle), post_scale*leg_length*sin(leg_angle), 0]) {
            square(size=[size*post_scale, size*post_scale], center=true);
        }

        // echo(str("x = ", post_scale*leg_length*cos(leg_angle+180)));
        // echo(str("y = ", post_scale*leg_length*sin(leg_angle+180)));

    
    } else {
        rotate([0, 0, leg_angle+180]) {
            translate([-leg_length/2, -leg_width, 0]) {
                // color([0, 255/255, 255/255]) {
                    square(size=[leg_length, leg_width]);                
                // }
            }
        }
        square(size=[size, size], center=true);
    }
}
