[GRASS5] [bug #1358] (grass) d.3d interactive more flexible than command line

Paul Kelly paul-grass at stjohnspoint.co.uk
Wed Oct 23 05:29:41 EDT 2002


On Sun, 20 Oct 2002, Request Tracker wrote:

> this bug's URL: http://intevation.de/rt/webrt?serial_num=1358
> -------------------------------------------------------------------------
>
> I notice that one can manipulate a lot more of d.3d in interactive
> mode than from the command line.  Bummer.  [GRASS 5.0.0pre1 (May 2001)]
>

You can do most things by manually editing a 3dview file and then loading
it from the command line. That is quite easy to do and can be automated.

> By the way, too bad one must specify the coordinates of the to=, and
> can't optionally give an angle instead.

That is a bit awkward. But it is easy enough to calculate a suitable
centre of view value if you know the camera location and yaw, pitch and
roll angles. Here is a MATLAB script I wrote to do it:
yl, xl, zl are the easting, northing and elevation of the camera location
yc, xc, zc are the easting, northing and elevation of the COV
(This is a left-handed co-ordinate system and the pitch angle is positive
looking downwards from the horizontal (0 when looking straight ahead))

xc=xl+10*cos(pitch)*cos(yaw);
yc=yl+10*cos(pitch)*sin(yaw);
% Pitch angle +ve downwards?
zc=zl-10*tan(pitch);
if roll < 0
  roll=(2*pi)+roll;
end
roll=roll.*(180/pi);
sprintf('TO_EASTING:  %6.2f\nTO_NORTHING:  %6.2f\nTO_HEIGHT:  %4.2f\n', yc, xc, zc)
sprintf('FROM_EASTING:  %6.2f\nFROM_NORTHING:  %6.2f\nFROM_HEIGHT:  %4.2f', yl, xl, zl)
sprintf('TWIST:  %4.2f', roll.*10)

By experimentation I found the twist / roll angle is given in decidegrees
(!) and can be between 0 and 360 inclusive.

A quick definition in case these are given different names in geography:
yaw, pitch and roll are robotics terms; yaw is the sideways horizontal
angle from north; pitch is the vertical up/down angle from the
horizontal, and roll is the rotation of the camera along the axis that
passes through its location and the centre of view (positive clockwise).

>
> OK, I suppose one writes scripts like 3d.view.sh.
>
> BTW, I hope that earth's curvature is applied, as I am doing 1 degree
> wide blowups of 50 km away mountains looking horizontally directly
> across, in order to identify which mountains they were in family
> snapshots.

At a guess I would say it probably isn't but I'm not sure. This is a very
interesting application; have you calibrated your camera for field of view
etc. or made a good estimate?

>
> And I sure wish the cursor would stay put, each time one does a run in
> interactive mode, and not jump back to the first item.
>
> BTW, interactive mode should allow one to continue after saving a
> 3d.view setting.
>
> Also Grass interactive programs should use the readline library so one
> can use C-p to recall earlier entries, etc.

I think d.3d has been set in stone for 10 years; no one is going to change
it now. But it is still useful when you need to set exact observer
position co-ordinates and field of view.

>
> In conclusion, I would like to click on a certain mountain in the
> image created by d.3d to find more about it, e.g. coordinates, but
> can't.

You can do this with SG3d, which runs on Silicon Graphics IRIX
workstations and is included in the GRASS IRIX pre-compiled binaries. You
can also do it in nviz (available on all OSs) but exact positioning is
harder there as it can't read 3dview files. (It can save them though, and
these can even be loaded in d.3d). I think with the latest improvements in
nviz it may be possible to set the exact viewer position but I'm not sure
how to do it yet, nor about setting the exact field of view.

> --
> http://jidanni.org/ Taiwan(04)25854780
>
>





More information about the grass-dev mailing list