[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #13181] NSAffineTransform order of operations
From: |
anonymous |
Subject: |
[bug #13181] NSAffineTransform order of operations |
Date: |
Wed, 25 May 2005 06:44:38 +0000 |
User-agent: |
Mozilla/5.0 (X11; U; Linux ppc; en-US; rv:1.2.1) Gecko/20030228 |
URL:
<http://savannah.gnu.org/bugs/?func=detailitem&item_id=13181>
Summary: NSAffineTransform order of operations
Project: GNUstep
Submitted by: None
Submitted on: Wed 05/25/2005 at 02:44
Category: None
Severity: 3 - Normal
Item Group: Bug
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
_______________________________________________________
Details:
I'm not sure if this is a bug or ignorance. The following bit of code in a
graphing application is used to convert data coordinates to screen
coordinates:
[toScreenCoordinates release];
toScreenCoordinates = [[NSAffineTransform transform] retain]; // start
fresh
// the order of operations is important for matrix algebra!
[toScreenCoordinates scaleXBy: (viewRect.size.width /
dataBounds.size.width)
yBy: (viewRect.size.height /
dataBounds.size.height)];
[toScreenCoordinates translateXBy: -dataBounds.origin.x
yBy: -dataBounds.origin.y];
It works correctly under OSX but not under GNUstep. The strange part is this:
When I swap the last two operations the code behaves identically for OSX and
GNUstep, unfortunately it is the undesired behavior. For GNUstep it makes no
difference what order the translation and scaling are done, it behaves the
same. For OSX, one way does the transform I need and the other does not. (The
comment line is a reminder to myself not to get them out of order again.)
The reverse transformation, screen to data, works equally well for both OSX
and GNUstep. It requires that the translation be performed before the
scaling.
[toDataCoordinates release]; // start fresh
toDataCoordinates = [[NSAffineTransform transform] retain];
[toDataCoordinates translateXBy: dataBounds.origin.x
yBy:
dataBounds.origin.y];
[toDataCoordinates scaleXBy: (dataBounds.size.width /
viewRect.size.width)
yBy:
(dataBounds.size.height / viewRect.size.height)];
Mark Tracy
tracy454@concentric.net
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?func=detailitem&item_id=13181>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [bug #13181] NSAffineTransform order of operations,
anonymous <=