Skip to content

Commit

Permalink
Scale BaseAxis properly (#88)
Browse files Browse the repository at this point in the history
* add ogre2 arrow and axis visual

Signed-off-by: Ian Chen <[email protected]>

* changelog and remove unused code

Signed-off-by: Ian Chen <[email protected]>

* changelog

Signed-off-by: Ian Chen <[email protected]>

* Scale BaseAxis properly

Signed-off-by: ahcorde <[email protected]>

* Overwrite only SetLocalScale math::Vector3d in BaseAxisVisual and removed private declaration of arrows

Signed-off-by: ahcorde <[email protected]>

* changelog

Signed-off-by: Ian Chen <[email protected]>

* Fixed UNIT_VisualAxis_TEST

Signed-off-by: ahcorde <[email protected]>

* Fixed linters

Signed-off-by: ahcorde <[email protected]>

* Remove compiler warning in BaseAxisVisual

Signed-off-by: ahcorde <[email protected]>

Co-authored-by: Ian Chen <[email protected]>
  • Loading branch information
ahcorde and iche033 authored May 29, 2020
1 parent bcd9c49 commit 5025487
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

### Ignition Rendering 4.0.0

1. Scale BaseAxis properly
* [Pull request #88](https:/ignitionrobotics/ign-rendering/pull/88)

1. Add ogre2 AxisVisual and ArrowVisual
* [Pull request 87](https:/ignitionrobotics/ign-rendering/pull/87)

Expand Down
29 changes: 28 additions & 1 deletion include/ignition/rendering/base/BaseAxisVisual.hh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,14 @@ namespace ignition

public: virtual ~BaseAxisVisual();

public: virtual void Init();
public: virtual void Init() override;

// Documentation inherited.
public: virtual void SetLocalScale(
const math::Vector3d &_scale) override;

// Documentation inherited.
public: virtual math::Vector3d LocalScale() const override;
};

//////////////////////////////////////////////////
Expand All @@ -51,6 +58,26 @@ namespace ignition
{
}

//////////////////////////////////////////////////
template <class T>
math::Vector3d BaseAxisVisual<T>::LocalScale() const
{
if (this->ChildCount() > 0) {
return this->ChildByIndex(0)->LocalScale();
}
return math::Vector3d::Zero;
}

//////////////////////////////////////////////////
template <class T>
void BaseAxisVisual<T>::SetLocalScale(const math::Vector3d &_scale)
{
for (unsigned int i = 0; i < this->ChildCount(); ++i)
this->ChildByIndex(i)->SetLocalScale(_scale.X(),
_scale.Y(),
_scale.Z());
}

//////////////////////////////////////////////////
template <class T>
void BaseAxisVisual<T>::Init()
Expand Down

0 comments on commit 5025487

Please sign in to comment.