### Author Topic: Triangulation (re-visited)  (Read 310388 times)

0 Members and 1 Guest are viewing this topic.

#### ymg

• Guest
##### Re: Triangulation (re-visited)
« Reply #150 on: March 13, 2014, 01:19:00 AM »
chlh_jd,

Thanks, for the sort idea.

On a 2000 triangles list I do gain about 0.25 seconds (Non-Compiled)

Quote
In my head , Longer code still requires a larger computer memory

Very right, I am trading space for speed.

ymg

#### ymg

• Guest
##### Re: Triangulation (re-visited)
« Reply #151 on: March 14, 2014, 04:49:59 AM »
Yet another bug in the contour generation routine removed.

Also implemented some of chlh_jd's suggestions.

Hopefully everything's OK now, so I can start work on
Depression Contours.

ymg

#### chlh_jd

• Guest
##### Re: Triangulation (re-visited)
« Reply #152 on: March 15, 2014, 02:02:36 PM »
Ymg,
The new version test OK in contour routine . Thank you very much .
I'm really looking forward to deal with discontinuous triangulation which just you said no support .

#### motee-z

• Newt
• Posts: 40
##### Re: Triangulation (re-visited)
« Reply #153 on: March 15, 2014, 06:21:05 PM »
excellent job for countor lines but it will be perfect if you take into consider break lines.
(break lines is a 3d polyline so 3d face not intersect with it because it represent a cliff in land)
thanks

#### ymg

• Guest
##### Re: Triangulation (re-visited)
« Reply #154 on: March 16, 2014, 12:55:41 AM »
motee-z,

I know what is a breakline.

I have done some preliminary work on it.

But we also have to take into considerations boundaries of the tin
plus holes into the triangulation.

Conceptually all we need to do is to erase all the triangles intercepted
by the breaklines, then re-triangulate the hole created.

My thinking would be a CCW polyline would represent a boundary where
the tin is inside. Clockwise poly would be a hole.

But there is a lot of catch in there.

ymg

« Last Edit: March 16, 2014, 01:01:34 AM by ymg »

#### teknomatika

• Guest
##### Re: Triangulation (re-visited)
« Reply #155 on: March 31, 2014, 10:32:12 AM »
ymg,
is a fantastic tool.
However, PROF function is not working. Always returns the same error.

Quote
Command: prof

Select a Linear Entity:

Error: bad argument type: fixnump: nil

I am using a lwpolyline as a linear entity. Not sure what am I doing wrong.
Attached the sample file

• Bull Frog
• Posts: 342
##### Re: Triangulation (re-visited)
« Reply #156 on: March 31, 2014, 11:20:46 AM »
ymg,

brilliant work, amazing.

P

#### ymg

• Guest
##### Re: Triangulation (re-visited)
« Reply #157 on: March 31, 2014, 11:25:31 AM »
teknomatica,

Prof is not completed as explained in a previous post.

I am currently working on it.

Try it with the attached, you should be able to get the profile
from a tin at least.

There is still quite a bit of work to be done on the UI.

Also, I am not satisfied with the current selection method
the getneighbour routine is way too slow.

So far, I have come up with a new method.  Now I need
to complete the UI for every case. (Tin, Contour, 3DFACE and 3DPOLY)

Also working on the surface selection interface.

ymg
« Last Edit: March 31, 2014, 11:36:39 AM by ymg »

#### ymg

• Guest
##### Re: Triangulation (re-visited)
« Reply #158 on: March 31, 2014, 11:32:15 AM »

Thank you , for the encouragement.

ymg

#### chlh_jd

• Guest
##### Re: Triangulation (re-visited)
« Reply #159 on: April 10, 2014, 05:56:29 AM »
hi, ymg
The contour routine still get error  in the case of the dwg I post ,when intv = 0.1 majintv=0.5 .
Even the Tin routine don't get right result in this drawing .

#### ymg

• Guest
##### Re: Triangulation (re-visited)
« Reply #160 on: April 10, 2014, 01:25:30 PM »
chlh_jd,

In your drawing you had at least 20 illegal 3dfaces shaped as a line.

Don 't know how you generated them.  Once these are removed everything works.

You also claim that the Tin did not work.  I could not check as you did not provide
the points.

ymg

#### ymg

• Guest
##### Re: Triangulation (re-visited)
« Reply #161 on: April 10, 2014, 05:46:48 PM »

And you are bound to have troubles when the points are nearly on top
of each other.

Same problem with your circle, reduce the density of the points.

ymg

#### chlh_jd

• Guest
##### Re: Triangulation (re-visited)
« Reply #162 on: April 11, 2014, 07:50:47 AM »
Ymg,
I'm sorry for not provide the points .
Thank you for check this case .
In realistic terrain , there are some steep and cliffs , I wish the contour routine can support this case .
You have also mentioned, can not handle discontinuous 3DFACE , I wish it can .

Therefore, can we change an idea to deal with the  contour problem; For example, the first generation of each line segment at every elevations, and then combine them, and then fillet them .

#### ymg

• Guest
##### Re: Triangulation (re-visited)
« Reply #163 on: April 11, 2014, 09:27:15 AM »
chlh_jd,

I thik I found the culprit.  There were some duplicates (10 of them to be exact)
points that did not get filtered out.

modify this line at beginning of program:

Code: [Select]
`(setq pl (vl-sort pl (function (lambda (a b) (< (cadr a) (cadr b))))) ;; Sort on Y Coordinate                     pl (vl-sort pl (function (lambda (a b) (< (car  a) (car  b))))) ;; Sort on X Coordinate                     pl (vl-remove nil                                               ;; Remove Duplicate Points                        (mapcar '(lambda (a b) (if (not (equal (cdr (reverse a)) (cdr (reverse b)) 1e-03)) a))                            pl (append (cdr pl) (list (car pl)))                                                    )                   )   )`
Adding a fuzz factor on the comparison in the vl-remove line.

Seems to cure it.

ymg
« Last Edit: April 11, 2014, 09:32:48 AM by ymg »

#### ymg

• Guest
##### Re: Triangulation (re-visited)
« Reply #164 on: April 11, 2014, 09:51:01 AM »
chlh_jd,

contour ca run on disjointed set of 3dfaces.

In the picture below both sets were contoured
in one go.