summaryrefslogtreecommitdiff
path: root/body/laser.scad
diff options
context:
space:
mode:
Diffstat (limited to 'body/laser.scad')
-rw-r--r--body/laser.scad26
1 files changed, 24 insertions, 2 deletions
diff --git a/body/laser.scad b/body/laser.scad
index 32658e9..e2b3bb9 100644
--- a/body/laser.scad
+++ b/body/laser.scad
@@ -2,14 +2,30 @@ include <design.scad>
include <helpers.scad>
include <body_config.scad>
+// TODO: create 2 kinds of functions: zero-centered and
+// globally positioned (respecting optical design and/or
+// other variables)
+
// up to 0.7 inside measurement range, but can be bigger outside.
// non-ideal printing/manufacturing is also possible
laser_ray_thickness = 1;
+module laser_beam(z_range = ($actualZBaseMm + $actualZRangeMm) * 2)
+{
+ x = tan($laserAngleDegrees / 2) * z_range;
+
+ color("red", 0.1)
+ polygon([
+ [0, 0],
+ [x, z_range],
+ [-x, z_range]
+ ]);
+}
+
// create a body of laser with diameter `d` and
// length `l`.
// the ray starts at the origin
-module laser_body(d = default_laser_d, l = default_laser_l)
+module laser_body(d = default_laser_d, l = default_laser_l, show_beam=true)
{
rotate([-90, 0, 0])
translate([0, 0, -l])
@@ -34,6 +50,12 @@ module laser_body(d = default_laser_d, l = default_laser_l)
[-$actualXStartMm / 2, zBase],
[-$actualXEndMm / 2, farZ],
[$actualXEndMm / 2, farZ],]);
+
+ if (show_beam)
+ {
+ laser_beam();
+ }
}
-*laser_body(); \ No newline at end of file
+*laser_body();
+*laser_beam(); \ No newline at end of file