View Full Version : Measuring distance on terrain / landscape

06 June 2007, 09:50 PM
I'am working on a realtime visualization project. I have this landscape / terrain mesh created in 3ds max and I want to implement a measuring feature in the application. That is, when the user klick point A and point B the application will calculate the distance between the two choosen points. The actual distances that the user might want to measure range from 1 - 1000 m, with an accuracy of about 1 m.

I have tought about building a database with [vertex pair, distance], and then do a lookup in this when the user access the feature. But I'am afraid that this database will be too big. (If 3ds max don't have a automatic tool to build such a database then it's certainly out of the question since building so many value pairs by hand is unpractical.) So I wondered if someone has some general thoughts about how to implement a feature like this? Maybe there is a way to convert screen distance into realworld distance? Or maybe there is another "trick of the trade" that I am not aware of?

PS! If this is the wrong forum for this kind of question, please let me know.


Ian Jones
06 June 2007, 12:21 AM
As the crow flies? or along the course of the terrain up and down hills?

Either way you'll have to do some maths. Geometry and Trig.

Ian Jones
06 June 2007, 12:23 AM
I forgot to ask if you were using an existing 3d engine? because it is likely this kind of functionality is built in or at least documented somewhere.

06 June 2007, 07:30 AM
Up and down the hills is the best, but i can settle with the crow version :) I'am working with the Lingo scripting language, so I do not know if there is any prebuilt tools for this. But i will surely read my docs and books once more too se if it exists :)

It is something like the "Tape Helper" in 3ds max I am looking for.

Ian Jones
06 June 2007, 12:09 PM
ahh yes, lingo... :)

Regardless of the language these are pretty much standard trigonometry problems. Check out trigonomtery tutes on the net. I'm pretty bad at maths, so I always use these as a nudge in the right direction.

06 June 2007, 12:50 PM
A series of ray-mesh intersections spanning the horizontal distance between the two points of interest whilst summing the distances between the intersection points. That would be a quick and dirty solution.

CGTalk Moderation
06 June 2007, 12:50 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.