mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 19:17:44 +00:00
AK+Everywhere: Add sincos and use it in some places
Calculating sin and cos at once is quite a bit cheaper than calculating them individually. x87 has even a dedicated instruction for it: `fsincos`.
This commit is contained in:
parent
47fe911196
commit
cd21e03225
6 changed files with 30 additions and 10 deletions
|
@ -70,8 +70,8 @@ constexpr static Matrix4x4<T> scale_matrix(const Vector3<T>& s)
|
|||
template<typename T>
|
||||
constexpr static Matrix4x4<T> rotation_matrix(const Vector3<T>& axis, T angle)
|
||||
{
|
||||
T c = AK::cos(angle);
|
||||
T s = AK::sin(angle);
|
||||
T c, s;
|
||||
AK::sincos(angle, s, c);
|
||||
T t = 1 - c;
|
||||
T x = axis.x();
|
||||
T y = axis.y();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue