Archived issue #0032716
Modeling Algorithms - BRepBuilderAPI_Transform discards triangulation
Description
BRepBuilderAPI_ModifyShape has severe issue in handling faces - existing triangulation is always removed.
This leads to two issues:
- User has to re-triangulate shape, which might be much more expensive than transforming triangulation nodes.
- Triangulation-only shapes are corrupted or lead to NULL-dereference in algorithm.
This leads to two issues:
- User has to re-triangulate shape, which might be much more expensive than transforming triangulation nodes.
- Triangulation-only shapes are corrupted or lead to NULL-dereference in algorithm.
Steps to reproduce
pload MODELING psphere s 1 incmesh s 1 trinfo s tscale s 0 0 0 0.5 trinfo s # KO - triangulation is empty incmesh s 1 tclean -geom s tscale s 0 0 0 0.5 # KO - crash in the algorithm trinfo s
Public activity
49 archived notes
Participants are labeled by their role within this record.
Branch [archived branch] has been created by Participant.
[revision removed]
Detailed log of new commits:
Author: Andrei LATYSHEV
Date: Fri Apr 1 16:45:02 2022 +0300
0032716: Modeling Algorithms - BRepBuilderAPI_Transform discards triangulation
The methods for BRepTools_TrsfModification are defined and modified to keep the triangulation during 'tscale' operation.
[revision removed]
Detailed log of new commits:
Author: Andrei LATYSHEV
Date: Fri Apr 1 16:45:02 2022 +0300
0032716: Modeling Algorithms - BRepBuilderAPI_Transform discards triangulation
The methods for BRepTools_TrsfModification are defined and modified to keep the triangulation during 'tscale' operation.
+ //Applying the transformation to each node of triangulation + aP = theTriangulation->Node(i).Transformed(myTrsf); + theTriangulation->SetNode(i, aP);
It might be better adding the method `Poly_Triangulation::Transform (const gp_Trsf& theT)` / `Poly_Polygon3D::Transform()`.
It is not enough transforming triangulation nodes, normals should be transformed as well.
+Standard_EXPORT Standard_Boolean BRepTools_TrsfModification::NewPolygon
`Standard_EXPORT` should not appear in .cxx files.
+ TColgp_Array1OfPnt aNodesArray = aPolygon->Nodes();
Would be nice adding `Poly_Polygon3D::Copy()` for consistency with other classes.
Branch [archived branch] has been updated by Participant.
[revision removed]
Detailed log of new commits:
Author: Andrei LATYSHEV
Date: Mon Apr 4 11:28:10 2022 +0300
0031479: Modeling Algorithms - exception on geometry transformation of triangulation-only shapes (without geometry surface)
Added test for user's problem case
[revision removed]
Detailed log of new commits:
Author: Andrei LATYSHEV
Date: Mon Apr 4 11:28:10 2022 +0300
0031479: Modeling Algorithms - exception on geometry transformation of triangulation-only shapes (without geometry surface)
Added test for user's problem case
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
+ aV = gp_Vec(myNormals(i).x(), myNormals(i).y(), myNormals(i).z()).Transformed(theT); + Standard_Real aCoef = aV.Magnitude(); + aV = aV / aCoef;
Normal vectors couldn't be transformed like that - see gp_Dir::Transform() implementation.
+ // Apply the transformation to the triangulation + Standard_EXPORT void Transform(const gp_Trsf& theT);
`//!`
+ for (Standard_Integer i = 1; i < myNodes.Length(); ++i)
+ {
Indexation of `myNodes` doesn't start from `1`.
+//function : RemoveNormals +//purpose : +//======================================================================= +void Poly_Triangulation::Transform(const gp_Trsf& theT)
Inconsistent header.
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been created by Participant.
[revision removed]
Detailed log of new commits:
Author: Commenter 1
Date: Wed Apr 20 17:14:07 2022 +0300
0032716: Modeling Algorithms - BRepBuilderAPI_Transform discards triangulation
Added the test to reproduce this problem.
The methods for BRepTools_TrsfModification are defined and modified to keep the triangulation during 'tscale' operation.
[revision removed]
Detailed log of new commits:
Author: Commenter 1
Date: Wed Apr 20 17:14:07 2022 +0300
0032716: Modeling Algorithms - BRepBuilderAPI_Transform discards triangulation
Added the test to reproduce this problem.
The methods for BRepTools_TrsfModification are defined and modified to keep the triangulation during 'tscale' operation.
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
It is desired to create screenshots within the test to be able to verify visually that transformed mesh has correct vertex normals.
+++ b/tests/bugs/mesh/bug32716
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been created by Participant.
[revision removed]
Detailed log of new commits:
Author: azv
Date: Fri Jul 1 16:46:55 2022 +0300
0031479: Modeling Algorithms - exception on geometry transformation of triangulation-only shapes (without geometry surface)
* Avoid crash in BRepBuilderAPI_GTransform algorithm. The crash in BRepBuilder_Transform has been solved by 0032716.
* Move copying modifier to BRepTools package.
* Implement transformation of a triangulation in BRepTools_GTrsfModification.
Author: Commenter 1
Date: Wed Apr 20 17:14:07 2022 +0300
0032716: Modeling Algorithms - BRepBuilderAPI_Transform discards triangulation
* Implement methods for copying tessellation to BRepTools_TrsfModification to keep the triangulation during transformation.
* Add tests to reproduce the problem.
Author: azv
Date: Fri Jul 1 15:59:40 2022 +0300
0033049: Command 'tclean -geom' does not remove all geometric objects from the shape
Remove unused P-curves when cleaning the geometry
[revision removed]
Detailed log of new commits:
Author: azv
Date: Fri Jul 1 16:46:55 2022 +0300
0031479: Modeling Algorithms - exception on geometry transformation of triangulation-only shapes (without geometry surface)
* Avoid crash in BRepBuilderAPI_GTransform algorithm. The crash in BRepBuilder_Transform has been solved by 0032716.
* Move copying modifier to BRepTools package.
* Implement transformation of a triangulation in BRepTools_GTrsfModification.
Author: Commenter 1
Date: Wed Apr 20 17:14:07 2022 +0300
0032716: Modeling Algorithms - BRepBuilderAPI_Transform discards triangulation
* Implement methods for copying tessellation to BRepTools_TrsfModification to keep the triangulation during transformation.
* Add tests to reproduce the problem.
Author: azv
Date: Fri Jul 1 15:59:40 2022 +0300
0033049: Command 'tclean -geom' does not remove all geometric objects from the shape
Remove unused P-curves when cleaning the geometry
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Please, review OCCT branch CR32716_2.
Test results: http://jenkins-test-occt/view/CR32716_2-master-AZV/view/COMPARE/
Test results: http://jenkins-test-occt/view/CR32716_2-master-AZV/view/COMPARE/
It is needed to invalidate myCachedMinMax of the copy.
Use const&
In the method BRepTools_TrsfModification::NewPolygon it is needed to transform parameters if the edge has 3D curve.
Please update description, as there is no more "Copy" argument, but there are two new ones:
theTriangulation = theTriangulation->Copy();
Use const&
Poly_Triangle aTria = theTriangulation->Triangle(anInd);
In the method BRepTools_TrsfModification::NewPolygon it is needed to transform parameters if the edge has 3D curve.
Please update description, as there is no more "Copy" argument, but there are two new ones:
//! of T is equal to 1., and if Copy equals false (the
...
const Standard_Boolean theCopyGeom = Standard_False,
const Standard_Boolean theCopyMesh = Standard_False);
Branch [archived branch] has been updated by Participant.
[revision removed]
Detailed log of new commits:
Author: azv
Date: Wed Jul 6 17:25:10 2022 +0300
# remarks
[revision removed]
Detailed log of new commits:
Author: azv
Date: Wed Jul 6 17:25:10 2022 +0300
# remarks
Branch [archived branch] has been created by Participant.
[revision removed]
Detailed log of new commits:
Author: azv
Date: Fri Jul 1 16:46:55 2022 +0300
0031479: Modeling Algorithms - exception on geometry transformation of triangulation-only shapes (without geometry surface)
* Avoid crash in BRepBuilderAPI_GTransform algorithm. The crash in BRepBuilder_Transform has been solved by 0032716.
* Move copying modifier to BRepTools package.
* Implement copying of triangulation in BRepTools_NurbsConvertModification.
* Implement transformation of a triangulation in BRepTools_GTrsfModification.
* Update test case bugs/mesh/bug22778 to clean the triangulation after conversion to NURBS (reproduce the same behavior as before).
Author: Commenter 1
Date: Wed Apr 20 17:14:07 2022 +0300
0032716: Modeling Algorithms - BRepBuilderAPI_Transform discards triangulation
* Implement methods for copying tessellation to BRepTools_TrsfModification to keep the triangulation during transformation.
* Add tests to reproduce the problem.
[revision removed]
Detailed log of new commits:
Author: azv
Date: Fri Jul 1 16:46:55 2022 +0300
0031479: Modeling Algorithms - exception on geometry transformation of triangulation-only shapes (without geometry surface)
* Avoid crash in BRepBuilderAPI_GTransform algorithm. The crash in BRepBuilder_Transform has been solved by 0032716.
* Move copying modifier to BRepTools package.
* Implement copying of triangulation in BRepTools_NurbsConvertModification.
* Implement transformation of a triangulation in BRepTools_GTrsfModification.
* Update test case bugs/mesh/bug22778 to clean the triangulation after conversion to NURBS (reproduce the same behavior as before).
Author: Commenter 1
Date: Wed Apr 20 17:14:07 2022 +0300
0032716: Modeling Algorithms - BRepBuilderAPI_Transform discards triangulation
* Implement methods for copying tessellation to BRepTools_TrsfModification to keep the triangulation during transformation.
* Add tests to reproduce the problem.
>>> Use const&
>>>
>>> Poly_Triangle aTria = theTriangulation->Triangle(anInd);
It is not possible here, because aTria is updated below.
>>>
>>> Poly_Triangle aTria = theTriangulation->Triangle(anInd);
It is not possible here, because aTria is updated below.
The option -copymesh takes effect only with -copy. Please reflect this in the help.
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Mikhail, please review OCCT branch CR32716_2.
Branch CR32716_3 contains the same changes, but squashed to a single commit.
Test results: http://jenkins-test-occt/view/CR32716_3-master-AZV/view/COMPARE/
Branch CR32716_3 contains the same changes, but squashed to a single commit.
Test results: http://jenkins-test-occt/view/CR32716_3-master-AZV/view/COMPARE/
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
For integration:
occt - CR32716_3
products - none
occt - CR32716_3
products - none
Combination -
OCCT branch : [archived branch]
master SHA - changes and them, and you can discard any commits you make in this
[revision removed]
changes and them, and you can discard any commits you make in this
[revision removed]
Products branch : [archived branch] SHA - [revision removed]
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.
Number of compiler warnings:
No new/fixed warnings
Regressions/Differences/Improvements:
No regressions/differences
CPU differences:
Debian80-64:
OCCT
Total CPU difference: 18685.930000000586 / 18908.870000000694 [-1.18%]
Products
Total CPU difference: 11796.890000000125 / 11832.130000000114 [-0.30%]
Windows-64-VC14:
OCCT
Total CPU difference: 20784.828125 / 20752.59375 [+0.16%]
Products
Total CPU difference: 13361.3125 / 13368.90625 [-0.06%]
Image differences :
No differences that require special attention
Memory differences :
No differences that require special attention
OCCT branch : [archived branch]
master SHA - changes and them, and you can discard any commits you make in this
[revision removed]
changes and them, and you can discard any commits you make in this
[revision removed]
Products branch : [archived branch] SHA - [revision removed]
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.
Number of compiler warnings:
No new/fixed warnings
Regressions/Differences/Improvements:
No regressions/differences
CPU differences:
Debian80-64:
OCCT
Total CPU difference: 18685.930000000586 / 18908.870000000694 [-1.18%]
Products
Total CPU difference: 11796.890000000125 / 11832.130000000114 [-0.30%]
Windows-64-VC14:
OCCT
Total CPU difference: 20784.828125 / 20752.59375 [+0.16%]
Products
Total CPU difference: 13361.3125 / 13368.90625 [-0.06%]
Image differences :
No differences that require special attention
Memory differences :
No differences that require special attention
Branch [archived branch] has been deleted by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been deleted by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been deleted by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been deleted by Participant.
[revision removed]
[revision removed]
Related records
- #0033049 · parent of · closedCommand 'tclean -geom' does not remove all geometric objects from the shape
- #0031479 · related to · closedModeling Algorithms - exception on geometry transformation of triangulation-only shapes (without geometry surface)
- #0028125 · child of · newModeling Algorithms - support of BRep shapes based on tessellated geometry