
Wed, 11/15/2023 - 11:24
I am trying to understand where a transformation of a given object is stored. Any hints?
For example, the following code creates and scales the edge:
gp_Trsf scaling_trf;
const gp_Pnt tpnt(0, 0, 0);
scaling_trf.SetScale(tpnt, 0.1);
// Create geometry
gp_Pnt pnt (0., 0, 0);
gp_Pnt pnt1 (10., 0, 0);
auto curve = GC_MakeSegment(pnt, pnt1).Value();
auto edge = BRepBuilderAPI_MakeEdge(curve).Edge();
// Do scaling
BRepBuilderAPI_Transform scaling(edge, scaling_trf);
auto new_shape = scaling.ModifiedShape(edge);
auto ScalingFactor = new_shape.Location().Transformation().ScaleFactor();
Standard_Real f, l;
TopLoc_Location loc;
auto a_curve = BRep_Tool::Curve(TopoDS::Edge(new_shape),loc,f,l);
shape.Location().Transformation().ScaleFactor() returns 1 instead of 0.1.
The first and last bounds returned with BRep_Tool::Curve, however, are correctly scaled.
If one uses shape.Location().Transformation().VectorialPart() or shape.Location().Transformation().TranslationPart() there is no hint that the edge was actually scaled.
Where is the transformation actually stored and how can I access it? Is this dependent on the transformation form (Scale, Mirror, Rotate)?
Is there also a Location for the Geom_Curve object? How do I access it?
P.S.: Tried it with a circle, and the new_shape object has the scaled Geom_Circle->Radius(). So in this particular case the change was done to the Geom_Curve, for the segment it is done as the limits. So it depends on the shape being analysed. It is a shame that the transformation itself is not stored. This way there is no hint of how the original radius looked like. I guess a BSpline would have a different behaviour too.
Wed, 11/15/2023 - 14:05
Geom_Curve and any other Geom objects has no information about transformation. Any operation of transform apply on geometry itself, update original values.
Only topology be able to store TopLoc_Location as a cascade of transfromation operations.
Best regards, Dmtrii.