aboutsummaryrefslogtreecommitdiff
path: root/project/scripts/kcl/lower-walls.txt
diff options
context:
space:
mode:
authorroot <root@dc13.lemmi>2020-07-21 10:00:46 +0200
committerroot <root@dc13.lemmi>2020-07-21 10:00:46 +0200
commit1192c4575ea7afdf38e3fa0df4587a08620af11e (patch)
tree6910a62487c282d0840d2e668aa7eb40b7c8a3fd /project/scripts/kcl/lower-walls.txt
parent76de8a89f7c1d1b4522eb66e8f89d248e8c1781f (diff)
SZS v2.18a
Diffstat (limited to '')
-rw-r--r--project/scripts/kcl/lower-walls.txt41
1 files changed, 41 insertions, 0 deletions
diff --git a/project/scripts/kcl/lower-walls.txt b/project/scripts/kcl/lower-walls.txt
new file mode 100644
index 0000000..6ec281d
--- /dev/null
+++ b/project/scripts/kcl/lower-walls.txt
@@ -0,0 +1,41 @@
+###############################
+### (c) Wiimm, 2015-12-18 ###
+###############################
+
+# Setup
+@def start = mSec() # start time, for the status line
+@def mod_count = 0 # modification counter
+
+# Get the value for lowering the walls.
+# If 'lower' is defined as number by option --const => use it.
+# Otherwise use the default of 30.
+@def lower = isNumeric(lower) ? lower : 30
+
+# Limit to walls with inclination <45 degree
+# If 'degree' is defined by option --const as number >0 => use it.
+# Otherwise use the default of 45 degrees.
+@def degree = isNumeric(degree) && degree > 0 ? degree : 45
+@def sin_degree = sin(degree)
+
+# Define a function to test the KCL flag for walls
+@function isWall # flag
+ @pdef t = $1 & 0x1f
+ @return t == 0x0c || t == 0x0d || t == 0x0f || t == 0x14 || t == 0x1e || t == 0x1f
+@endfunction
+
+# Main loop: Iterate through all triangles
+@for t=0;tri$n()-1
+ @if isWall(tri$flag(t))
+ @def norm = tri$normal(t,0) # get the first normal
+ @if abs(norm.y) < sin_degree
+ # it's a vertical wall -> lower the wall & increment counter
+ @def status = tri$shift(t,-vy(lower))
+ @def mod_count = mod_count+1
+ @endif
+ @endif
+@endfor
+
+# Print a little status line
+@echo " - " mod_count " of " tri$n() " triangles lowered by " lower
+ > " in " (mSec()-start) " msec."
+