|
1 | | -// Copyright 2015-2024 the openage authors. See copying.md for legal info. |
| 1 | +// Copyright 2015-2025 the openage authors. See copying.md for legal info. |
2 | 2 |
|
3 | 3 | #pragma once |
4 | 4 |
|
@@ -451,6 +451,18 @@ class FixedPoint { |
451 | 451 | constexpr double atan2(const FixedPoint &n) { |
452 | 452 | return std::atan2(this->to_double(), n.to_double()); |
453 | 453 | } |
| 454 | + |
| 455 | + constexpr double sin() { |
| 456 | + return std::sin(this->to_double()); |
| 457 | + } |
| 458 | + |
| 459 | + constexpr double cos() { |
| 460 | + return std::cos(this->to_double()); |
| 461 | + } |
| 462 | + |
| 463 | + constexpr double tan() { |
| 464 | + return std::tan(this->to_double()); |
| 465 | + } |
454 | 466 | }; |
455 | 467 |
|
456 | 468 |
|
@@ -567,6 +579,21 @@ constexpr double atan2(openage::util::FixedPoint<I, F> x, openage::util::FixedPo |
567 | 579 | return x.atan2(y); |
568 | 580 | } |
569 | 581 |
|
| 582 | +template <typename I, unsigned F> |
| 583 | +constexpr double sin(openage::util::FixedPoint<I, F> n) { |
| 584 | + return n.sin(); |
| 585 | +} |
| 586 | + |
| 587 | +template <typename I, unsigned F> |
| 588 | +constexpr double cos(openage::util::FixedPoint<I, F> n) { |
| 589 | + return n.cos(); |
| 590 | +} |
| 591 | + |
| 592 | +template <typename I, unsigned F> |
| 593 | +constexpr double tan(openage::util::FixedPoint<I, F> n) { |
| 594 | + return n.tan(); |
| 595 | +} |
| 596 | + |
570 | 597 | template <typename I, unsigned F> |
571 | 598 | constexpr openage::util::FixedPoint<I, F> min(openage::util::FixedPoint<I, F> x, openage::util::FixedPoint<I, F> y) { |
572 | 599 | return openage::util::FixedPoint<I, F>::from_raw_value( |
|
0 commit comments