Dear All I "solved" my problem. Yet again it was more due to my incomplete (but improving I hope) understanding of how DX works.
In attempting to honour my input data as much as possible, I was doing this calculation on the original data. The result was sent to autoglyph, after passing, optionally, through either sample or map to plane. What was happening was that compute calculated my parameters correctly at my structural nodal points, but the subsequent routines interpolated this data linearly and then constructed the vector plot from the interpolated values. Since my calculation is directionally dependent this linear interpolation would, for one 30degree range, always interpolate the "wrong" part of the directional space. Hence the plotting errors. By passsing the original tensor through grid/regrid or sample before doing the calculation the data is transferred to the position of the subsequent plot and no interpolation of the angle occurs for the plot. Simple really, once I realised that the plot was using data interpolated from the calculation done at each of the original data points. Take care Peter -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Connolly Sent: 01 February 2004 15:07 To: [email protected] Subject: [opendx-users] Compute modifying data when it shouldn't Dear All I have an "interesting" situation. I generate 2 mutually perpendicular in plane vectors from the horizontal part of a 3D tensor. Rotate these about an angle to give their orientation and then want to colour them by magnitude. i.e. all the vectors with the largest magnitude are the same colour. I couldn't work out how to separately colour the 2 vectors given when passing a 2D tensor to glyph so I'm doing it "long hand". When I pass the vectors directly to my colour/glyphing macro I get correctly orientated mutually perpendicular vectors but, obviously, these are not sorted by magnitude. i.e. some times the smaller vector is coloured as the largest and visa-versa To overcome this, I passed the vectors through a compute with the following expression: mag(Vec1) >= mag(Vec2) ? Vec2 : Vec1 (*.net snippet at end of mail) Which I hoped would sort them by magnitude and pass the vectors unchanged. Unfortunately, the vectors returned by this compute are correctly classified (i.e. bigger vectors are now always coloured as such), but now the glyphs generated are not always mutually perpendicular. Clearly, even though the compute is told just to pass the appropriate vector unchanged it changes the magnitudes somehow. I have tried specifying everything as doubles, and separating the vectors into components, sorting then rebuilding them. Neither approaches help. Any ideas? Peter Ps, for those in the geological field, this is for visualisation of SH/Sh from a general 3D stress state calculated in FEM. The *.net application this routine is part of will soon become available on the www.World-Stress-Map.org site Start code snippet // // time: Sun Feb 01 14:51:34 2004 // // version: 3.2.0 (format), 4.3.0 (DX) // // // MODULE main // workspace: width = 394, height = 476 // layout: snap = 0, width = 50, height = 50, align = NN // macro main( ) -> ( ) { // // node Receiver[1]: x = 141, y = 107, inputs = 1, label = Vec1 // main_Receiver_1_out_1[cache: 0] = Vec1; // // node Receiver[2]: x = 218, y = 110, inputs = 1, label = Vec2 // main_Receiver_2_out_1[cache: 0] = Vec2; // // node Compute[738]: x = 226, y = 272, inputs = 3, label = Compute // input[1]: defaulting = 0, visible = 0, type = 32, value = "mag($0) >= mag($1) ? $0 : $1" // expression: value = mag(Vec1) >= mag(Vec2) ? Vec1 : Vec2 // name[2]: value = Vec1 // name[3]: value = Vec2 // main_Compute_738_out_1 = Compute( main_Compute_738_in_1, main_Receiver_1_out_1, main_Receiver_2_out_1 ) [instance: 738, cache: 1]; // // node Compute[739]: x = 322, y = 271, inputs = 3, label = Compute // input[1]: defaulting = 0, visible = 0, type = 32, value = "mag($0) >= mag($1) ? $1 : $0" // expression: value = mag(Vec1) >= mag(Vec2) ? Vec2 : Vec1 // name[2]: value = Vec1 // name[3]: value = Vec2 // main_Compute_739_out_1 = Compute( main_Compute_739_in_1, main_Receiver_1_out_1, main_Receiver_2_out_1 ) [instance: 739, cache: 1]; // // node Transmitter[1]: x = 187, y = 414, inputs = 1, label = MaxVec // MaxVec = main_Compute_738_out_1; // // node Transmitter[2]: x = 336, y = 407, inputs = 1, label = MinVec // MinVec = main_Compute_739_out_1; // network: end of macro body } main_Receiver_1_in_1 = NULL; main_Receiver_1_out_1 = NULL; main_Receiver_2_in_1 = NULL; main_Receiver_2_out_1 = NULL; main_Compute_738_in_1 = "mag($0) >= mag($1) ? $0 : $1"; main_Compute_738_out_1 = NULL; main_Compute_739_in_1 = "mag($0) >= mag($1) ? $1 : $0"; main_Compute_739_out_1 = NULL; Executive("product version 4 3 0"); $sync main(); End code snippet _____________________________________ Dr Peter Connolly World Stress Map @ Geophysical Institute University of Karlsruhe Hertzstrasse 16 76185 Karlsruhe Germany tel +49 (0)721 6084593 fax +49 (0)721 71173 [EMAIL PROTECTED] http:\\www.world-stress-map.org
