I already described a possible mathematical solution here.
I also use hierarchical bounding boxes to check the visibility of subfiles on the screen.
LDPartEditor does not calculate the conditional line visibility for subfiles (sub-subfiles...) which are out of the screen.
The first matrix product (viewport x modelview matrix) can be cached. Therefore, only four vector transformations, two substractions, additionally 8 substractions, 8 multiplications, 8 additions and a final multiplication are necessary to create the discriminant for conditional line visibility. You can cache the result, too.
I also use hierarchical bounding boxes to check the visibility of subfiles on the screen.
LDPartEditor does not calculate the conditional line visibility for subfiles (sub-subfiles...) which are out of the screen.
The first matrix product (viewport x modelview matrix) can be cached. Therefore, only four vector transformations, two substractions, additionally 8 substractions, 8 multiplications, 8 additions and a final multiplication are necessary to create the discriminant for conditional line visibility. You can cache the result, too.