triangulate proc [message #21902] |
Wed, 27 September 2000 20:43 |
Sylvain Carette
Messages: 19 Registered: May 2000
|
Junior Member |
|
|
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<tt>Hi</tt>
<br><tt>Still trying to make sense of TRIANGULATE using the "SPHERE=S"
variable</tt>
<br><tt>as a simple example (can all be done from cut & paste to the
command line):</tt>
<br><tt>lon = RANDOMU(seed, 50) * 360. - 180.</tt>
<br><tt>lat = RANDOMU(seed, 50) * 180. - 90.</tt>
<br><tt>z = dblarr(50)</tt>
<br><tt>z[*] = 500</tt>
<br><tt>TRIANGULATE, lon, lat, tri, fvalue=z, sphere=s, /degrees</tt><tt></tt>
<p><tt>Printing help, s , /structure give:</tt><tt></tt>
<p><tt>XYZ FLOAT Array[50, 3]; note
the inconsistency of the vertice format</tt>
<br><tt>IEND LONG Array[50]</tt>
<br><tt>IADJ LONG Array[300]</tt><tt></tt>
<p><tt>Converting back the vertice to xyz form (array[3, 50]) and feeding
to IDLgrPolygon with style=0 (point) show that the vertice effectively
are plotted onto the surface of a sphere:</tt><tt></tt>
<p><tt>xyz = transpose(s.xyz)</tt>
<br><tt>oTin = OBJ_NEW('IDLgrPolygon', xyz, STYLE=0)</tt>
<br><tt>xobjview, oTin</tt><tt></tt>
<p><tt>Now a matter of making sense of the connectivity; if I feed "tri"
to IDLgrPolygon its a mess (I've seen worse but still not right) - note
that "tri" is a LONG array[3, 96]:</tt><tt></tt>
<p><tt>oTin = OBJ_NEW('IDLgrPolygon', xyz, polygons=tri, STYLE=1)</tt>
<br><tt>xobjview, oTin</tt><tt></tt>
<p><tt>Now what do represent the IEND and IADJ (I might guess its indexend
and indexadjacency but else) array and how to use them effectively? any
sample around?</tt>
<br><tt>Printing those two array just make things more confusing; I would
guess IEND is used to "segment" IADJ but: 5 9 15 21 27 32 38 46 ... etc
up to just below 300 doest look like that while printing IADJ begin with
what seem a triangle index - 2 8 4 7 5 3 8 1 5 8 2 5 ... whithin the 50
vertice range, the last line is suddenly fill of completely out of range
values like 1129665108!?!?</tt><tt></tt>
<p><tt>Looking at IADJ[<last value in IEND-1 = 287>] show that it is
the last valid value before out of range values (so maybe IEND *might*
be a kind of array segmentation...).</tt>
<br><tt>So I "reform" the array:</tt><tt></tt>
<p><tt>adjj = reform(s.adj, 3, (288/3))</tt>
<br><tt>So I got: adjj[3, 96] -- Hey, that begin to look like it....</tt><tt></tt>
<p><tt>Have to do also "adjj = adjj-1" since all the indexes values were
offset +1 -- that is 1 to 50 instead of 0 to 49 (?!?!again).. skipping
lot of error message here....</tt><tt></tt>
<p><tt>End up feeding again IDLgrPolygon with this adjj as parameter to
"polygons=" but this time error "invalid connectivity"... duh..</tt>
<br><tt>So here I'm I........ begin to have exhausted all the guessing
I could (I would like to try something based on some doc or fact but didnt
find any) and also I do not like to do programming by guessing....</tt>
<br><tt>Anybody have some ideas?</tt><tt></tt>
<p><tt>Thanks in advance</tt><tt></tt>
<p><tt>Sylvain Carette</tt>
<br><tt>VRML designer-composer</tt></html>
|
|
|