blob: 6ec281d34c2414a0dd5d39ab993a155621dd6db6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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."
|