Click here to Skip to main content
15,887,434 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I need to create a triangulated surface from a list of points and calculate the elevation or z at any specific location on the surface. How would I do that in C#?

What I have tried:

I have tried weighted average of 3 closest points as I move over the surface. doesn't work because the calculation needs to be from the face or plane created by 3 points as you move from one face to the next.
Posted
Comments
[no name] 21-Nov-23 13:04pm    
Check this out: https://math.stackexchange.com/questions/2358354/how-do-you-find-the-midpoint-of-several-3d-points
Amarnath S 22-Nov-23 4:20am    
Perhaps you need to map the cursor location to the exact triangle within which this cursor lies (this is indeed a complicated mapping, based on whether your projection is isometric or perspective), and then get the height by some interpolation between the z-coordinates of the three vertices of this triangle.
geohofer 23-Nov-23 9:08am    
Thats kind of what I had in mind though I don't think iso or perspective would matter as much. Its mainly to get the difference in elevation from actual elevation to the designed surface elevation.
Simply put (Does this spot were i'm at right now need to be cut down or filled in to get to the designed surface profile? What is viewed on the screen does not need to be precise only a representation.

1 solution

Start with a Delaunay triangulation[^].
Then it's straightforward math to interpolate altitude between the 3 points that define the face you're on.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900