View Issue Details

IDProjectCategoryView StatusLast Update
0033169CommunityOCCT:Modeling Algorithmspublic2023-02-04 16:24
Reporterchristopher.lackner_140546 Assigned Tochristopher.lackner_140546  
PrioritynormalSeveritymajor 
Status feedbackResolutionopen 
PlatformLinuxOSArch 
Product Version7.5.3 
Summary0033169: Modeling Algorithms - Wrong center after scaling with gp_GTrsf
DescriptionAfter a cylindrical scaling the center properties seem to be computed incorrectly. Attached an example with volume centre of mass, but also the surface properties seem to be off.
I would expect the center to stay the same.
Steps To Reproduce
  auto cyl = BRepPrimAPI_MakeCylinder(gp_Ax2({0., 0., 0.}, {0., 0., 1.}),
                                  0.1, 0.1);
  GProp_GProps props;
  BRepGProp::VolumeProperties(cyl, props);
  auto center = props.CentreOfMass();
  cout << "Volume center of cyl = " << center.X() << ", " << center.Y() << ", " << center.Z() << endl;
  gp_GTrsf trafo;
  trafo.SetVectorialPart( { 1.1, 0, 0,
        0, 1.1, 0,
        0, 0, 1 } );
  trafo.SetTranslationPart({ 0., 0., 0. });
  BRepBuilderAPI_GTransform builder(cyl, trafo, true);
  auto scaled = builder.Shape();
  BRepGProp::VolumeProperties(scaled, props);
  center = props.CentreOfMass();
  cout << "Volume center of scaled cyl = " << center.X() << ", " << center.Y() << ", " << center.Z() << endl;
Additional information
and documentation updates
Volume center of cyl = -1.34809e-17, 1.09606e-18, 0.05
Volume center of scaled cyl = 0.000779815, 6.86631e-18, 0.05

Expected would be that the X center is also 0, 7e-4 seems to far off for from a numerical 0.
TagsNo tags attached.
Test case number

Attached Files

  • wrong_center.cpp (1,112 bytes)
  • CMakeLists.txt (619 bytes)

Activities

christopher.lackner_140546

2022-10-12 11:59

reporter  

wrong_center.cpp (1,112 bytes)
CMakeLists.txt (619 bytes)

msv

2022-10-12 16:12

developer   ~0111524

There are two methods of computation of volume properties. One is the standard method, which precision is not controlled, and another is with adaptive integration. Please see their description in the corresponding header file. If you use the second method the precision can be increased:
BRepGProp::VolumeProperties(scaled, props, 1e-7);
Volume center of scaled cyl = -2.70359e-08, -5.7627e-18, 0.05

msv

2022-10-12 16:13

developer   ~0111525

So, this is not a bug.

christopher.lackner_140546

2023-01-16 13:09

reporter   ~0112809

Thank you for the clarification.

Issue History

Date Modified Username Field Change
2022-10-12 11:59 christopher.lackner_140546 New Issue
2022-10-12 11:59 christopher.lackner_140546 Assigned To => msv
2022-10-12 11:59 christopher.lackner_140546 File Added: wrong_center.cpp
2022-10-12 11:59 christopher.lackner_140546 File Added: CMakeLists.txt
2022-10-12 16:12 msv Note Added: 0111524
2022-10-12 16:13 msv Assigned To msv => christopher.lackner_140546
2022-10-12 16:13 msv Status new => feedback
2022-10-12 16:13 msv Note Added: 0111525
2023-01-16 13:09 christopher.lackner_140546 Note Added: 0112809
2023-02-04 16:24 dpasukhi Summary Wrong center after scaling with gp_GTrsf => Modeling Algorithms - Wrong center after scaling with gp_GTrsf
2023-02-04 16:24 dpasukhi Steps to Reproduce Updated
2023-02-04 16:24 dpasukhi Steps to Reproduce Updated