View Issue Details

IDProjectCategoryView StatusLast Update
0032865CommunityOCCT:Modeling Algorithmspublic2022-03-10 17:31
Reportercgary-stellar Assigned Tocgary-stellar  
PrioritynormalSeverityblock 
Status feedbackResolutionopen 
PlatformWindowsOSVC++ 2015 
Product Version7.6.0 
Summary0032865: Incorrect result creating a spherical shell.
DescriptionTrying 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 ReproduceThe 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 );

cutOperation.Build();

TopoDS_Shape shell = cutOperation.Shape();
Additional information
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.
TagsNo tags attached.
Test case number

Attached Files

  • bad-spherical-shell.jpg (25,885 bytes)
  • box-from-sphere.jpg (20,843 bytes)
  • inner-sphere-contacts-boundary-of-outer-sphere.jpg (18,136 bytes)
  • spheres_with_holes.png (69,543 bytes)
  • image.png (43,362 bytes)
  • image-2.png (25,772 bytes)

Activities

cgary-stellar

2022-03-04 22:46

reporter  

bad-spherical-shell.jpg (25,885 bytes)

msv

2022-03-05 00:28

developer   ~0107190

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?

cgary-stellar

2022-03-07 18:33

reporter   ~0107234

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)

msv

2022-03-09 01:29

developer   ~0107238

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)

cgary-stellar

2022-03-09 22:23

reporter   ~0107245

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?

cgary-stellar

2022-03-09 22:27

reporter   ~0107246

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?

kgv

2022-03-10 17:00

developer   ~0107257

Last edited: 2022-03-10 17:00

@cgary-stellar
> 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)

kgv

2022-03-10 17:15

developer   ~0107258

> 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).

msv

2022-03-10 17:31

developer   ~0107259

>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

Issue History

Date Modified Username Field Change
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
2022-03-05 00:28 msv Assigned To msv => cgary-stellar
2022-03-05 00:28 msv Status new => feedback
2022-03-05 00:28 msv 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
2022-03-09 01:29 msv Note Added: 0107238
2022-03-09 01:29 msv File Added: spheres_with_holes.png
2022-03-09 01:31 msv 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
2022-03-10 17:31 msv Note Added: 0107259