[webkit-reviews] review requested: [Bug 30442] Add helper methods to determine whether a transformation matrix is only scaled or translated : [Attachment 41383] Add a mapsRectToRect() helper method to TransformationMatrix (try 2)
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Sun Oct 18 10:46:58 PDT 2009
Jakob Petsovits <jpetsovits at rim.com> has asked for review:
Bug 30442: Add helper methods to determine whether a transformation matrix is
only scaled or translated
https://bugs.webkit.org/show_bug.cgi?id=30442
Attachment 41383: Add a mapsRectToRect() helper method to TransformationMatrix
(try 2)
https://bugs.webkit.org/attachment.cgi?id=41383&action=review
------- Additional Comments from Jakob Petsovits <jpetsovits at rim.com>
> But a rotated rectangle is still a rectangle.
It's not a "Rect" (IntRect, FloatRect) though, so the function name is correct
- while the comment and commit message were slightly off this way, I changed
those to say "upright rectangle" instead of just "rectangle".
> And it's very possible that a
> matrix that returned true from the above function would still not preserve
> rectangularity. For instance, something other than 1 in [3][3] would fail.
Well, the corresponding code in multVecMatrix() (2D version, used by
mapPoint(), which is in turn used by mapQuad(), and that's used by mapRect())
goes like this:
double w = m_matrix[3][3] + x * m_matrix[0][3] + y * m_matrix[1][3];
if (w != 1 && w != 0) {
resultX /= w;
resultY /= w;
}
Assuming that [0][3] and [1][3] are 0 (which my method ensures), w is not
affected by the x and y coordinates, which means that similar input x/y values
will result in similar output values as well. For IntRects and FloatRects,
which feature similar x/y values for their edges, it means that even if [3][3]
is something other than 1 it will still result in an upright {Int,Float}Rect.
Personally I don't care whether I check for [3][3] or not, I just thought I'd
match the semantics with the function name.
> It seems like you are trying to create a low-level function that serves a
very
> specific purpose but it's not clear what that purpose is. If what you want is
> some optimized way to do bounds or intersection checking, perhaps it would be
> better to add that function to TransformationMatrix rather than a function
like
> this.
Nope, it's not meant to do anything more lower-level than checking if I can
avoid using (and cumbersome checking of) Quads.
More information about the webkit-reviews
mailing list