Dylan,

> I've got a wireframe cube in which I am plotting some (x,y,z) data.
> That works well. What I'd like the user to be able to do is
> effectively crop the data in the cube in a similar fashion to how it
> is done in 2D using Photoshop. So, for example, when the user
> chooses to crop the data, they will be presented with a greyed out,
> quasi translucent cube inside the wireframe cube and by using the
> mouse, they can move the cube and resize it. Once they have moved
> the greyed out cube around and size it to include all the data they
> desire, they can hit enter or whatever, and my code can take over
> extracting the data plotted within this grey cube and do stuff with
> it.

Well, fine.

> So, I know how to make cubes and draw points and display triangles.
> But I have no idea who to make a cube that the user can enlarge by
> dragging the corners of it or move around by dragging the middle of
> it.
>
> Any thoughts and/or suggestions?

Yes.
I've had to build a 3D-GUI last year myself as a part of the work for
my universities degree.

Aside from the classical 3D-GUI (three orthogonal views as 2D-
projections), I would like to propose the following solution:
* make the inner cube wireframed also (this enables you to use
  "picking" more reliably than with a solid / xparent geometry -
  picking problem: corners "hidden" by the cubes faces / determining
  what the user wanted to pick from an (Z-)ordered list of intersec-
  tions)
  If you should want to impose the impression that the inner cube
  has visible faces rather than just being a wireframe, use Shape3Ds
  with some xparency, additionally.
  When you stick with the Cube(), you'll probably have to do some
  clever maths for scaling and positioning. A wf geometry(array) is
  much more flexible in this aspect.
* put some tiny, solid cubes as "handles" at its corners
* use picking along with colouring / hiliting to identify the chosen
  geometry / handle. Especially the hiliting can take a lot of
  possible surprises for the user from your GUI. The visual feedback
  seems essential to me - especially with the sometimes "interesting"
  way, picking works.
* use the prebuilt PickBehaviour-classes to move the corners around.
  -> PickMouseRotate and PickMouseTranslate (afair), but keep in mind
  that when you rotate the model in 3-space, the axes still stay their
  way. The standard mousepicking-classes do not respect the orienta-
  tion of the current view. This might lead to some nasty surprises.
* use J3Ds cabapilities of scaling instead of rebuilding your geo-
  metry every time. Keep an internal variable that stores your current
  scalefactor, since after an operation the new size will be "1.0".
* Keep a "reset view" button at hand - in case the user should feel
  lost and / or confused.

Maybe you might want to enable the user to have the inner cube
("focus") rendered solid / xparent on demand to get a better impres-
sion of its current form and extent. A Swing-button might serve you
well. (To mix Swing with J3D, please have a look at the FAQ at
J3d.org, in case you haven't done this yet. In short: globally switch
off Swings lightweightness.)

Pros:
+ easy navigation, very little abstraction for the user.
+ no switching between your rendered scene and the three 2D-pro-
  jections / no multiported views.
+ very little (or even none at all) context switching for the user.
  He/She should be able to do everything that is needed in one con-
  text, before switching over to the rest of the (2D-)GUI (if any).
  The switching is tiring and requires many long mouse moves. This
  is highly inefficient.

Cons:
- nonstandard; the user thus has to be taught how to use this
  interface

last but not least:
* keep in mind that picking sometimes might behave a bit strange and
  that it might require some tweaking
* have a look at and keep an eye on the (picking) demos delivered with
  the J3D-API / documentation / tutorial. The three dimensional game
  might help you very much for a start. It is a slight bit similar to
  what you want to do. ("FourByFour")

If you want to spare some work, have the user modify only the facing
sides. Three buttons "<- X ->", "<- Y ->" and "<- Z ->" (nice styled
icons, of course) should do the trick.

+ less work for you, easier geometry modification
- less intuitive GUI, more 3D-/2D-context switching for the user,
  "heavier mousing". ;-)
- less flexible

HTH.

Regards,
Andre

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to