OpenFlexure Microscope OpenSCAD docs

libs/main_body_transforms.scad

Transformations used for creating the main body.

The main body of the OpenFlexure microscope is complex. Certain features need to be positioned in different reference frames. This library contains a number of transformations for positioning features within other frames of reference.

module shear_x(amount=1)
[Source]
module shear_x(amount=1){
    shear_matrix = [[1, amount, 0, 0],
                    [0, 1, 0, 0],
                    [0, 0, 1, 0],
                    [0, 0, 0, 1]];

    multmatrix(shear_matrix){
        children();
    }
}

Shear the geometry, tilting the Y axis towards the X axis

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 actuator of the Microscope.

amount:ratio of x to y distances for a transformed y-cordinate

module leg_frame(params, angle)
[Source]
module leg_frame(params, angle){
    leg_r = key_lookup("leg_r", params);
    rotate(angle){
        translate([0,leg_r,0]){
            children();
        }
    }
}

Place the geometry in the frame of one of the legs of the microscope stage

params:microscope parameters dictionary

angle:angle of the leg about the z-axis (+45, -45, +135, -135)

module each_leg(params)
[Source]
module each_leg(params){
    for(angle=[45,135,-135,-45]){
        leg_frame(params, angle){
            children();
        }
    }
}

Repeat the geometry at each of the legs of the microscope stage

params:microscope parameters dictionary

module each_rear_leg(params)
[Source]
module each_rear_leg(params){
    for(angle=[135,-135]){
        leg_frame(params, angle){
            children();
        }
    }
}

Repeat the geometry at each of the rear legs of the stage - furthest from the actuators

params:microscope parameters dictionary

module each_actuator(params)
[Source]
module each_actuator(params){
    reflect_x(){
        leg_frame(params,45){
            children();
        }
    }
}

Repeat the geometry at each of the actuated legs (the ones with levers)

params:microscope parameters dictionary

module y_actuator_frame(params)
[Source]
module y_actuator_frame(params){
    translate(y_actuator_pos(params)){
        rotate(45){
            children();
        }
    }
}

Place the geometry in the frame of the y-actuator

params:microscope parameters dictionary