summaryrefslogtreecommitdiff
path: root/lib/maths.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-04-04 20:06:36 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2024-04-04 20:06:36 +0100
commit30b027f84772d4b1d18eebd03b83ce3a5966d5fe (patch)
treebf1f424ee3c92516d652934cf502ee06f60c57e5 /lib/maths.cpp
parentSimplify vector addition/subtraction with differnt types (diff)
parentRemove wireframe mode from test renders (diff)
downloadilt-30b027f84772d4b1d18eebd03b83ce3a5966d5fe.tar.bz2
ilt-30b027f84772d4b1d18eebd03b83ce3a5966d5fe.tar.xz
ilt-30b027f84772d4b1d18eebd03b83ce3a5966d5fe.zip
Merge remote-tracking branch 'origin/deform-terrain'
Two related issues remain: * Terrain self shadowing is common and handled poorly * Odd, but mathematically correct patterns/stripes in feature boundaries Neither of these relate directly to deformation.
Diffstat (limited to 'lib/maths.cpp')
-rw-r--r--lib/maths.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/maths.cpp b/lib/maths.cpp
index 68662fc..51e27fe 100644
--- a/lib/maths.cpp
+++ b/lib/maths.cpp
@@ -4,6 +4,11 @@
#include <glm/gtx/rotate_vector.hpp>
#include <glm/gtx/transform.hpp>
+Arc::Arc(const RelativePosition2D & dir0, const RelativePosition2D & dir1) :
+ Arc {vector_yaw(dir0), vector_yaw(dir1)} { }
+
+Arc::Arc(const Angle anga, const Angle angb) : pair {anga, (angb < anga) ? angb + two_pi : angb} { }
+
glm::mat4
flat_orientation(const Direction3D & diff)
{
@@ -76,7 +81,7 @@ rotate_yp(Rotation2D a)
}
float
-vector_yaw(const Direction3D & diff)
+vector_yaw(const Direction2D & diff)
{
return std::atan2(diff.x, diff.y);
}