Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » Painter and transformations
Painter and transformations [message #38837] Tue, 22 January 2013 18:29 Go to previous message
mdelfede is currently offline  mdelfede
Messages: 1307
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

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How must Alpha be managed ??
Next Topic: Crash in Painter
Goto Forum:
  


Current Time: Fri Apr 19 15:14:47 CEST 2024

Total time taken to generate the page: 1.03972 seconds