Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411430 Posts in 69363 Topics- by 58416 Members - Latest Member: JamesAGreen

April 19, 2024, 10:28:14 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Convex Hull of points on sphere [ue4, c++]
Pages: [1]
Print
Author Topic: Convex Hull of points on sphere [ue4, c++]  (Read 986 times)
photex
Level 0
*


kaboom


View Profile WWW
« on: May 12, 2017, 07:04:46 AM »

Howdy!

I'm getting tired of beating my head against the wall here and would love some help or at least some advice.

I'd like to generate a world map where you have a set of points on a sphere that you can travel to. So naturally I need a graph based on some kind of reasonable triangulation of these points. In 2D I've used the bowyer-watson algorithm to get the delaunay triangulation. For 3d I figured I'd try to implement some convex hull algorithm.

I found this blog post which gives a decent overview of the quickhull algorithm (http://thomasdiewald.com/blog/?p=1888). So I'm trying it out.

Along the way I've started implementing a HalfEdgeMesh api in Unreal because I don't know a better way to make a mesh with proper connectivity information. I'm "reasonably" certain my principle mesh setup is working... kinda reasonably certain.

so does anyone have some advice? I can post some code if you like. I'm not sure if I'm going overkill with the halfedge mesh implementation and there isn't just a way to get a decent convex hull without it.

Here are my structs for the halfedge stuff:

Code:
using FPointRef = TWeakPtr<FVector>;
using FEdgeRef = TWeakPtr<FEdge>;
using FVertexRef = TWeakPtr<FVertex>;
using FFaceRef = TWeakPtr<FFace>;

using FPointPtr = TSharedPtr<FVector>;
using FVertexPtr = TSharedPtr<FVertex>;
using FEdgePtr = TSharedPtr<FEdge>;
using FFacePtr = TSharedPtr<FFace>;

struct FVertex
{
FPointPtr Position;
FEdgeRef Edge;

explicit FVertex(FPointPtr Position_);
};

struct FFace
{
FEdgeRef Edge;
FVector Normal;

explicit FFace(FEdgePtr);

FVector CalculateNormal();

FEdgeIterator begin();
FEdgeIterator end();

FAdjacentFaceIterator AdjacentFaces();
};

struct FEdge
{
FEdgePtr Next;
FEdgePtr Adjacent;
FVertexPtr Vertex;
FFaceRef Face;

explicit FEdge(FVertexPtr& Vertex_);

bool IsBoundary() const;
};
Logged
qMopey
Level 6
*


View Profile WWW
« Reply #1 on: May 12, 2017, 09:23:02 AM »

Dirk Gregorius GDC - Quickhull. Look it up.
Logged
photex
Level 0
*


kaboom


View Profile WWW
« Reply #2 on: May 13, 2017, 12:16:23 PM »

True dat!

This is so great. Explained a lot of my damned issues already *aaaand* I can stop using the damned smart pointers. My first implementation was backed by arrays, but I was getting into trouble with indices anytime the array needed to be reallocated or I removed things.
Logged
qMopey
Level 6
*


View Profile WWW
« Reply #3 on: May 13, 2017, 09:43:00 PM »

Feel free to ask questions here if you have any!
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic