You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now the modifier class has an axis parameter that determines the axis of position and dimension modifications.
This parameter should instead be part of the modification itself, to have a better separation of concerns, increase code cohesion, and make the library easier to use.
For example, in the FixedOffsetModifier class there is a function that shifts the origin of the links and joints in the three dimensions. Since this is a method of the modifier class itself we shouldn't create more modifiers inside it, so it works like this:
original_modifier_axis=modifier.axis# save original modifier axismodification=Modification()
modifier.axis=Side.X# change it for each axis you want to changemodification.add_position(value_x, absolute)
modifier.modify(modification)
modifier.axis=Side.Ymodification.add_position(value_y, absolute)
modifier.modify(modification)
modifier.axis=Side.Zmodification.add_position(value_z, absolute)
modifier.modify(modification)
modifier.axis=original_modifier_axis# restore original modifier axis
This is how it would look with the axis being in the modification:
Right now the modifier class has an
axis
parameter that determines the axis ofposition
anddimension
modifications.This parameter should instead be part of the modification itself, to have a better separation of concerns, increase code cohesion, and make the library easier to use.
For example, in the
FixedOffsetModifier
class there is a function that shifts the origin of the links and joints in the three dimensions. Since this is a method of the modifier class itself we shouldn't create more modifiers inside it, so it works like this:This is how it would look with the axis being in the modification:
The code is shorter and makes more intuitive sense.
This change would break existing code however, so I'm open to feedback on the idea @traversaro @CarlottaSartore @AlexAntn
Dod
The
axis
parameter belongs to theModification
class instead ofModifier
The text was updated successfully, but these errors were encountered: