summaryrefslogtreecommitdiff
path: root/game/geoData.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-02-24 00:27:49 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2024-02-24 00:27:49 +0000
commit744e6ad2fb88671800e39db33d08b2cd451c8338 (patch)
tree563da22ef0240131fe0540e9ccc3fed5d10fc9a2 /game/geoData.h
parentSimplify vector addition/subtraction with differnt types (diff)
parentFirst cut of terrain deformation (diff)
downloadilt-744e6ad2fb88671800e39db33d08b2cd451c8338.tar.bz2
ilt-744e6ad2fb88671800e39db33d08b2cd451c8338.tar.xz
ilt-744e6ad2fb88671800e39db33d08b2cd451c8338.zip
Psycho-rebased branch deform-terrain on top of main
Diffstat (limited to 'game/geoData.h')
-rw-r--r--game/geoData.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/game/geoData.h b/game/geoData.h
index 15143e8..5671954 100644
--- a/game/geoData.h
+++ b/game/geoData.h
@@ -65,7 +65,7 @@ public:
operator*(BaryPosition bari) const
{
const auto & t {*this};
- return t[0] + (RelativePosition<Dim>(t[1] - t[0]) * bari.x) + (RelativePosition<Dim>(t[2] - t[1]) * bari.y);
+ return t[0] + (RelativePosition<Dim>(t[1] - t[0]) * bari.x) + (RelativePosition<Dim>(t[2] - t[0]) * bari.y);
}
};
@@ -73,8 +73,10 @@ public:
[[nodiscard]] FaceHandle findPoint(GlobalPosition2D, FaceHandle start) const;
[[nodiscard]] GlobalPosition3D positionAt(const PointFace &) const;
- [[nodiscard]] std::optional<GlobalPosition3D> intersectRay(const Ray<GlobalPosition3D> &) const;
- [[nodiscard]] std::optional<GlobalPosition3D> intersectRay(const Ray<GlobalPosition3D> &, FaceHandle start) const;
+ using IntersectionLocation = std::pair<GlobalPosition3D, FaceHandle>;
+ using IntersectionResult = std::optional<IntersectionLocation>;
+ [[nodiscard]] IntersectionResult intersectRay(const Ray<GlobalPosition3D> &) const;
+ [[nodiscard]] IntersectionResult intersectRay(const Ray<GlobalPosition3D> &, FaceHandle start) const;
void walk(const PointFace & from, const GlobalPosition2D to, const std::function<void(FaceHandle)> & op) const;
void walkUntil(const PointFace & from, const GlobalPosition2D to, const std::function<bool(FaceHandle)> & op) const;
@@ -86,6 +88,8 @@ public:
[[nodiscard]] HalfedgeHandle findEntry(const GlobalPosition2D from, const GlobalPosition2D to) const;
+ void setHeights(const std::span<const GlobalPosition3D> triangleStrip);
+
[[nodiscard]] auto
getExtents() const
{
@@ -102,6 +106,8 @@ protected:
[[nodiscard]] static bool triangleContainsPoint(const GlobalPosition2D, const Triangle<2> &);
[[nodiscard]] bool triangleContainsPoint(const GlobalPosition2D, FaceHandle) const;
+ [[nodiscard]] static bool triangleOverlapsTriangle(const Triangle<2> &, const Triangle<2> &);
+ [[nodiscard]] static bool triangleContainsTriangle(const Triangle<2> &, const Triangle<2> &);
[[nodiscard]] HalfedgeHandle findBoundaryStart() const;
void update_vertex_normals_only();