OpenFlexure Microscope OpenSCAD docs

libs/main_body_transforms.scad



module shear_x(amount=1)
[Source]
module shear_x(amount=1){
    // Shear transformation: tilt the Y axis towards the X axis
    // e.g. if amount=1, then a straight line in Y will be
    // tilted to 45 degrees between X and Y, while X lines are
    // unchanged.  This is used in the Z axis.

    shear_matrix = [[1, amount, 0, 0],
                    [0, 1, 0, 0],
                    [0, 0, 1, 0],
                    [0, 0, 0, 1]];

    multmatrix(shear_matrix){
        children();
    }
}
module leg_frame(params, angle)
[Source]
module leg_frame(params, angle){
    leg_r = key_lookup("leg_r", params);
    // Transform into the frame of one of the legs of the stage
    rotate(angle){
        translate([0,leg_r,]){
            children();
        }
    }
}
module each_leg(params)
[Source]
module each_leg(params){
    // Repeat for each of the legs of the stage
    for(angle=[45,135,-135,-45]){
        leg_frame(params, angle){
            children();
        }
    }
}
module each_actuator(params)
[Source]
module each_actuator(params){
    // Repeat this for both of the actuated legs (the ones with levers)
    reflect_x(){
        leg_frame(params,45){
            children();
        }
    }
}
module y_actuator_frame(params)
[Source]
module y_actuator_frame(params){
    translate(y_actuator_pos(params)){
        rotate(45){
            children();
        }
    }
}