Update
This commit is contained in:
parent
ede02b10de
commit
ab31f1dd64
11 changed files with 1743 additions and 1737 deletions
|
@ -10,7 +10,7 @@ Examples of approximations:
|
|||
- **Engineering approximations** ("guesstimations"): e.g. **sin(x) = x** for "small" values of *x* or **[pi](pi.md) = 3** (integer instead of float).
|
||||
- **[Physics engines](physics_engine.md)**: complex triangle meshes are approximated with simple analytical shapes such as **spheres**, **cuboids** and **capsules** or at least **convex hulls** which are much easier and faster to deal with. They also approximate **relativistic** physics with **Newtonian**.
|
||||
- **Addition/subtraction** (of integers) can sometimes be approximated with logical [OR](or.md)/[AND](and.md) operations, as they behave a bit similarly. This can be used e.g. for brightening/darkening of pixel colors in [332](rgb332.md) or [565](rgb565.md) format -- without the approximation addition of colors in these formats is very expensive (basically requires conversion to RGB, addition, clamping and a conversion back).
|
||||
- **[Square root](sqrt.md)/square** (integer) can be roughly approximated too. E.g. to get a quick "almost square" of a number you can try something like doubling each binary digit and shifting everything right, e.g. `101` -> `11001` -- it's not very accurate but may be good enough e.g. for some graphics effects and may be especially effective as hardware implementation as it works instantly and uses literally no [logic gates](logic_gate.md) (you just reorder bits)! A bit improved version may construct a pair of digits from each digit as logical AND (upper bit) and logical OR (lower bit) of the bit with its lower neighbor (lowest bit may still just be doubled), e.g. `1101` -> `11010111`. Square root can similarly be roughly estimated by reducing each pair of bits with logical OR sown to a single bit (e.g. `101100` -> `110`). { Dunno if this is actually used anywhere, I came up with this once before I fell asleep. ~drummyfish } A famous hack in Quake, called *fast inverse square root*, uses a similar approximation in [floating point](float.md).
|
||||
- **[Square root](sqrt.md)/square** (integer) can be roughly approximated too. E.g. to get a quick "almost square" of a number you can try something like doubling each binary digit and shifting everything right, e.g. `101` -> `11001` -- it's not very accurate but may be [good enough](good_enough.md) e.g. for some graphics effects and may be especially effective as hardware implementation as it works instantly and uses literally no [logic gates](logic_gate.md) (you just reorder bits)! A bit improved version may construct a pair of digits from each digit as logical AND (upper bit) and logical OR (lower bit) of the bit with its lower neighbor (lowest bit may still just be doubled), e.g. `1101` -> `11010111`. Square root can similarly be roughly estimated by reducing each pair of bits with logical OR sown to a single bit (e.g. `101100` -> `110`). { Dunno if this is actually used anywhere, I came up with this once before I fell asleep. ~drummyfish } A famous hack in Quake, called *fast inverse square root*, uses a similar approximation in [floating point](float.md).
|
||||
- **[3D graphics](3d_rendering.md)** is almost completely about approximations, e.g. basically all shapes are approximated with triangle meshes, [screen space](screen_space.md) effects (like [SSAO](ssao.md)) are used to approximate global illumination, reflections etc. Similarly [ray tracing](ray_tracing.md) neglects indirect lighting etcetc.
|
||||
- **[Real numbers](real_number.md)** are practically always approximated with [floating point](floating_point.md) or [fixed point](fixed_point.md) (rational numbers).
|
||||
- **[Numerical methods](numerical.md)** offer generality and typically yield approximate solutions while their precision vs speed can be adjusted via parameters such as number of iterations.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue