Re: "Object Graphics and Vectors" Reloaded [message #40311] |
Tue, 03 August 2004 08:25  |
Ralf Schaa
Messages: 37 Registered: June 2001
|
Member |
|
|
Thanks David, I'll try the normalize function...hopefuly it won't take
weeks ... :-)
David Fanning wrote:
> Alas, scaling everything in a view into the same arbitrary
> coordinate system is the *essence* of object graphics programming.
> The fact that you are having trouble doing it is not the least
> bit surprising to those of us who have lost *weeks* (perhaps
> *months*!) struggling with the same thing. :-)
>
> All I can tell you is that my method (which works)
> doesn't look anything at all like the methods used
> by most RSI programmers (which also work). I don't
> have a clue how they do it. :-(
>
> What I do is make a very simple viewplane rectangle
> in whatever coordinate system seems to make sense
> for the problem at hand. Then I ask the thing I
> want to scale for its current "range". I take
> that range and scale it with my NORMALIZE function,
> which allows me to specify both a range and a position
> in my arbitrary coordinate system. It spits out the
> scaling and translation factor that I need to pass
> along to the [XYZ]Coord_Conv keywords.
>
> http://www.dfanning.com/programs/normalize.pro
>
> I tried to figure how the NORMALIZE function works
> recently (well, I *wrote* the damn thing!), but
> it was hopeless. Let's just say I have no
> problem believing in magic. :-)
>
> Cheers,
>
> David
>
|
|
|
Re: "Object Graphics and Vectors" Reloaded [message #40313 is a reply to message #40311] |
Tue, 03 August 2004 06:15   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Ralf Schaa writes:
> I found Rick Towlers 'vector' Object , which he posted 2002 and it
> plotted a vector in my scene, unfortunately not in the right scale and
> at the right place, i tried the coord_conv but this did not help ...
>
> Of course there is a scaling problem, since the magnitude of the s/c
> velocity is much less than the scale of the coordinate system, so i
> multplied with a factor that makes sure I'd see the vector ...
>
> So, has someone a clue of how to set the scales right for that
> vector-object, or should I consider a new approach?
Alas, scaling everything in a view into the same arbitrary
coordinate system is the *essence* of object graphics programming.
The fact that you are having trouble doing it is not the least
bit surprising to those of us who have lost *weeks* (perhaps
*months*!) struggling with the same thing. :-)
All I can tell you is that my method (which works)
doesn't look anything at all like the methods used
by most RSI programmers (which also work). I don't
have a clue how they do it. :-(
What I do is make a very simple viewplane rectangle
in whatever coordinate system seems to make sense
for the problem at hand. Then I ask the thing I
want to scale for its current "range". I take
that range and scale it with my NORMALIZE function,
which allows me to specify both a range and a position
in my arbitrary coordinate system. It spits out the
scaling and translation factor that I need to pass
along to the [XYZ]Coord_Conv keywords.
http://www.dfanning.com/programs/normalize.pro
I tried to figure how the NORMALIZE function works
recently (well, I *wrote* the damn thing!), but
it was hopeless. Let's just say I have no
problem believing in magic. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: "Object Graphics and Vectors" Reloaded [message #40440 is a reply to message #40313] |
Wed, 04 August 2004 10:28  |
Ralf Schaa
Messages: 37 Registered: June 2001
|
Member |
|
|
David Fanning wrote:
> ... who have lost *weeks* (perhaps *months*!) struggling with the same thing. :-)
okay, I thought 'well, before taking David's hint I give it a try
myself, this can't be soo hard ...'
This is what I have:
a nice 3d object plot in data-coordinates with all rangings from -2.5e4
to 2.5e4, so far so good.
Now I add a vector with Rick Towler's vector object, which needs as
input a 'location' (the startpoint of the vector) and a 'magnitude' (the
endpoint), these are defined in normalized coordinates.
Okay, all i have to do is give the location and the magnitude in values
which are near my ranging-values, actually I calculated them with the
formula taking from the idl help:
NormX = -range[0]/(range[1]-range[0]) + 1/(range[1]-range[0]) * DataX
I need the other way round:
DataX = NormX * ((range[1]-range[0])) + range[0]
e.g a vector in normalized coordinates from [0,0,0] to [1,1,1]
would be in datacoordinates
from [range[0],range[0],range[0]]
to [3*range[1],3*range[1],3*range[1]]
but nothing exciting happened ...
so where is my bug ?
Cheers
-Ralf
|
|
|