Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tessellation independence #54

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

AIRCAP
Copy link
Contributor

@AIRCAP AIRCAP commented Nov 19, 2024

Shape.BoundBox depends on the Shapes tessellation.

The tessellation has 2 properties

  1. It only exists if the shape has been tessellated in the first place (if not, the valus can be very wrong, for example if the file is being edited in FreeCADCmd without GUI, parts are not tessellated at all and BoundBox can be off by up to 50% in any dimension in case of curved shapes)
  2. IF the part is tessellated, the exact dimensions depend on the Tessellation accuracy, which in turn depends on
    Preferences->Part->Shape_view->Maximum deviation
    and
    Preferences->Part->Shape_view->Maximum angualar deviation

The effect of this is that the users GUI settings for display-accuracy (and freecad rendering speed) affect the exact dimensions of the bounding boxes computed by CurvedShapes - and that in turn can lead to errors in the shape -- > i.e. parts that work fine on one users computer generate Geometry errors and fail in subsequent boolean operations on another users computer because they have the display accuracy set lower for performance reasons.

This is technically a flaw in FreeCAD itself -- Shape.BoundBox is a property that should NOT be calculated based on tessellation. There is an existing bug report for this:

FreeCAD/FreeCAD#17340

however CurvedShapes is affected by this to a much larger dergree, since it uses BoundBox everywhere.

fix #52

Note: this is a draft. Right now the "fix" has too many side effects. Using "optimalBoundingBox()" is more tricky than BoundBox because of several issues:

  1. the default call to optrimalBoundBox is optimalBoundBox(True,False) - which uses a triangualted approximation - this yields to flat 2d shapes having a bounding box that can be several millimeters thick for some reason
  2. Even if optimalBoundBox is called explicitly with optimalBoundBox(False,False) I have seen "thickness" of 2d parts of 2 times epsilon (2e-7)

even with "epsion" increased to 1e-6 some curvedarrays end up weird with broken 1.dimensional ribs created at the beginning or the end sometimes. so a lot more "sanitation" needs to be done with optimalBoundingBox than with BoundBox

Also: on 0.21.2 with OCCT 7.3.0 a call to Shape.optimalBoundBox(False,False) on a standard Part Cube caused FreeCAD to segfault. on 1.0RC4 with OCCT with 7.6.3 there is no segfault

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regression: CurvedSegment Ribs are too small and don't fit the hullcurve
1 participant