Hi Thomas,
 
Yeah, something is clearly wrong.  I still haven't been able to figure out 
precisely what.  Let me see if I can break this down into steps because I can't 
even follow what I've written.
 
I draw elements to my whiteboard.  I basically draw them with the mouse using 
canvas coordinates. I then use the inverse of the canvas' viewing transform to 
properly place them.  In the below example, the x, y, width, and height 
attributes represent the coordinates of the mouse used to draw the rectangle 
and the transform (representing the inverse of the viewing transform) 
"properly" places it on the document:
 
<rect x="20" y="20" width="200" height="200" transform="matrix(inverse of 
viewing transform)"/>
 
Now I use the mouse to draw a selection area.  I drag the coordinates with the 
mouse, create a <rect/> element to represent the selection box, but I don't 
append it to the document.  I want to draw it to the Overlay.  (This is where 
things might be incorrect!)  Since it's not part of the document, I get the x, 
y, width, and height from the element's attributes.  I get the screenCTM of the 
current layer (<g/> element) and inverse() it.  I push the points representing 
the upper-left and lower-right corners of the select box through the matrix.  
Then I create an SVGRect.
 
What I want to do is compare the area this SVGRect rects with the bounding 
boxes of the drawn elements that are actually on the canvas.  I want to get all 
the elements that are completely bounded by the select box.  For some reason, 
my coordinate systems aren't lining up.  I'm doing something wrong with the 
select box transform or the element transforms.  Somehow I need to get both on 
the same coordinate system.
 
Here's my only clue as to what's going on.  Things work until I resize the 
canvas.  If I draw a element and try to bound it, it seems to work fine (at 
least in one incarnation; I've tried this a bunch of different ways).  If I 
draw an element, resize the canvas (drag the edge, zoom in, zoom out, pan, 
etc.), then try to bound the element, it fails.  Between a viewing transform, a 
rendering transform, the select box CTM and screenCTM, the drawn elements CTM 
and screenCTM and various inverses, I think I'm lost.
 
Michael

________________________________

From: [email protected] [mailto:[email protected]]
Sent: Mon 12/22/2008 6:27 AM
To: [email protected]
Cc: [email protected]
Subject: Re: Resolving multiple matrices?



Hi Michael,

"Bishop, Michael W. CTR USJFCOM JFL" <[email protected]> wrote on 
12/15/2008 02:17:17 PM:

> * Draw an element:
> * Draw a select box:
> * Find all intersecting elements using SVGSVGElement.getIntersectionList(...)
>  
> * Iterate through the intersecting elements to find out which ones 
>   are contained in the select box.
>  
> I'm not sure how to do this if the screen size has changed since I 
> drew the element I'm trying to compare.  If I have a 640x480 
> document and I resize the JSVGCanvas horizontally, I still have a 
> 640x480 document in a bigger window with non-document area on the 
> left and right which is fine.  What I'm trying to do is find the 
> dimensions of the element in the CURRENT screen space.
>  
> selectBox->inverseOfParentScreenCTM == Current screen coordinates.
> element->inverseOfOldViewingTransform == Document coordinates -> ???
> -> Current screen coordinates.

   Your ??? should be the screenCTM. 

> Hopefully someone understands this and has a suggestion or two.  
> I've played with the element's CTM, screenCTM, the parent element's 
> CTM and screenCTM, and even both at once.

   Well you said you used that so something else must be the problem. 

<<winmail.dat>>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to