You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@szaghi
Hello!
I would like to give a couple of suggestions when checking for clipping:
The clip check happens twice - one before allocating and twice after. Instead, maybe create a linked-list of integers type, such that every time that a facet is inside - add the current index to the list. Once done reading the file, (if FILO revert the list by replacing the pointers), and on the second run (after allocating) - you can only check if the index matches the index on the list head. If it does, save the facet and pop-out the head, moving to the next in line. You can verify that reading was done properly if at the end the list has size of 0.
The current way you check if "inside" only includes facets which have all of the vertices inside the bounding box. There are cases where facets will have only several (but not all) vertices inside or even cases where all the vertices are outside, but the facets still intersects the bounding box.
My suggestion is to use the following (I'm using element instead of facet to make sure that there is no confusion: element = a facet from the STL surface):
Phase 1: Checking the BOUNDING BOX VERTICES relative to the element plane
Based on the normal of the element, check the signed distance of each bounding-box vertex from the plane of the element.
If any of the distances==0.0 then the element is to be included.
If all 8 bounding-box vertices have positive distance or all 8 have negative distance - discard it.
Phase 2: Checking the ELEMENT VERTICES relative to the bounding-box
For each Bounding-Box facet (6 total), count how many element vertices are "outside"
(based on the face normal, pointing outwards - same algorithm/concept as convex polygon).
Since this is a AABB, it can be simplified to counting vertex.x<bmin.x, vertex.x>bmax.x and repeat for y,z).
If all of these are less than the element vertex number (3 for triangle) - include it.
(I think this can also be directly expanded to work for any convex bounding polygon and convex element)
The text was updated successfully, but these errors were encountered:
ZviHantsis
changed the title
Version 1.0.4 Optional variables issue
Suggestion for clipping
Jun 4, 2018
I am not sure if building and traversing a linked list is more efficient than scanning twice a file, I could consider that change only after I see the need to speedup this phase; indeed, the loading of input files (even huge files) should be always less costly than other surfaces operations, thus I will not focus on refactor it until I see the necessity;
sure, I can consider other criterion for the clipping.
@szaghi
Hello!
I would like to give a couple of suggestions when checking for clipping:
My suggestion is to use the following (I'm using element instead of facet to make sure that there is no confusion: element = a facet from the STL surface):
(I think this can also be directly expanded to work for any convex bounding polygon and convex element)
The text was updated successfully, but these errors were encountered: