Skip to content

Commit

Permalink
STYLE: Let SpatialObject directly access its m_ObjectToWorldTransform
Browse files Browse the repository at this point in the history
Replaced `SpatialObject::GetObjectToWorldTransform()` calls within the
implementation of SpatialObject with direct access to its own
`m_ObjectToWorldTransform` data member.

Follow-up to pull request #4435
commit 1e0475c "PERF: Let SpatialObject
directly access m_ObjectToWorldTransformInverse"

(However, in this case, no significant performance improvement is expected, so
it's just a matter of style.)
  • Loading branch information
N-Dekker committed Feb 11, 2024
1 parent a5d9526 commit fa52dba
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Modules/Core/SpatialObjects/include/itkSpatialObject.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ SpatialObject<TDimension>::GetFamilyBoundingBoxInWorldSpace() const -> const Bou
auto itTrans = transformedCorners->begin();
while (it != corners.end())
{
const PointType pnt = this->GetObjectToWorldTransform()->TransformPoint(*it);
const PointType pnt = this->m_ObjectToWorldTransform->TransformPoint(*it);
*itTrans = pnt;
++it;
++itTrans;
Expand Down Expand Up @@ -511,7 +511,7 @@ SpatialObject<TDimension>::ProtectedComputeObjectToWorldTransform()
m_ObjectToWorldTransform->SetParameters(this->GetObjectToParentTransform()->GetParameters());
if (this->HasParent())
{
m_ObjectToWorldTransform->Compose(this->GetParent()->GetObjectToWorldTransform(), false);
m_ObjectToWorldTransform->Compose(this->GetParent()->m_ObjectToWorldTransform, false);
}

if (!m_ObjectToWorldTransform->GetInverse(m_ObjectToWorldTransformInverse))
Expand Down Expand Up @@ -565,7 +565,7 @@ SpatialObject<TDimension>::ComputeObjectToParentTransform()
if (this->HasParent())
{
auto inverse = TransformType::New();
if (this->GetParent()->GetObjectToWorldTransform()->GetInverse(inverse))
if (this->GetParent()->m_ObjectToWorldTransform->GetInverse(inverse))
{
m_ObjectToParentTransform->Compose(inverse, true);
}
Expand Down Expand Up @@ -632,7 +632,7 @@ SpatialObject<TDimension>::GetMyBoundingBoxInWorldSpace() const -> const Boundin
auto itTrans = transformedCorners->begin();
while (it != corners.end())
{
const PointType pnt = this->GetObjectToWorldTransform()->TransformPoint(*it);
const PointType pnt = this->m_ObjectToWorldTransform->TransformPoint(*it);
*itTrans = pnt;
++it;
++itTrans;
Expand Down Expand Up @@ -1015,7 +1015,7 @@ SpatialObject<TDimension>::SetParent(Self * parent)
if (parent != m_Parent)
{
Self * oldParent = m_Parent;
const TransformType * oldObjectWorldTransform = this->GetObjectToWorldTransform();
const TransformType * oldObjectWorldTransform = this->m_ObjectToWorldTransform;

m_Parent = parent;
if (parent != nullptr)
Expand Down Expand Up @@ -1251,7 +1251,7 @@ SpatialObject<TDimension>::CopyInformation(const DataObject * data)
this->SetProperty(source->GetProperty());

// copy the ivars
this->SetObjectToWorldTransform(source->GetObjectToWorldTransform());
this->SetObjectToWorldTransform(source->m_ObjectToWorldTransform);
this->SetDefaultInsideValue(source->GetDefaultInsideValue());
this->SetDefaultOutsideValue(source->GetDefaultOutsideValue());

Expand Down

0 comments on commit fa52dba

Please sign in to comment.