View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0032865||Community||OCCT:Modeling Algorithms||public||2022-03-04 22:46||2022-03-10 17:31|
|Summary||0032865: Incorrect result creating a spherical shell.|
|Description||Trying to create a spherical shell results in an inverted interior contour.|
It looks as though the algorithm is producing a "topological add", rather than a "cut".
This works as expected if the tool shape has vertices, or intersects a boundary of the work shape.
The problem appears to be in the "Solid-Solid" step.
|Steps To Reproduce||The code is essentially this:|
TopoDS_Shape outerSphere = BRepPrimAPI_MakeSphere( gp_Pnt(0,0,0), 1.0 ).Solid();
TopoDS_Shape innerSphere = BRepPrimAPI_MakeSphere( gp_Pnt(0,0,0), 0.5 ).Solid();
BRepAlgoAPI_Cut cutOperation( outerSphere, innerSphere );
TopoDS_Shape shell = cutOperation.Shape();
and documentation updates
|Errors like these crop up during a sequence of cut operations (usually somewhere from 100 to 500 or so), resulting in profoundly incorrect geometry.|
The framework rendering the attached image simply generates meshes suitable for OpenGL rendering. Clipping is performed on the resulting mesh data directly.
|Tags||No tags attached.|
|Test case number|
bad-spherical-shell.jpg (25,885 bytes)
I don't see any problem with the result. Cutting a sphere of smaller radius from a concentric sphere of larger radius produces a sphere with a hollow, which is represented by the sphere of smaller radius.
What did you expected? Can you provide an image of it?
The sphere inside should have its normals pointing in the other direction.
As it appears further clarification may be needed: The rendering framework works only with TopoDS_Shapes - no special treatment is given to any type of primitive. I will emphasize again that this is not the correct result, and is not a boolean subtract, but a topological add.
Here are two more images:
One with a box subtracted from the same sphere.
One with the smaller sphere moved to make contact with the larger sphere's boundary.
Note the contour orientations.
Note that, in the case of where the inner most sphere makes contact with the boundary of the outer sphere (at a single point, in this case), the result is correct.
box-from-sphere.jpg (20,843 bytes)
inner-sphere-contacts-boundary-of-outer-sphere.jpg (18,136 bytes)
I have tried to reproduce the wrong normals, but everything works right. Here are the draw script I have run:
psphere s1 1 psphere s2 0.5 bcut r s1 s2 box b -0.25 -0.25 -0.25 0.5 0.5 0.5 bcut r1 s1 b ttranslate r1 2 0 0 ttranslate s2 0 0 -0.5 bcut r2 s1 s2 ttranslate r2 0 0 2 ttranslate s2 0 0 -0.1 bcut r3 s1 s2 ttranslate r3 -2 0 0 vdisplay r r1 r2 r3 vsetdispmode 1 vclipplane cl -equation1 0 1 0 0 -set vaspects -color blue -backfaceColor blue4 vfit
The attached snapshot spheres_with_holes.png shows the result.
spheres_with_holes.png (69,543 bytes)
While I trust what you've posted may be correct for that application, it could also be making corrections for edge cases not handled by the API directly.
Where can I find the code responsible for generating the displayed meshes?
I just noticed it is rendering with two-sided shading.
With two-sided shading, it is not possible to distinguish between an incorrect result and a correct one in the case where the tool geometry is completely within the work geometry - there is no indication of normal direction.
Can you try again with only one-sided shading instead?
If this is one of the test applications, where can I find it in the source distribution?
> I just noticed it is rendering with two-sided shading.
The script above assigns different color to back and front faces, so that final normal direction could be easily identified (see `vaspects -color blue -backfaceColor blue4`).
You may change it to RED to make it more distinguishable.
And enabling capping visualization algorithm should allow to see what is solid part of displayed objects.
pload MODELING VISUALIZATION psphere s1 1 psphere s2 0.5 bcut r s1 s2 box b -0.25 -0.25 -0.25 0.5 0.5 0.5 bcut r1 s1 b ttranslate r1 2 0 0 ttranslate s2 0 0 -0.5 bcut r2 s1 s2 ttranslate r2 0 0 2 ttranslate s2 0 0 -0.1 bcut r3 s1 s2 ttranslate r3 -2 0 0 vdisplay r r1 r2 r3 vsetdispmode 1 vclipplane cl -equation1 0 1 0 0 -set vaspects -color blue -backfaceColor blue4 vfit vaspects -color blue -backfaceColor red vclipplane cl -capping 1 -color GREEN
image.png (43,362 bytes)
image-2.png (25,772 bytes)
> The framework rendering the attached image simply generates meshes suitable for OpenGL rendering.
> Clipping is performed on the resulting mesh data directly.
Fill free to share some portions of this logic, because it might have errors (like ignoring Face orientation).
>Where can I find the code responsible for generating the displayed meshes?
It is in the package BRepMesh, the entry point is the class BRepMesh_IncrementalMesh.
>If this is one of the test applications, where can I find it in the source distribution?
It is Draw Test Harness. It goes with OCCT. The executable is DRAWEXE. You can see the user guide https://dev.opencascade.org/doc/overview/html/occt_user_guides__test_harness.html
|2022-03-04 22:46||cgary-stellar||New Issue|
|2022-03-04 22:46||cgary-stellar||Assigned To||=> msv|
|2022-03-04 22:46||cgary-stellar||File Added: bad-spherical-shell.jpg|
||Assigned To||msv => cgary-stellar|
||Status||new => feedback|
||Note Added: 0107190|
|2022-03-07 18:33||cgary-stellar||Note Added: 0107234|
|2022-03-07 18:33||cgary-stellar||File Added: box-from-sphere.jpg|
|2022-03-07 18:33||cgary-stellar||File Added: inner-sphere-contacts-boundary-of-outer-sphere.jpg|
|2022-03-08 21:56||cgary-stellar||Assigned To||cgary-stellar => msv|
||Note Added: 0107238|
||File Added: spheres_with_holes.png|
||Assigned To||msv => cgary-stellar|
|2022-03-09 22:23||cgary-stellar||Note Added: 0107245|
|2022-03-09 22:27||cgary-stellar||Note Added: 0107246|
|2022-03-09 22:27||cgary-stellar||Assigned To||cgary-stellar => msv|
|2022-03-10 17:00||kgv||Note Added: 0107257|
|2022-03-10 17:00||kgv||File Added: image.png|
|2022-03-10 17:00||kgv||File Added: image-2.png|
|2022-03-10 17:00||kgv||Note Edited: 0107257|
|2022-03-10 17:15||kgv||Note Added: 0107258|
|2022-03-10 17:16||kgv||Assigned To||msv => cgary-stellar|
||Note Added: 0107259|