| 1 | #pragma once |
| 2 | |
| 3 | #include <math/seadVector.h> |
| 4 | |
| 5 | namespace al { |
| 6 | |
| 7 | class ParabolicPath { |
| 8 | public: |
| 9 | ParabolicPath(); |
| 10 | |
| 11 | void initFromUpVector(const sead::Vector3f& start, const sead::Vector3f& end, |
| 12 | const sead::Vector3f& up); |
| 13 | void initFromUpVector(const sead::Vector3f& start, const sead::Vector3f& end, |
| 14 | const sead::Vector3f& up, f32 maxHeight); |
| 15 | void initFromMaxHeight(const sead::Vector3f& start, const sead::Vector3f& end, |
| 16 | const sead::Vector3f& projectedEnd); |
| 17 | void initFromUpVectorAddHeight(const sead::Vector3f& start, const sead::Vector3f& end, |
| 18 | const sead::Vector3f& up, f32 height); |
| 19 | |
| 20 | f32 getLength(f32 start, f32 end, s32 iterations) const; |
| 21 | f32 getTotalLength(s32 iterations) const; |
| 22 | |
| 23 | void calcPositionHV(sead::Vector3f* pos, f32 h, f32 v) const; |
| 24 | void calcPosition(sead::Vector3f* pos, f32 prog) const; |
| 25 | void calcPositionEaseOutH(sead::Vector3f* pos, f32 prog) const; |
| 26 | void calcDirection(sead::Vector3f* dir, f32 prog, f32 stepSize) const; |
| 27 | f32 calcPathSpeedFromGravityAccel(f32 frames) const; |
| 28 | f32 calcPathSpeedFromAverageSpeed(f32 frames) const; |
| 29 | f32 calcPathSpeedFromHorizontalSpeed(f32 frames) const; |
| 30 | s32 calcPathTimeFromGravityAccel(f32 frames) const; |
| 31 | s32 calcPathTimeFromAverageSpeed(f32 frames) const; |
| 32 | s32 calcPathTimeFromHorizontalSpeed(f32 frames) const; |
| 33 | |
| 34 | const sead::Vector3f& getStart() const { return mStart; } |
| 35 | |
| 36 | private: |
| 37 | sead::Vector3f mStart = {0.0f, 0.0f, 0.0f}; |
| 38 | sead::Vector3f mUp = {0.0f, 1.0f, 0.0f}; |
| 39 | sead::Vector3f mHorizontalDirection = {0.0f, 0.0f, 1.0f}; |
| 40 | f32 mGravity = 0.0f; |
| 41 | f32 mInitialVelY = 0.0f; |
| 42 | f32 mHorizontalDistance = 0.0f; |
| 43 | }; |
| 44 | |
| 45 | } // namespace al |
| 46 | |