-
Notifications
You must be signed in to change notification settings - Fork 0
Coordinate Representations
matt0xFF edited this page Sep 14, 2021
·
1 revision
- Performance cost of extra coordinate is not very high
- Apple now uses two float64 coordinates, larger than 3 float32s
- VR/AR are growing industries
- Choosing 2D points now requires breaking compatibility with everything to change in the future
- 3D points work perfectly fine for 2D also, the 3rd coordinate can just be ignored
- Android uses integer coordinates, iOS floating point.
- Floating point can deal with large values without overflow (but losing precision)
- Overflow not likely to be an issue with most UIs (and 32 bit fixed point)
- Big issue is rounding/pixel exactness
- May be desirable for edges of ex. rectangular buttons to lie on pixel boundaries
- If no pixel exactness, one edge of button may be soft and other edges hard
- More noticeable on non-high-dpi monitors
- Some drawing could be cached in an image, and it's better for cached images to be drawn pixel-exactly
- Achievable with floats by calling floor() etc at appropriate times
- But one mistake may make subsequent calculations off
- There may also be coordinate-scaling transforms applied
- In some circumstances pixel-exact rendering is infeasible and so rounding is undesirable
- Rendering in 3D space, or under certain scaling transformations
- Rounding can be effectively turned off under fixed point, by choosing a very high virtual DPI
- May be desirable for edges of ex. rectangular buttons to lie on pixel boundaries