Loading openscad/libs/main_body_transforms.scad +35 −9 Original line number Diff line number Diff line Loading @@ -14,12 +14,17 @@ use <./utilities.scad> use <libdict.scad> use <./microscope_parameters.scad> 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 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. :param amount: ratio of x to y distances for a transformed y-cordinate */ module shear_x(amount=1){ shear_matrix = [[1, amount, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], Loading @@ -31,9 +36,13 @@ module shear_x(amount=1){ } /* Place the geometry in the frame of one of the legs of the microscope stage :param params: microscope parameters dictionary :param angle: angle of the leg about the z-axis (+45, -45, +135, -135) */ 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,0]){ children(); Loading @@ -41,8 +50,12 @@ module leg_frame(params, angle){ } } /* Repeat the geometry at each of the legs of the microscope stage :param params: microscope parameters dictionary */ module each_leg(params){ // Repeat for each of the legs of the stage for(angle=[45,135,-135,-45]){ leg_frame(params, angle){ children(); Loading @@ -50,8 +63,12 @@ module each_leg(params){ } } /* Repeat the geometry at each of the rear legs of the stage - furthest from the actuators :param params: microscope parameters dictionary */ module each_rear_leg(params){ // Repeat for each of the rear legs of the stage - furthest from the actuators for(angle=[135,-135]){ leg_frame(params, angle){ children(); Loading @@ -59,8 +76,12 @@ module each_rear_leg(params){ } } /* Repeat the geometry at each of the actuated legs (the ones with levers) :param params: microscope parameters dictionary */ module each_actuator(params){ // Repeat this for both of the actuated legs (the ones with levers) reflect_x(){ leg_frame(params,45){ children(); Loading @@ -68,6 +89,11 @@ module each_actuator(params){ } } /* Place the geometry in the frame of the y-actuator :param params: microscope parameters dictionary */ module y_actuator_frame(params){ translate(y_actuator_pos(params)){ rotate(45){ Loading Loading
openscad/libs/main_body_transforms.scad +35 −9 Original line number Diff line number Diff line Loading @@ -14,12 +14,17 @@ use <./utilities.scad> use <libdict.scad> use <./microscope_parameters.scad> 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 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. :param amount: ratio of x to y distances for a transformed y-cordinate */ module shear_x(amount=1){ shear_matrix = [[1, amount, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], Loading @@ -31,9 +36,13 @@ module shear_x(amount=1){ } /* Place the geometry in the frame of one of the legs of the microscope stage :param params: microscope parameters dictionary :param angle: angle of the leg about the z-axis (+45, -45, +135, -135) */ 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,0]){ children(); Loading @@ -41,8 +50,12 @@ module leg_frame(params, angle){ } } /* Repeat the geometry at each of the legs of the microscope stage :param params: microscope parameters dictionary */ module each_leg(params){ // Repeat for each of the legs of the stage for(angle=[45,135,-135,-45]){ leg_frame(params, angle){ children(); Loading @@ -50,8 +63,12 @@ module each_leg(params){ } } /* Repeat the geometry at each of the rear legs of the stage - furthest from the actuators :param params: microscope parameters dictionary */ module each_rear_leg(params){ // Repeat for each of the rear legs of the stage - furthest from the actuators for(angle=[135,-135]){ leg_frame(params, angle){ children(); Loading @@ -59,8 +76,12 @@ module each_rear_leg(params){ } } /* Repeat the geometry at each of the actuated legs (the ones with levers) :param params: microscope parameters dictionary */ module each_actuator(params){ // Repeat this for both of the actuated legs (the ones with levers) reflect_x(){ leg_frame(params,45){ children(); Loading @@ -68,6 +89,11 @@ module each_actuator(params){ } } /* Place the geometry in the frame of the y-actuator :param params: microscope parameters dictionary */ module y_actuator_frame(params){ translate(y_actuator_pos(params)){ rotate(45){ Loading