summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--game/geoData.cpp8
-rw-r--r--lib/maths.h7
2 files changed, 9 insertions, 6 deletions
diff --git a/game/geoData.cpp b/game/geoData.cpp
index aaa2548..4273be6 100644
--- a/game/geoData.cpp
+++ b/game/geoData.cpp
@@ -417,17 +417,13 @@ GeoData::setHeights(const std::span<const GlobalPosition3D> triangleStrip)
std::vector<Extrusion> extrusionExtents;
std::for_each(boundary.begin(), boundary.end(), [this, &extrusionExtents](const auto boundaryHeh) {
- const auto vectorNormal = []<typename T, glm::qualifier Q>(const glm::vec<2, T, Q> & v) -> glm::vec<2, T, Q> {
- return {-v.y, v.x};
- };
-
const auto boundaryVertex = from_vertex_handle(boundaryHeh);
const auto nextBoundaryVertex = to_vertex_handle(boundaryHeh);
const auto p0 = point(from_vertex_handle(prev_halfedge_handle(boundaryHeh)));
const auto p1 = point(boundaryVertex);
const auto p2 = point(nextBoundaryVertex);
- const auto e0 = glm::normalize(vectorNormal(RelativePosition2D(p1 - p0)));
- const auto e1 = glm::normalize(vectorNormal(RelativePosition2D(p2 - p1)));
+ const auto e0 = glm::normalize(vector_normal(RelativePosition2D(p1 - p0)));
+ const auto e1 = glm::normalize(vector_normal(RelativePosition2D(p2 - p1)));
const auto doExtrusion = [this](VertexHandle & extrusionVertex, Direction2D direction,
GlobalPosition3D boundaryVertex, RelativeDistance vert) {
diff --git a/lib/maths.h b/lib/maths.h
index 656fefd..63b752a 100644
--- a/lib/maths.h
+++ b/lib/maths.h
@@ -98,6 +98,13 @@ glm::mat4 rotate_ypr(Rotation3D);
float vector_yaw(const Direction2D & diff);
float vector_pitch(const Direction3D & diff);
+template<typename T, glm::qualifier Q>
+glm::vec<2, T, Q>
+vector_normal(const glm::vec<2, T, Q> & v)
+{
+ return {-v.y, v.x};
+};
+
float round_frac(const float & v, const float & frac);
template<typename T>