mirror of
https://github.com/nophead/NopSCADlib.git
synced 2025-02-19 15:45:29 +01:00
Corrected FOV handling.
This commit is contained in:
parent
4138ed438e
commit
71f935de8e
@ -58,7 +58,7 @@ module camera_lens(type, offset = 0, show_lens = true) //! Draw the lens stack,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module camera(type, show_lens = true, fov = undef, fov_distance = 0) { //! Draw specified PCB camera
|
module camera(type, show_lens = true, fov_distance = 0, fov = undef) { //! Draw specified PCB camera
|
||||||
vitamin(str("camera(", type[0], "): ", type[1]));
|
vitamin(str("camera(", type[0], "): ", type[1]));
|
||||||
pcb = camera_pcb(type);
|
pcb = camera_pcb(type);
|
||||||
|
|
||||||
@ -67,19 +67,17 @@ module camera(type, show_lens = true, fov = undef, fov_distance = 0) {
|
|||||||
|
|
||||||
translate_z(pcb_thickness(pcb)) {
|
translate_z(pcb_thickness(pcb)) {
|
||||||
camera_lens(type, show_lens = show_lens);
|
camera_lens(type, show_lens = show_lens);
|
||||||
if (show_lens && fov_distance > 0) {
|
if (show_lens&& fov_distance > 0) {
|
||||||
lens = camera_lens(type);
|
lens = camera_lens(type);
|
||||||
fov = is_undef(fov) ? camera_fov(type) : fov;
|
fov = is_undef(fov) ? camera_fov(type) : fov;
|
||||||
#translate_z(lens[2][0].z) // note: use of # is deliberate, to show highlighted field of view
|
if (is_list(fov))
|
||||||
translate(camera_lens_offset(type))
|
#translate_z(lens[2][0].z) // note: use of # is deliberate, to show highlighted field of view
|
||||||
if (is_list(fov))
|
translate(camera_lens_offset(type))
|
||||||
hull() {
|
hull() {
|
||||||
cube([lens[1][1]/2, lens[1][1]/2, eps], center=true);
|
cube([lens[1][1]/2, lens[1][1]/2, eps], center=true);
|
||||||
translate_z(fov_distance)
|
translate_z(fov_distance)
|
||||||
cube([2 * fov_distance * (sin(fov.x) + (fov.x > 90 ? 1 : 0)), 2 * fov_distance * (sin(fov.y) + (fov.y > 90 ? 1 : 0)), eps], center=true);
|
cube([2 * fov_distance * tan(fov.x / 2), 2 * fov_distance * tan(fov.y / 2), eps], center=true);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
cylinder(r1 = lens[0][1] / 2, r2 = fov_distance * (sin(fov) + (fov > 90 ? 1 : 0)), h = fov_distance);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
conn = camera_connector_size(type);
|
conn = camera_connector_size(type);
|
||||||
|
@ -67,8 +67,7 @@ rpi_camera = ["rpi_camera", "Raspberry Pi focusable camera", rpi_camera_pcb, [0,
|
|||||||
[[0, 0, 12], 6],
|
[[0, 0, 12], 6],
|
||||||
[[0, 11, 4.3], 14 / 2, [8/2, 11/2, 1]],
|
[[0, 11, 4.3], 14 / 2, [8/2, 11/2, 1]],
|
||||||
],
|
],
|
||||||
[0, 18 - 1.5 - 2.5], [8, 5, 1.6],
|
[0, 18 - 1.5 - 2.5], [8, 5, 1.6]
|
||||||
63 // FOV
|
|
||||||
];
|
];
|
||||||
|
|
||||||
cameras = [rpi_camera_v1, rpi_camera_v2, rpi_camera];
|
cameras = [rpi_camera_v1, rpi_camera_v2, rpi_camera];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user