Comments (6)
cc @SimonSapin, @glennw, @pcwalton, @metajack, @asajeffrey, @nox
Big topic. I wish I had looked into these before MozLondon.
from euclid.
Hm, I delved a bit and I realize the issue is not as I bad as I thought: the only convention difference is in the order in which transformations are expressed (A = B x C
vs A = C x B
). The resulting matrix is laid out the same way gecko and servo which means the interop issue is only that gecko devs may mistakenly write a.mul(b)
when writing they should write b.mul(a)
in servo code. When I filed this I though the matrix layout was not the same which mean creating a matrix in gecko and pass it to webrender would be incorrect (which was terrifying).
May bad. That said, having the same conventions in gecko and servo would really help if we are to share more code so my proposal still holds.
In short: change the order of multiplications: a.mul(b)
would produce the equivalent of what b.mul(a)
does currently, and translate/scale/etc. would turn into pre_translate/post_translate/pre_scale/etc. to avoid making mistakes (servo's current operations are pre_ operations).
from euclid.
Changing the order of the operations to match what gecko does sounds good to me!
from euclid.
I don't know anything about Gecko, but the Euclid matrix layout is different from the w3c geometry specifications. For example, this geometry specification uses the last column for translation, while Euclid uses the last row.
There may be more value in compatibility with specifications than with Gecko.
from euclid.
I don't really have much of an opinion either way.
from euclid.
I have a branch [1] on top of the units work, with pre- and post-operations exposed explicitly (I even removed mul in favor of pre_mul/post_mul). It also has row-major and column-major interfaces implemented to help with interfacing with the DOM or whatnot (cf. issue #146), and I added a lot of the missing documentation.
Feedback very welcome. So far my impression is that nobody is opposed to what I propose here. Other people in the gfx team also expressed that it would be nice to have familiar interfaces in euclid (about the pre and post transforms).
I'll make a pull request if/when the units stuff moves forward (I'm confident I'd mess up rebasing two dependent PRs).
[1] https://github.com/nical/euclid/blob/pre-post/src/matrix4d.rs
from euclid.
Related Issues (20)
- Rect::intersection should return None in the presence of NaN.
- (breaking change) self vs &self and non-copy scalars HOT 5
- Fails to compile with --no-default-features HOT 2
- Vector missing the Sum trait HOT 3
- Support for numeric casts through `az` crate HOT 2
- Constructors: splat, one HOT 3
- Component-wise multiplication for Vector2 HOT 2
- Component-wise division for Vector2 HOT 2
- Support for bytemuck Pod and Zeroable HOT 2
- Distinguish between orientation and rotation.
- missing `AddAssign` impl for `SideOffsets2D` HOT 1
- Add tags for releases on crates.io HOT 1
- Implement more `num-traits` (e.g. checked arithmetic) HOT 2
- Poor accuracy in Vector2D::angle_from_x_axis HOT 1
- Scale `mod`, `div` by scalar HOT 3
- Unresolved Import `num_traits::Euclid` HOT 3
- Box inclusive contains HOT 7
- Point2D/Point3D missing Add<Point2D<T, U>> impl HOT 1
- Add splat function for SideOffsets2D HOT 1
- The `from_points` for `Box2D` and `Box3D` does not work quite as advertised. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from euclid.