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

Home » Public Forums » archive » Trouble with TRIANGULATE/TRIGRID.
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
Trouble with TRIANGULATE/TRIGRID. [message #17278] Sun, 03 October 1999 00:00
Bill Dieckmann is currently offline  Bill Dieckmann
Messages: 2
Registered: April 1997
Junior Member
I'm getting unexpected results with triangulate/trigrid when I use
non-integer output grid spacing. Well, the situation is a bit more
specific than that. Is there anyone comfortable enough with these
functions to look and explain this program:? Please reply via email and
this newsgroup. Thanks.

;
; Exposes trigrid limitation ?
;

PRO trigrid_test

m = 24 ; Results are sensitive to m,n
n = 12

normalized_y = 1 ; Set to 1 for unexpected output
extended_grid = 0 ; Set to 0 for unexpected output

x = findgen(m) # replicate(1,n)
if normalized_y then begin
y = ((findgen(n)/n) ## replicate(1,m)) + x/m/n
endif else begin
y = ((findgen(n)) ## replicate(1,m)) + x/m
endelse

z = fltarr(m,n) + 1.0
S = size(z)

window, /free, xsize=1000, ysize=750
win = !d.window
plot, x, y, psym = 1

triangulate, x, y, tr

for i = 0, n_elements(tr)/3-1 do begin ; Show the triangles.
t = [tr[*,i], tr[0,i]] ; Subscripts of
vertices [0,1,2,0].
plots, x[t], y[t], color=127 ; Connect triangles.
endfor
if normalized_y then begin
grid_spacing = [1.0, 1.0/S[2]]
grid_limits = [0.0, 0.0, s[1]-1,
(s[2]-1+extended_grid)/float(s[2])]
endif else begin
grid_spacing = [1.0, 1.0]
grid_limits = [0.0,0.0, s[1]-1, s[2]-1+extended_grid]
endelse
;
; Show the points at which we get strange output samples.
;
oplot, indgen(s[1]), $

grid_limits[3]-grid_spacing[1]*extended_grid+fltarr(s[1]),ps ym=2

out = fltarr(s[1],s[2]+extended_grid)
out[0,0] =reform(trigrid(x, y, reform(z[*,*]), $
tr, grid_spacing,
grid_limits,xgrid=xg,ygrid=yg), $
s[1], s[2]+extended_grid)
;
; Show the computed grid intersections.
;
xx = xg # replicate(1,S[2])
yy = yg ## replicate(1,S[1])
oplot, [xx],[yy], psym=6
;
; Print interpolated values of the top most row.
;
print, out(*, n-1) ; Expecting replicate(1.0, m), or maybe
[0, replicate(1.0,m-2), 0].
stop
wdelete, win
end
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: shareware photomosaic program
Next Topic: Scatterplot symbols

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

Current Time: Wed Oct 08 15:50:09 PDT 2025

Total time taken to generate the page: 0.00605 seconds