1

I consider this a mathematics questions because I am building a library that allows perspectival distortions projected over a map.

here is an example of the action I am describing

The action is built with math formulas written for both the scale and rotate aspect:

scaleBy: function(scale) {
  var map = this._map;
  var center = map.project(this.getCenter());
  var p;
  var scaledCorners = {0: '', 1: '', 2: '', 3: ''};

  for (var i = 0; i < 4; i++) {
    p = map
      .project(this.getCorner(i))
      .subtract(center)
      .multiplyBy(scale)
      .add(center);
    scaledCorners[i] = map.unproject(p);
  }

  this.setCorners(scaledCorners);

  return this;
},

rotateBy: function(angle) {
  var map = this._map;
  var center = map.project(this.getCenter());
  var corners = {0: '', 1: '', 2: '', 3: ''};
  var p;
  var q;

  for (var i = 0; i < 4; i++) {
    p = map.project(this.getCorner(i)).subtract(center);
    q = L.point(
      Math.cos(angle) * p.x - Math.sin(angle) * p.y,
      Math.sin(angle) * p.x + Math.cos(angle) * p.y
    );
    corners[i] = map.unproject(q.add(center));
  }

  this.setCorners(corners);

  return this;
},

I currently refer to the action as rotateScale, but there has to be a mathematical term for this? And possibly a formula for the optimal way to combine these actions (currently just calling rotateBy, then scaleBy immediately after.)

Have considered transformation matrices and those are off the table because they are reserved for handling map projection logic.

What you call this? Considered FreeScale, FreeRotate, both not really accurate

  • 1
    This is a 'similarity transformation', since your transformation preserves angles and the ratios between distances. However, 'similarity transformation' is a more general term, since a scaling followed by a translation or reflection falls into this category. – Toby Mak Sep 14 '19 at 04:11
  • Also, can you explain why you cannot use transformation matrices? What is 'handling map projection logic'? – Toby Mak Sep 14 '19 at 04:12
  • 1
    This is a linear conformal mapping. Although the term 'conformal mapping' refers to more general class of functions which preserves angles and orientations, a map is both linear and conformal if and only if it is a rotation followed by scaling. But given the lengthiness of the term, calling it 'RotateScale' would cause no harm... – Sangchul Lee Sep 14 '19 at 04:20
  • 1
    I've seen "rotodilation", although I can't find a reference. (Not-unrelatedly, Wikipedia lists "rotoreflection" (which I've seen) as a synonym for "improper rotation" (which I'd never seen before).) Given that you're using the verb "scale" instead of "dilate", "rotoscale" might be a good alternative; that said, if you're going to coin a word, then "rotateScale" might impose less of a cognitive burden. – Blue Sep 14 '19 at 06:33
  • I agree with @Toby Mak that "similarity transformation" is a classical, non ambiguous term. In case of doubt "direct similarity transformation" with matrix $\begin{pmatrix}r \cos(a)&-r \sin(a)\r \sin(a)&r \cos(a)\end{pmatrix}$ with $r>0$ for a direct one and $r<0$ for an indirect one (with an added symmetry) – Jean Marie Sep 14 '19 at 09:08
  • @Blue rotodilation really describes it for me. Genuis. Found an article briefly referencing it: https://www.researchgate.net/post/What_is_the_faithful_and_full_representation_of_unitary_quaternions_in_the_three_dimensional_real_Euclidean_space2. Thank you!! – devdev_dev Sep 15 '19 at 15:26

0 Answers0