contour plot at max z of surface in obj. graphics [message #18675] |
Thu, 20 January 2000 00:00 |
T Bowers
Messages: 56 Registered: May 1998
|
Member |
|
|
I'm adding functionality to D Fanning's xsurface program. What
I'm doing is adding the ability to import a different data set
and vis. it as a contour positioned at the max z axis value (i.e.,
on "top" of the surface object, a la Fanning's book p. 100 or the
show3 procedure, both in direct graphics). Since my vis. space is
normalized with his Normalize procedure, I thought it would be as
simple as setting geomZ=0.5, the "top" of z, and maybe the setting
planar=1. Doesn't work. 1 data set ranges ~ -300 - +200 in z value,
while the other ranges ~ 0 - 5. Screwing around with the geomZ value
doesn't give me a good indication of it's behavior because it the
contour seems to move up and down in different ways depending on
which data I choose as the surface and which I choose to overlay
as the contour. Can anybody enlighten me on this?
Also...
Does anybody have a quickie that'll convert data in xyz triplets
to "flat" format? e.g.
x y z to 89.5 89.6 89.7 89.8
89.7 20.1 00.1 20.1 00.1
89.6 20.3 00.2 20.2 00.3
89.8 20.2 00.3 20.3 00.4 00.2
89.5 20.3 00.4
with x running across the top and y down the first column, blanks
are NaN's or whatever. Like it's been interpolated, but without
the interpolation. ;)
I've come close, but no cuban. Here's what I was playing around
with last night. I gave up cause I just don't see it.
Thanks alot all
;///////////////
function colsToFlat, dataCols
xData = dataCols[0,*]
yData = dataCols[1,*]
zData = dataCols[2,*]
sortedXData = xData[sort(xData)]
sortedYData = yData[sort(yData)]
sortedUniqXData = xData[uniq(xData,sort(xData))]
sortedUniqYData = yData[uniq(yData,sort(yData))]
xSortOrder = sort(xData)
ySortOrder = sort(yData)
numDataPtsInX = n_elements(uniq(xData,sort(xData)))
numDataPtsInY = n_elements(uniq(yData,sort(yData)))
xFlat = sortedXData ;sortedUniqXData
yFlat = sortedYData ;sortedUniqYData
zFlat = fltarr(n_elements(xFlat), n_elements(yFlat))
zFlat[xSortOrder,ySortOrder] = zData[*]
; +1 in next line to make room for x row and y column. dataFlat[0,0] just
unused
dataFlat = fltarr((n_elements(xFlat)+1), (n_elements(yFlat)+1))
dataFlat[*] = !Values.F_NaN
dataFlat[1:*,0] = xFlat
dataFlat[0,1:*] = yFlat
dataFlat[1:*,1:*] = zFlat
;//Need to remove duplicate x and/or y entries
return, 1
end
;///////////////
|
|
|