Surface from X/Y/Z Points.

Blitz3D Forums/Blitz3D Programming/Surface from X/Y/Z Points.

Tab(Posted 2007) [#1]
I need create a surface ( Terrain ) from a list of coordinates in XYZ format.

The list is something like...

PointNum, Description, X, Z, Y
4,TEST,22.950,-16.758,199.995
5,TEST,-75.044,19.454,199.461
6,TEST,51.060,-21.960,200.930
7,TEST,-88.051,44.489,199.229
...


Read the file and put the points in the 3D is easy, but... i dont have experience in surfaces... i try to make it... but, i can't.

If anyone have a idea or example to make it, please help me. =)


Hujiklo(Posted 2007) [#2]
Is this your own terrain mesh? Or are you using Blitz's terrain commands? If so why don't you make a gradient map from your surface info instead? 0-256 colour grey scale. Save it out and then then just load it in using the load terrain command - means you don't have to mess about with surfaces.


Tab(Posted 2007) [#3]
eee... yep, is an option, but... i need generate the heightmap first.

And i not sure wich option is more complex... create a surface or generate a heighmap from the XYZ file.


Stevie G(Posted 2007) [#4]
Suggest making another heightmap.

A heightmap assumes uniform spacing in the x/z axis which is why you only need to store the y component.

The data above is all over the place with strange coords ( 199.995 ?? ). It's definately not uniform in terms of x/z coords so it would probably be difficult to convert to an image.

How much more data do you have? I could try something for you. I'm off work atm - just had a toe nail removed ( ouch ) so have time on my hands.

Stevie


Hujiklo(Posted 2007) [#5]
Where are you getting all this terrain data from anyway? It sounds a bit long-winded when you could just airbrush some heightmaps in a paint program instead.


Tab(Posted 2007) [#6]
@Stevie
The file contain around 487 points...
If you need see the file, Here is http://www.badmouse.cl/download/xyz.txt

I update the first post, the format of the file is X,Z,Y... sorry for the mistake.

Thx for your time.


Stevie G(Posted 2007) [#7]
Ok, leave it with me.


Stevie G(Posted 2007) [#8]
See attached plot of X & Z coords.



They are too random so there is no chance of making a mesh out of them or a heightmap. The Y coord doesn't fluctuate much anyway, it's between 180-200. Do you really need to use this naff data? What are you trying to do? Suggest you start from scratch using a heightmap as Hujiklo mentioned.

Stevie


Tab(Posted 2007) [#9]
The data is from a topographic intrument.
In the image, you can see the area of a real terrain.

I try to make in a easy way the process of create a preview in 3D, without the complex process in the case of others software like "Autocad Survey".


Stevie G(Posted 2007) [#10]
Hmm, you'd need to use some form of tesselation routine which I'm guessing is the reason some most would use "AutoCad Survey".

It's extremely complicated to build a mesh from a bunch of random points but there is alot of stuff on google e.g.

http://www.cs.berkeley.edu/~ug/slide/docs/slide/spec/spec_frame_meshnode.shtml


MadJack(Posted 2007) [#11]
I had this exact same issue the other day in writing code to produce a cartogram (in this case a mesh from points distorted by travel times).

I didn't get very far - in the end went with manually selecting the points (with which to create the polys) and saving the resultant mesh plus point selection order to file.

However I didn't have as many points to tesselate as you do...


Tab(Posted 2007) [#12]
@Stevie
Anyway, thx for your time Stevie.
I have some ideas now, maybe i can do it...

@MadJack
Please, you can post some example from your code?.


MadJack(Posted 2007) [#13]
Tab

Sorry - not for a couple of days - it's the weekend here in NZ and the code's on my work PC.

But it wasn't that extensive - basically pick three points, create a polygon - the code's all available from the archives here on this site.