Archived issue #0029734
Modeling Algorithms - Compute global properties of tessellated shape
Description
It is needed to improve calculation of global properties of a shape (package BRepGProp) to be able to perform calculations on tessellated shapes.
The special flag is to be added to the API in order to give the preferred source for calculations - geometric curves and surfaces or polygons and triangulations.
A set of test cases is to be developed to add to non-regression grid tests.
The special flag is to be added to the API in order to give the preferred source for calculations - geometric curves and surfaces or polygons and triangulations.
A set of test cases is to be developed to add to non-regression grid tests.
Steps to reproduce
test cases
bugs modalg_7 bug24731
bugs modalg_7 bug29734
bugs modalg_7 bug24731
bugs modalg_7 bug29734
Public activity
33 archived notes
Participants are labeled by their role within this record.
This patch is to replace the partial patch implemented in scope of #29731.
Branch [archived branch] has been created by Participant.
[revision removed]
Detailed log of new commits:
Author: ifv
Date: Thu May 17 15:38:17 2018 +0300
0029734: Modeling Algorithms - Compute global properties of tessellated shape
New algorithms using mesh data for calculation are added: BRepGProp/BRepGProp_MeshCinert, BRepGProp/BRepGProp_MeshSinert, BRepGProp/BRepGProp_MeshVinert.
In API special flag, which defines preferable source for calculations is added
Test case is added
Documentation is updated
[revision removed]
Detailed log of new commits:
Author: ifv
Date: Thu May 17 15:38:17 2018 +0300
0029734: Modeling Algorithms - Compute global properties of tessellated shape
New algorithms using mesh data for calculation are added: BRepGProp/BRepGProp_MeshCinert, BRepGProp/BRepGProp_MeshSinert, BRepGProp/BRepGProp_MeshVinert.
In API special flag, which defines preferable source for calculations is added
Test case is added
Documentation is updated
Branch CR29734 is ready for review
src/BRepGProp/BRepGProp_MeshCinert.hxx
- 1-4: incorrect information
- 30-35: not relevant description
src/BRepGProp/BRepGProp_MeshCinert.cxx
- 1-2: incorrect information
- Please use English for comments.
- 80-81: simplify as Lower is always == 0.
- 82: protection against division by zero is needed.
src/BRepGProp/BRepGProp_MeshSinert.hxx
- 1-3: incorrect information
- 34: Comment about closed region of space is not relevant to surface properties.
- 43: missing end of sentense point.
- Wrap too long lines.
src/BRepGProp/BRepGProp_MeshSinert.cxx
- 1-3: incorrect information
- 50-55: too heavy computation of triangle area and normal. It is better to avoid creation of an additional array of points.
- 58: The caller has no means to know if the computation is failed.
- 155, 159: skip triangle if CalculateProps is failure.
src/BRepGProp/BRepGProp_MeshVinert.hxx
- 1-3: incorrect information
- 44: missing end of sentense point.
- Wrap too long lines.
src/BRepGProp/BRepGProp_MeshVinert.cxx
- 1-3: incorrect information
The files BRepGProp_MeshSinert.cxx and BRepGProp_MeshVinert.cxx are almost the same except a small portion of the method CalculateProps. Please think about avoiding of code duplication.
src/BRepGProp/BRepGProp.hxx
- 220: misprint "defained"
- Wrap too long lines where they are changed.
src/BRepGProp/BRepGProp.cxx
- 60: use reference.
- 160-188: too heavy calculation of center and normal. Precision depends on the distance of polygon from the origin. I propose to calculate area and normals of triangles with origin in the first point.
- 212: Why management of Mesh inertia is not made like curve inertia, declaring the instance of BRepGProp_MeshCinert where it is needed?
- 293-309: it is better to move the logic into BRepGProp_MeshSinert, passing there triangulation and location.
- 423-439: the same as above, but for BRepGProp_MeshVinert.
src/BRepTest/BRepTest_GPropCommands.cxx
- 45: misprint "geomery"
dox/dev_guides/upgrade/upgrade.md
- Upgrade guide is not needed to be modified, as the changes do not impact the port to new version.
dox/user_guides/draw_test_harness/draw_test_harness.md
- 7375: "forces computation of only closed shells"
- 7377: "will be taken"
- 7378: "are output"
tests/bugs/modalg_7/bug29734
- The same checker code is copied three times. Please make a tcl proc and call it three times.
Please take from the branch CR29731_1 the changes in files
- 1-4: incorrect information
- 30-35: not relevant description
src/BRepGProp/BRepGProp_MeshCinert.cxx
- 1-2: incorrect information
- Please use English for comments.
- 80-81: simplify as Lower is always == 0.
- 82: protection against division by zero is needed.
src/BRepGProp/BRepGProp_MeshSinert.hxx
- 1-3: incorrect information
- 34: Comment about closed region of space is not relevant to surface properties.
- 43: missing end of sentense point.
- Wrap too long lines.
src/BRepGProp/BRepGProp_MeshSinert.cxx
- 1-3: incorrect information
- 50-55: too heavy computation of triangle area and normal. It is better to avoid creation of an additional array of points.
- 58: The caller has no means to know if the computation is failed.
- 155, 159: skip triangle if CalculateProps is failure.
src/BRepGProp/BRepGProp_MeshVinert.hxx
- 1-3: incorrect information
- 44: missing end of sentense point.
- Wrap too long lines.
src/BRepGProp/BRepGProp_MeshVinert.cxx
- 1-3: incorrect information
The files BRepGProp_MeshSinert.cxx and BRepGProp_MeshVinert.cxx are almost the same except a small portion of the method CalculateProps. Please think about avoiding of code duplication.
src/BRepGProp/BRepGProp.hxx
- 220: misprint "defained"
- Wrap too long lines where they are changed.
src/BRepGProp/BRepGProp.cxx
- 60: use reference.
- 160-188: too heavy calculation of center and normal. Precision depends on the distance of polygon from the origin. I propose to calculate area and normals of triangles with origin in the first point.
- 212: Why management of Mesh inertia is not made like curve inertia, declaring the instance of BRepGProp_MeshCinert where it is needed?
- 293-309: it is better to move the logic into BRepGProp_MeshSinert, passing there triangulation and location.
- 423-439: the same as above, but for BRepGProp_MeshVinert.
src/BRepTest/BRepTest_GPropCommands.cxx
- 45: misprint "geomery"
dox/dev_guides/upgrade/upgrade.md
- Upgrade guide is not needed to be modified, as the changes do not impact the port to new version.
dox/user_guides/draw_test_harness/draw_test_harness.md
- 7375: "forces computation of only closed shells"
- 7377: "will be taken"
- 7378: "are output"
tests/bugs/modalg_7/bug29734
- The same checker code is copied three times. Please make a tcl proc and call it three times.
Please take from the branch CR29731_1 the changes in files
src/BRepTools/BRepTools.cxx src/BRepTools/BRepTools.hxx src/DBRep/DBRep.cxx tests/bugs/modalg_7/bug29731
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 CR29734 is ready for review
The classes BRepGProp_MeshSinert, BRepGProp_MeshVinert are not used any more. Can they be removed then?
src/BRepGProp/BRepGProp_MeshCinert.hxx
src/BRepGProp/BRepGProp_MeshCinert.cxx
src/BRepGProp/BRepGProp_MeshSinert.hxx
src/BRepGProp/BRepGProp_MeshSinert.cxx
src/BRepGProp/BRepGProp_MeshVinert.hxx
src/BRepGProp/BRepGProp_MeshVinert.cxx
src/BRepGProp/BRepGProp_MeshProps.hxx
src/BRepGProp/BRepGProp_MeshProps.cxx
- Please add copyright line in the file beginning:
// Copyright (c) 2018 OPEN CASCADE SAS
src/BRepGProp/BRepGProp_MeshSinert.hxx
- 42: missing end of sentense point.
- 46: Wrap too long line.
src/BRepGProp/BRepGProp_MeshVinert.hxx
- 47: Wrap too long line.
src/BRepGProp/BRepGProp_MeshProps.hxx
- 30: It looks the same as of BRepGProp_MeshSinert. It is needed to tell that this class is capable of computing surface or volume properties.
src/BRepGProp/BRepGProp.hxx
- 96, 135, 148, 186, 200, 215, 217: please wrap long lines.
src/DBRep/DBRep.cxx
- Please update the help of the command tclean with new option "-geom".
tests/bugs/modalg_7/bug29734
- 9-10, 21-22: upvar is not needed for strings.
src/BRepGProp/BRepGProp_MeshCinert.hxx
src/BRepGProp/BRepGProp_MeshCinert.cxx
src/BRepGProp/BRepGProp_MeshSinert.hxx
src/BRepGProp/BRepGProp_MeshSinert.cxx
src/BRepGProp/BRepGProp_MeshVinert.hxx
src/BRepGProp/BRepGProp_MeshVinert.cxx
src/BRepGProp/BRepGProp_MeshProps.hxx
src/BRepGProp/BRepGProp_MeshProps.cxx
- Please add copyright line in the file beginning:
// Copyright (c) 2018 OPEN CASCADE SAS
src/BRepGProp/BRepGProp_MeshSinert.hxx
- 42: missing end of sentense point.
- 46: Wrap too long line.
src/BRepGProp/BRepGProp_MeshVinert.hxx
- 47: Wrap too long line.
src/BRepGProp/BRepGProp_MeshProps.hxx
- 30: It looks the same as of BRepGProp_MeshSinert. It is needed to tell that this class is capable of computing surface or volume properties.
src/BRepGProp/BRepGProp.hxx
- 96, 135, 148, 186, 200, 215, 217: please wrap long lines.
src/DBRep/DBRep.cxx
- Please update the help of the command tclean with new option "-geom".
tests/bugs/modalg_7/bug29734
- 9-10, 21-22: upvar is not needed for strings.
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been updated forcibly by Author.
[revision removed]
[revision removed]
Some code formatting and comments updating have been done.
Reviewed.
+void BRepGProp_MeshProps::Perform(const Handle(Poly_Triangulation)& theMesh,
+ const TopLoc_Location& theLoc,
+ const TopAbs_Orientation theOri)
+{
+ if (theLoc.IsIdentity())
+ {
+ Perform(theMesh->Nodes(), theMesh->Triangles(), theOri);
+ }
+ else
+ {
+ Standard_Integer aNbNodes = theMesh->NbNodes();
+ TColgp_Array1OfPnt aTrNodes(1, aNbNodes);
+ const gp_Trsf& aTr = theLoc.Transformation();
+ const TColgp_Array1OfPnt& aNodes = theMesh->Nodes();
+ Standard_Integer i;
+ for (i = 1; i <= aNbNodes; ++i)
+ {
+ aTrNodes.SetValue(i, aNodes.Value(i).Transformed(aTr));
+ }
+ Perform(aTrNodes, theMesh->Triangles(), theOri);
+ }
Is it possible avoiding copying of entire triangulation when it is passed with Location?
+private: //! @name private fields + + void CalculateProps(const gp_Pnt& p1, const gp_Pnt& p2, const gp_Pnt& p3, + const gp_Pnt& Apex, + Standard_Real GProps[10], + const Standard_Integer NbGaussPoints, + const Standard_Real* GaussPnts); + + BRepGProp_MeshObjType myType; //!< Type of geometric object
Could you please also make this method protected (or public static)?
It can be reused for implementing the same tool processing triangulation not in Poly_Triangulation form.
Dear Igor, please consider KGV's remarks.
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
CR29734 is updated according to KGV remarks
Reviewed.
Combination -
OCCT branch : [archived branch] SHA - [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:
Debian70-64:
OCCT
Total CPU difference: 17086.430000000008 / 17011.039999999866 [+0.44%]
Products
Total CPU difference: 7346.630000000022 / 7436.080000000027 [-1.20%]
Windows-64-VC10:
OCCT
Total CPU difference: 16889.198663398634 / 16821.494229398526 [+0.40%]
Products
Total CPU difference: 8048.8871950998755 / 8185.31006959986 [-1.67%]
Image differences :
No differences that require special attention
Memory differences :
No differences that require special attention
OCCT branch : [archived branch] SHA - [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:
Debian70-64:
OCCT
Total CPU difference: 17086.430000000008 / 17011.039999999866 [+0.44%]
Products
Total CPU difference: 7346.630000000022 / 7436.080000000027 [-1.20%]
Windows-64-VC10:
OCCT
Total CPU difference: 16889.198663398634 / 16821.494229398526 [+0.40%]
Products
Total CPU difference: 8048.8871950998755 / 8185.31006959986 [-1.67%]
Image differences :
No differences that require special attention
Memory differences :
No differences that require special attention
roughBaryCenter() in BRepGProp.cxx uses TopoDS_Vertex in the Shape,
which will be unavailable in case of triangulation-only Faces.
Can this lead to incorrect result?
I think that dim should be checked for 0.0 to avoid possible division by zero FPE in case of degenerated triangulation.
Seems to be static const.
This field is still private.
which will be unavailable in case of triangulation-only Faces.
Can this lead to incorrect result?
+ dim = aGProps[0]; + g.SetX(aGProps[1] / dim); + g.SetY(aGProps[2] / dim); + g.SetZ(aGProps[3] / dim);
I think that dim should be checked for 0.0 to avoid possible division by zero FPE in case of degenerated triangulation.
+ static Standard_Real GPtsWg[] =
Seems to be static const.
+private: //! @name private fields + BRepGProp_MeshObjType myType; //!< Type of geometric object
This field is still private.
Dear Igor, please consider new remarks.
In roughBaryCenter(), you can consider triangulation nodes if i==0 after iteration by vertices.
To get read access to the field "BRepGProp_MeshObjType myType", please add a public method.
In roughBaryCenter(), you can consider triangulation nodes if i==0 after iteration by vertices.
To get read access to the field "BRepGProp_MeshObjType myType", please add a public method.
> In roughBaryCenter(), you can consider triangulation nodes if i==0 after iteration by vertices.
Andrey suggests that for algorithm it is sufficient providing a point near enough to the shape itself.
E.g., if shape contains at list one TopoDS_Vertex - it would be sufficient taking it's coordinates (without averaging all Vertices, which could be removed)
and if not - take a first Node from Triangulation from any Face.
Andrey suggests that for algorithm it is sufficient providing a point near enough to the shape itself.
E.g., if shape contains at list one TopoDS_Vertex - it would be sufficient taking it's coordinates (without averaging all Vertices, which could be removed)
and if not - take a first Node from Triangulation from any Face.
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
CR29734 is updated
Reviewed.
Branch [archived branch] has been created by Commenter 1.
[revision removed]
Detailed log of new commits:
Author: ifv
Date: Thu May 17 15:38:17 2018 +0300
0029734: Modeling Algorithms - Compute global properties of tessellated shape
New algorithms using mesh data for calculation have been added: BRepGProp_MeshCinert, BRepGProp_MeshProps.
In API a special flag, which defines preferable source for calculations, has been added.
[revision removed]
Detailed log of new commits:
Author: ifv
Date: Thu May 17 15:38:17 2018 +0300
0029734: Modeling Algorithms - Compute global properties of tessellated shape
New algorithms using mesh data for calculation have been added: BRepGProp_MeshCinert, BRepGProp_MeshProps.
In API a special flag, which defines preferable source for calculations, has been added.
Last fix caused regression on windows and Linux on the same case
emesh bugs bug29774
http://occt-tests/CR29734-master-KGV-Products/Debian70-64/summary.html
http://occt-tests/CR29734-master-KGV-Products/Windows-64-VC10/summary.html
emesh bugs bug29774
http://occt-tests/CR29734-master-KGV-Products/Debian70-64/summary.html
http://occt-tests/CR29734-master-KGV-Products/Windows-64-VC10/summary.html
Fix has been rebased to current master.
http://jenkins-test-11.nnov.opencascade.com/view/CR29734_1-master-KGV/
http://jenkins-test-11.nnov.opencascade.com/view/CR29734_1-master-KGV/
Combination -
OCCT branch : [archived branch] SHA - [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:
Debian70-64:
OCCT
Total CPU difference: 17038.400000000005 / 17008.500000000095 [+0.18%]
Products
Total CPU difference: 7457.790000000032 / 7460.130000000034 [-0.03%]
Windows-64-VC10:
OCCT
Total CPU difference: 16875.704576898515 / 16835.17551709858 [+0.24%]
Products
Total CPU difference: 8272.811030499875 / 8259.114142699882 [+0.17%]
Image differences :
No differences that require special attention
Memory differences :
No differences that require special attention
OCCT branch : [archived branch] SHA - [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:
Debian70-64:
OCCT
Total CPU difference: 17038.400000000005 / 17008.500000000095 [+0.18%]
Products
Total CPU difference: 7457.790000000032 / 7460.130000000034 [-0.03%]
Windows-64-VC10:
OCCT
Total CPU difference: 16875.704576898515 / 16835.17551709858 [+0.24%]
Products
Total CPU difference: 8272.811030499875 / 8259.114142699882 [+0.17%]
Image differences :
No differences that require special attention
Memory differences :
No differences that require special attention
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been deleted by Commenter 1.
[revision removed]
[revision removed]
Branch [archived branch] has been deleted by Commenter 1.
[revision removed]
[revision removed]
Related records