Rename transformation functions starting with "add_"

A suggestion for clarity in the extensions API:

A number of functions for applying transformations and/or transformation operations in transforms.py are named following the pattern "add_something".

This naming pattern makes correct use of the word "add" in the grammatical sense of putting an ingredient into something -- as one adds vanilla to cookie batter, or one adds a skew to a set of SVG elements. However there are cases where it is not correct in the sense that the relevant functions do not describe mathematical addition.

A particularly glaring example is the function add_matrix().

This function does not perform matrix addition (A + B), but rather performs matrix multiplication (AB).

While "add_matrix" could be considered correct in a grammatical sense...

  1. It really isn't correct in a mathematical sense.
  2. If someone wanted to add matrices, they would think that this was the right function to use.
  3. If someone wanted to multiply matrices, they would not easily be able to locate this function.
  4. If one wanted to create a function to add matrices, this name is already taken

I suggested that this function be renamed add_matrix() -> multiply_matrix()

The add_matrix() function is not presently used outside of transformations.py, and would be easy to rename.

Similarly, the following functions essentially describe matrix multiplication:

  • add_translate
  • add_scale
  • add_rotate
  • add_skewx
  • add_skewy

These functions would be better named as apply_translate and so forth. While the names are not quite as glaring, they do describe applying a transformation to an object rather than arithmatical addition.

Of these, add_skewx and add_skewy are only found in transformations.py.

The others are currently found in a relatively small number of times, approximately 36 uses total across 18 files:

  • barcode/Base.py
  • dpiswitcher.py
  • dxf_input.py
  • gcodetools.py
  • generate_voronoi.py
  • grid_cartesian.py
  • grid_polar.py
  • hpgl_encoder.py
  • interp_att_g.py
  • layers2svgfont.py
  • layout_nup.py
  • polyhedron_3d.py
  • render_barcode_qrcode.py
  • tests/test_inkex_transforms.py
  • tests/test_inkex_elements_base.py
  • tests/test_inkex_elements.py
  • tests/test_inkex_paths.py
  • transformations.py