Re: [Fwd: Direct manipulation along a line]

Hi Don,

Strange your original message never appeared on the list.

What you generally need is a way to find the closest point
on a 1-D manifold to a ray (the ray defined by the cursor).
There are two similar things in the system:

1. DataRenderer.findRayManifoldIntersection() uses Newton's
   method to find the intersection of a ray with a 2-D
   manifold.
2. DataRenderer.java, lines 2140-2155 finds the closest
   point on a 1-D line (a straight 1-D manifold) to a ray.

If I were you, I'd start with a simple approach and add
complexity only as needed. So I'd start with a manipulable
point initialized somewhere on your 1-D manifold, linked
to your Display via a DirectManipulationRendererJ3D. As
the user drags this point, it will move in a plane parallel
to the screen but not be constrained to move along your
1-D manifold. In fact, such constraint is impossible given
that in general the ray defined by the user's cursor location
will not intersect the 1-D manifold. So render the manipulable
point as just a single dim point. But also display a more
prominent point that moves along the 1-D manifold, at the
sample along the manifold that your CellImpl (triggered by
changes in the manipulable point) calculates to be the
nearest point on the 1-D maniold to the manipulable point.

Given the visual feedback to the user of the prominent point
moving along the 1-D manifold, this may be good enough. If
it isn't, the next iteration would be for the CellImpl to
compute the closest point on the 1-D manifold to the ray
defined by the manipulable point. You might get this ray
by converting from the Data coords of the manipulable point
to (XAxis, YAxis, ZAxis) via the ScalarMaps, then pass this
to MouseBehaviorJ3D.cursorRay() to get the ray. But only do
this ray business if the firts approach isn't good enough.

Given the general utility of this answer, I will take the
liberty of CC'ing to the list.

Good luck,
Bill

On Fri, 26 Aug 2005, Don Murray wrote:

> Hi Bill-
>
> Is this possible at present?  If not, what would it take to
> do something like this?  A new DataRenderer?
>
> Don
>
> -------- Original Message --------
> Subject: Direct manipulation along a line
> Date: Mon, 22 Aug 2005 10:54:17 -0600
> From: Don Murray <dmurray@xxxxxxxxxxxxxxxx>
> Reply-To: dmurray@xxxxxxxxxxxxxxxx
> Organization: UCAR/Unidata
> To: visad-list@xxxxxxxxxxxxxxxx
>
> Hi-
>
> I have a flight track that is a Gridded2DSet on a a 1-D
> manifold (a line).  I'd like to put a directly manipulable
> shape (e.g. an airplane) on that line that I can drag along
> the line.  As the shape is manipulated, changes in position
> would trigger changes in some other display.
>
> Is there a way to restrict the movement of the shape to be
> the along the flight track?  I know I can restrict it in
> XYZ using constant maps, but what I want is something where
> the ConstantMap is the Gridded2DSet.
>
> Thanks for your help.
>
> Don
> *************************************************************
> Don Murray                               UCAR Unidata Program
> dmurray@xxxxxxxxxxxxxxxx                        P.O. Box 3000
> (303) 497-8628                              Boulder, CO 80307
> http://www.unidata.ucar.edu/staff/donm
>          "Time makes everyone interesting, even YOU!"
> *************************************************************
>
>
> --
> *************************************************************
> Don Murray                               UCAR Unidata Program
> dmurray@xxxxxxxxxxxxxxxx                        P.O. Box 3000
> (303) 497-8628                              Boulder, CO 80307
> http://www.unidata.ucar.edu/staff/donm
>          "Time makes everyone interesting, even YOU!"
> *************************************************************
>
>
>