-
Notifications
You must be signed in to change notification settings - Fork 0
/
Line clear pseudocode.txt
executable file
·44 lines (31 loc) · 1.13 KB
/
Line clear pseudocode.txt
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
42
43
For all shapes that aren't the walls:
For all shapes in body:
Ray cast the top and bottom rows from both sides to the shape
cut = false
IF top hits:
Get list of shape vertices that are ABOVE the top line
combine list with the two points where the ray cast hit
!!! new body with shape with those points
cut = true
IF bottom hits:
Get list of shape vertices that are BELOW the bottom line
combine list with the two points where the ray cast hit
!!! new body with shape with those points
cut = true
IF cut OR body center lies between rays:
delete the original shape
(figure out how to determine when two shapes on the same side of a cut should be part of the same body)
Volume of the line:
for each shape besides walls:
Ray cast the top and bottom rows from both sides to the shape
IF top hits OR if bottom hits
Get list of shape vertices that are BETWEEN the two lines
Combine with list of ray vast vertices from both sides
Make shape with those vertices
Calculate volume of the shape
(you can throw away this shape)
add volume to total
ELSE
see if first vertex of shape is inside the lines
IF it is:
add volume of shape to total