comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Repeats and Triangulation
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Repeats and Triangulation [message #23905] Mon, 26 February 2001 11:09 Go to next message
Ben Tupper is currently offline  Ben Tupper
Messages: 186
Registered: August 1999
Senior Member
Hello all,

Just when I thought I had a handle on making polyline
descriptors (for the IDLgrPolyLine object) I bumped into
something tricky and over my head.

The short routine below will triangulate a small set of
points and then display the Delaunay triangulation
graphically (a direct graphics plot and an xObjView display
of an IDLgrPolyline.) The routine can be called with the
keepReps keyword set which will introduce two extra points
in the data set (each of which repeats an exsiting point.)
Call the routine without the keyword to see how it is
supposed to behave. Then try it with the keepReps keyword
set... and it will fall apart. The value of REPEATS is
printed each time it is called.

The REPEATS keyword to TRIANGULATION returns a 2,n element
array of pairs indices of repeated values. If no values are
repeated then REPEATS = [-1,-1]. My question is 'How do I
pull out the repeated values efficiently?'

Thanks,

Ben

;--------START
PRO Test, keepReps = keepReps

;make x and y
if keyword_set(keepReps) then begin
x = [2,5,2,2,2,4,9]
y = [1,3,5,5,5,5,8]
endif else begin
x = [2,5,2,4,9]
y = [1,3,5,5,8]
endelse
;make a z value
z = (x-y)^2

; triangulate
triangulate, x, y, tr, b, connectivity = conn, repeats = rep



;show the results as a bird's eye view
;as shown in online help
plot, x,y,psym = 6
; Show the triangles:
for i=0, n_elements(tr)/3-1 do begin
t = [tr[*,i], tr[0,i]]
plots, x[t], y[t] , linestyle = 2
endfor

;make the polygon descriptor (see IDLgrPolyLine)
List = Conn[Conn[0]:Conn[1]-1L]
Ptr = Ptr_NEW([N_elements(List),List])
For i = 1, n_elements(X) -1 DO Begin
List = Conn[conn[i]:Conn[i+1]-1]
*Ptr = [*Ptr, n_elements(List), List]
EndFor

Poly = *Ptr & Ptr_Free,Ptr

poly1 = obj_new('idlgrpolyline', x,y,z, polylines = poly)

xobjview, poly1,/modal

if obj_valid(poly1) then obj_destroy, poly1
End
;--------FINISH
--
Ben Tupper
248 Lower Round Pond Road
POB 106
Bristol, ME 04539

Tel: (207) 563-1048
Email: PemaquidRiver@tidewater.net
Re: Repeats and Triangulation [message #23957 is a reply to message #23905] Tue, 27 February 2001 16:31 Go to previous message
Ben Tupper is currently offline  Ben Tupper
Messages: 186
Registered: August 1999
Senior Member
Hi,

I have tinkered with TRIGRID operating on XYZ data sets where there are a few
repeated values of x and y with differing z values.

It looks like TRIGRID ignores repeated values... taking the value of the first z
value only.

Ben

Craig Markwardt wrote:

> Ben Tupper <pemaquidriver@tidewater.net> writes:
>
>> Thanks Craig,
>>
>> I think I'll pursue you final suggestion. The tricky part there is that it is
>> possible to have indices repeated not only within column 1 but also apprearing
>> in column 2.
>>
>> Ben
>
> Yeah, but I think I handled that case. For example if REP contains
> the following entries:
>
> [2, 3]
> [3, 4]
>
> Then it is clear that entries 2, 3, and 4 are all identical poins. We
> want to keep one point at least. Thus, I used the DELMASK to delete
> the points indexed by the second column, REP(1,*). Deleting 3 and 4
> leaves only 2.
>
> By the way, I wanted to emphasize that the snippet of code I posted
> worked exactly as you wanted. You don't need to go beyond that if you
> don't want.
>
> Craig
>
> --
> ------------------------------------------------------------ --------------
> Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
> Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
> ------------------------------------------------------------ --------------

--
Ben Tupper
248 Lower Round Pond Road
POB 106
Bristol, ME 04539

Tel: (207) 563-1048
Email: PemaquidRiver@tidewater.net
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Change default value of system variable?
Next Topic: IDLgrLegend geometry

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:13:27 PDT 2025

Total time taken to generate the page: 0.00615 seconds