Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » Painter and transformations
Painter and transformations [message #38837] |
Tue, 22 January 2013 18:29  |
mdelfede
Messages: 1308 Registered: September 2007
|
Ultimate Contributor |
|
|
Hi, usually (in many other geometric tools) this code
painter.Translate(-jg.center);
if(rot)
painter.Rotate(-jg.angle);
painter.Translate(dx, dy);
(do something with painter)
painter.Translate(-dx, .dy);
if(rot)
painter.Rotate(jg.angle);
painter.Translate(jg.center);
shiould behave exactly like this one :
Xform2D trsf;
trsf = Xform2D::Translation(-jg.center.x, -jg.center.y);
if(rot)
trsf = trsf * Xform2D::Rotation(-jg.angle);
trsf = trsf * Xform2D::Translation(dx, dy);
// translate painter to fit left joint center
painter.Transform(trsf);
(do something with painter)
trsf = Inverse(trsf);
painter.Transform(trsf);
But it doesn't.... and I still don't understand how Upp does manage combined transformations.
By now I solved with second way, but I guess it would be by far more intuitive to fix the first one; each transformation should apply to "modified" reference done by former ones.
Anyways, it would be useful to add some member functions to Xform2d, to make possible to do something like this :
Xform2d trsf = Xform2d().Translated(p).Rotated(a).Scaled(x);
Max
[Updated on: Tue, 22 January 2013 18:37] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Fri May 09 22:50:08 CEST 2025
Total time taken to generate the page: 0.02051 seconds
|