include include use use use use use lens_focal_length = 50; //mm 75 lens_diameter = 50; //mm 30 lens_retaining_edge = 1; //mm lens_thickness = 2; //mm camera_inner_dimensions = [100,100,50]; //mm external_width = 3; //mm image_plane_width = 1; // mm // This equation can come in handy OA*f/(OA+f)=OA' object_distances = [100,102.632,105.556,108.824,112.5,116.667,121.429,126.923,133.333,140.909,150,161.111,192.857,175,216.667,235.185,258.333,288.095,327.778,383.333,466.667,605.556,883.333,1716.67,"∞"]; // mm [300,325,350,375,400,450,500,600,750,1000,1500,3000,"∞"] text_top_padding = 1; // mm text_offset_coeff = -3.9; // -1.9 index_offset = true; // false text_size = 3.4; // mm 2.6 text_angle = 180; // deg text_font = "JetBrainsMono:style=Bold Italic"; //"JetBrainsMono:style=Bold"; jp_font = "NotoSansJP:style=Bold"; camera_name = "立方体"; spec_text_size = 5; spec_text_padding = 5; // 15 attaching_mechanism_dimensions = [15,40,2]; // mm attaching_mechanism_tolerance = 0.5; // mm (applied to both parts) cyl_resolution = 200; txt_resolution = 80; crn_resolution = 60; corner_rounding = 2; // System camera_box_dimensions = [camera_inner_dimensions.x+external_width*2,camera_inner_dimensions.y+external_width*2,camera_inner_dimensions.z+external_width]; // Modules function image_plane_calc(object_distance,focal_length)= (object_distance == "∞")? focal_length : -object_distance*focal_length/(focal_length-object_distance); module image_plane_transform(object_distance,focal_length) { // mm if(object_distance == "∞"){ translate([focal_length,0,0]) children(); } else{ OA_prime = -object_distance*focal_length/(focal_length-object_distance); translate([OA_prime,0,0]) children(); } } function image_plane_text_dist_from_top (object_distance,focal_length,index) = -text_top_padding+(index_offset ? text_offset_coeff*(ceil(len(object_distances)/2)-index-1) : text_offset_coeff*image_plane_calc(object_distance,focal_length)-text_offset_coeff*focal_length); module image_plane_text_transform(object_distance,focal_length,index){ fixed_index = index%(ceil(len(object_distances)/2)); has_looped = fixed_index