Jump to content

Help with 3D terrain model DTM.


Recommended Posts

Costinbos77

I succeeded one to write a lisp routine to build 3D terrain model (DTM = digital terrain model) using autocad 3DFACE based on a text file with coordinates: point number, x, y, z.

This issue concerns me greatly.

 

What sorting algorithm is necessary to point?

 

Any ideas?

 

Costin

TIN Model.dwg

Edited by Costinbos77
add attachment
Link to post
Share on other sites
  • 4 weeks later...
  • Replies 28
  • Created
  • Last Reply

Top Posters In This Topic

  • Costinbos77

    14

  • irneb

    4

  • ymg3

    4

  • Organic

    2

Top Posters In This Topic

Costinbos77

Thanks for your answers.

BIGAL

You can send a link or something starting (beginning)?

 

Organic

I did not invent the wheel, I want to make an app that can calculate and draw contour lines, calculation of volumes and sections in the 3D model.

I want this application to be independent of AutoCAD ( Not everyone uses AutoCAD Civil 3D or AutoCAD Land ) .

 

On the other side it is a challenge .

Edited by Costinbos77
Link to post
Share on other sites

It is a bit complex, and what's meant by re-inventing the wheel is you'll need to redo something very complex indeed. If you can't get Land/C3d, can you use Revit - that also has a terrain from xyz data.

 

If you really "have" to, the principle BigAl's referring to is to find the centroid of the XY values of all points. This is similar to finding the avg of a list of numbers - just done twice (once for x and once for y); though it's possible to write it a bit more efficiently by iterating only once.

 

Now that you have the centre in the XY plane, you spiral around using the angle / polar functions. Finding the closest points to the centre using distance. etc etc etc

 

Another alrernative would be to take any one point, then find the closest 2 points to it in XY plane. And continue until you've paired each point with 2 others. This is the brute force method and will probably take a very long time.

 

And those 2 methods are not necessarily the most efficient. See why it's considered very complex? Why you were asked about invention and wheels?

Link to post
Share on other sites

Here's an example extracting the triangles from a list of points. It's uses the brute force method and is extremely inefficient - even more so since it needs to check for duplicates as well - and does so by brute force yet again.

(defun Make2d (pt) (mapcar '* pt '(1.0 1.0 0.0)))

(defun PtClosestXY  (pt points / found dist d)
 (setq found (car points)
       dist  (distance (Make2d pt) (Make2d found)))
 (foreach pt1  (cdr points)
   (if (< (setq d (distance (Make2d pt) (Make2d pt1))) dist)
     (setq found pt1
           dist  d)))
 found)

(defun PointList->Mesh  (points / meshes points2 pt1 pt2)
 (foreach pt  points
   (setq pt1     (PtClosestXY pt (setq points2 (vl-remove pt points)))
         pt2     (PtClosestXY pt (vl-remove pt1 points2))
         points2 (list pt pt1 pt2))
   (if
     (not
       (vl-some '(lambda (3pts) (apply 'and (mapcar '(lambda (val) (member val points2)) 3pts)))
                meshes))
      (setq meshes (cons points2 meshes))))
 meshes)

Edit: And this is only doing straight line - no smoothing between measured points as most other terrain mapping programs do.

Link to post
Share on other sites

No took about 5 minutes to write that. Just doing it to see if it would work as I theorized. Anyhow, I'd not use that in a production environment - unless I'm willing to let the code run overnight.

Link to post
Share on other sites
Costinbos77

I understand that there is a way to sort the data (points with x, y, z) to start from one side and reach the end. Another method would be to process all points on the edge and moving spiral to reach and finish in the center.

 

By what method can join multiple 3Dface in a single object (as in the example)?

Link to post
Share on other sites
Costinbos77

Good point ReMark. As always well informed and to the point.

 

I looked at the application, makes enough.

 

You ruined all momentum.

Edited by Costinbos77
Link to post
Share on other sites

So does CadTools sort out your predicament? I thought you wanted something "independent of AutoCAD" as per your post #5? I gave the lisp to show the principle, which you can then implement somewhere else - e.g. VB in order to make an EXE file which works outside of ACad.

Link to post
Share on other sites

I ruined your momentum? I don't think so. I only showed you that all things are possible if you put your mind to it. Take it as a challenge to not only create your own program but to improve on what's already available.

Link to post
Share on other sites
Costinbos77

Precisely so I'm trying to find out with this Thread, the math or if someone started to work and the problems has encountered.

 

The first problem encountered is how to sort the points, sort them so as to have the lowest E and also the smallest N,

to search step by step to form 3DFACE or 3DPline .

Link to post
Share on other sites
  • 1 year later...

Friends.............pls help me. I used to create surface (terrain) in Land Desktop 2009 for contour and spot levels from existing text file data (PENZD format). Now my laptop has been upgraded with 64bits OS Win 7 where the land desktop 2009 can't be loaded. I have auto cad civil 3d 2012 in my laptop but I can't create the terrain from the said text file data. It will become great hazards to me. I am a Surveyor and my work related with surface, cotour, spot level, cross section, long section, volume etc. I have also read so many suggestions from various site but still i can't understand properly. It is requested to all of you if any forum member belongs to Kolkata, India; pls help me to learn those things. pls....pls....

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...