Possible optimization AIS_InteractiveContext.SetLocation

Andreas Fleischner's picture

Possible optimization

I tried to change the transform of the underling Graphic3d_CStructure
However changing the rendering transform over the InteractiveContext has some unnecessary overhead.

Best option would be to use a cheap value class (gp_Trsf) in the call, but:

---

AIS_InteractiveContext.SetLocation uses a TopLoc_Location object as parameter but internally only uses its gp_Trsf.
The TopLoc_Location is expensive to construct.
Bypassing to AIS_Shape.SetLocalTransformation(gp_Trsf) omits update of selection transforms.
Possible optimization:
Allow SetLocation with parameter gp_Trsf. TopLoc_Location implicit casts

---

The Prs3d_Presentation forwards to the Graphic3d_CStructure (functions Transform(), Move(), etc) by using a Handle(Geom_Transformation) and calling new inside.
This seems unnecessary as the usage of the Handle is only local and all the data is copied, so nothing gets shared.
Possible optimization:
Replace Handle(Geom_Transformation) with gp_Trsf

This would save several unnecessary memory allocations.

kgv's picture

Re: AIS_InteractiveContext.SetLocation

AIS_InteractiveContext.SetLocation uses a TopLoc_Location object as parameter but internally only uses its gp_Trsf.

AIS_InteractiveContext::SetLocation() takes TopLoc_Location for historical reasons - of course it would be more straightforward if there will be also method taking gp_Trsf. This patch will be welcome.
But I doubt it will have any performance effect.

The Prs3d_Presentation forwards to the Graphic3d_CStructure (functions Transform(), Move(), etc) by using a Handle(Geom_Transformation) and calling new inside.
This seems unnecessary as the usage of the Handle is only local and all the data is copied, so nothing gets shared.

The transformation is shared across different presentations of the same presentable object. Dynamic allocation should not be much problem here because PrsMgr_PresentableObject is very heavy object anyway.

www.opencascade.com

Copyright 2011-2016
OPEN CASCADE SAS
Contact us