Is it possible...

Equinox, http://www.wizards.dupont.com/Equinox/Equinox.html, allows the
user to track a green dot across the surface by manipulating a yellow
dot.  The user clicks on the yellow dot and moves it with the pointer
in 3 dimensions.  The green dot tracks in 2 dimensions and stays just
above the surface (thanks Bull).  I would like to make two changes to
 the current implementation:

  1. the location of the yellow dot appears in the upper left hand
     corner.  I would like the 'documents' variable to reflect the
     position of the green dot, not the yellow dot as it does now (the
     X and Y variables are already the same for the yellow and green
     dot);

  2. I would like to constrain the green dot to remain on the surface.
     I can get close with this code

        RealTuple location=(RealTuple) direct_reference.getData();
        int x=(int) (((Real) location.getComponent(0)).getValue()+0.5);
        int y=(int) (((Real) location.getComponent(1)).getValue()+0.5);
        if ((x >= 0) && (x < table.getColumnCount()) &&
            (y >= 0) && (y < table.getRowCount()))
          {
            /* update green dot */
          }

     But this is not quite what I want.  I still want to move the green
     dot if one of the variables (x,y) is within range but constrain it to
     the surface (0-39,0-29).  Using Math.min and Math.max comes to mind
     but how do you use min and max in this context:

        Real[] pairs={(Real) location.getComponent(0),
          (Real) location.getComponent(1)};
        RealTuple pair=new RealTuple(pairs);
        Real value=(Real) self_organizing_map.evaluate(pair);
        value=(Real) value.add(new Real(1.0));
        Real[] triples={(Real) location.getComponent(0),
          (Real) location.getComponent(1),value};

Is either of these requirements possible with Visad?  If so, please clue
me into solving this problem.  The relavant code follows:

    CellImpl cell=new CellImpl()
    {
      public void doAction() throws VisADException, RemoteException
      {
        /*
          Yellow dot tracks green dot along the surface (thanks to
          whibbard@xxxxxxxxxxxxx).
        */
        RealTuple location=(RealTuple) direct_reference.getData();
        Real[] pairs={(Real) location.getComponent(0),
          (Real) location.getComponent(1)};
        RealTuple pair=new RealTuple(pairs);
        Real value=(Real) self_organizing_map.evaluate(pair);
        value=(Real) value.add(new Real(1.0));
        Real[] triples={(Real) location.getComponent(0),
          (Real) location.getComponent(1),value};
        RealTuple triple=new RealTuple(triples);
        triple_reference.setData(triple);
      }
    };
    cell.addReference(direct_reference);

  • 1998 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: