1
\$\begingroup\$

I have a question concerning matrix transformations. I Think I know how it could be done, but Im not sure its the best/correct way to do it.

I want to apply World translations and rotation to an object but the scale should be consistent. See the image for example. The object closest to origo scales according to World-scale, the other object has the same scale but is placed correctly (World scale is taken into consideration when translating). I know I can do this by applying the inverse scale transform in local space Before translating and applying World-transforms. But is there some better way?

enter image description here

\$\endgroup\$
2
  • 2
    \$\begingroup\$ I'm a confused about what exactly you want to do. Do you want to draw everything except certain objects at one scale, and everything else in the world at another? \$\endgroup\$
    – Anko
    Commented Oct 6, 2015 at 8:48
  • 2
    \$\begingroup\$ Yes, for instance, if I zoom in a map, I want the markers to be positioned at a certain geo-position but I dont want the markers to scale with the map-zoom. I can apply the inverse map-scaling matrix to the marker to achieve this but I was just wondering if I could do it in a way not to use the inverse. \$\endgroup\$
    – davidjons
    Commented Oct 6, 2015 at 10:36

1 Answer 1

0
\$\begingroup\$

The data visualisation terms for this are
geometric zooming (which literally increases size), and
semantic zooming (scaling underlying positions).

Your initial scaling matrix alone would be a geometric zoom. Everything appears in the correct position, but also becomes larger. Your second operation of inverse-scaling relative to the new position essentially converts it into a semantic zoom, for that marker.

You could implement a semantic zoom more efficiently by just multiplying each marker's translation from the origin by the zoom factor. That way, everything is moved by the correct distance, but the markers' rendered graphics don't change size, so there's no need for the second corrective operation.

Both methods should yield mathematically equivalent results, but the latter is a little more performant (because it doesn't require "undoing" work with an inverse), and easier to read.


If you do want the markers to be differently sized or rotated, you can of course apply additional transformations once they're translated to their semantic-zoom positions.

\$\endgroup\$
2
  • \$\begingroup\$ This is awesome, sorry for not responding. Thank you very much \$\endgroup\$
    – davidjons
    Commented Oct 21, 2015 at 7:07
  • \$\begingroup\$ @david No worries. Happy if it helps! \$\endgroup\$
    – Anko
    Commented Oct 21, 2015 at 8:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .