Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAssociativity issue because w is not multiplied #157
Conversation
| fn approx_eq(&self, other: &Self) -> bool { | ||
| self.approx_eq_eps(&other, &Self::approx_epsilon()) | ||
| } | ||
| } |
This comment has been minimized.
This comment has been minimized.
|
|
|
@nical What should be done here? Is it intentional that users can't treat a Matrix4D as a general-purpose 4x4 matrix? I feel like m14, m24 & m34 shouldn't be exposed if setting them to non-zero values can cause unexpected results. Likewise for m44 being set to a non-unit value. |
|
I am in favor of fixing the 4D multiplication the way you propose in your patch. |
|
Ok. I think it's worth mentioning that Firefox currently implements it without the multiplying |
|
Yes, I'll handle the gecko side, we should definitely have the same behavior to avoid interop headaches. |
|
|
|
We should merge this. The gecko equivalent has landed in mozilla-central, by the way. |
|
@peterjoel needs to rebase it. |
|
@bors-servo delegate=nical |
|
|
|
@bors-servo r+ |
|
|
Associativity issue because w is not multiplied Transforming a point by two matrices in sequence should be the same as premultiplying the matrices and performing one transformation. The issue appears to be because the `w` field of the point is assumed to be always 1. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/euclid/157) <!-- Reviewable:end -->
|
|
Separate Point and Vector types This changeset implements my proposal from issue #151: - TypedVector2D and TypedVector3D types are added (no 4D vector) - Matrix types implement separate transformations for points and vectors - the 4D vector is removed, and along with it the bug-prone behavior of ignoring its w component half of the time. - Point arithmetic is changed so that: - Point + Point is not implemented - Point + Vector = Point - Point - Point = Vector With points and vectors as separate types, we don't need the 4D types anymore because the homogeneous coordinate is part type itself: for vectors it is always zero, and for points it is always one. Matrix transformations always divide the resulting points by w. It avoids the confusion that motivated the PR #157, where w was ignored in half of euclid because the code expected it to be equal to one. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/euclid/159) <!-- Reviewable:end -->
peterjoel commentedAug 17, 2016
•
edited by larsbergstrom
Transforming a point by two matrices in sequence should be the same as premultiplying the matrices and performing one transformation.
The issue appears to be because the
wfield of the point is assumed to be always 1.This change is