onin wrote:
>
> I would like to add new 3D shapes on my canvas with
> each shaoe not overlapping each other..

Ouch, this is quite a reasonably complex piece of code to write. I'm
going to try to describe what you need to do with a lot of hand-waving.
Hopefully you can deal with this and turn it into something more
useful...

When adding a shape (I assume for these purposes that you are using a
mouse to "enter" the shape) you want to find out what is on the screen
at the desired location. The way to do this is to do picking.

Determining whether your new shape is going to intersect the existing
shapes is just a matter of setting up the correct PickShape object. In
looking through the J3D list, there doesn't appear to be anything that
is directly usable for what you want. Effectively, your picking needs to
have a finite 2D shape (The object outline) and an infinite length 3rd
dimension (Z axis in the view coordinates). This is going to make life
fairly hard for you. Possibly the best way to do this is to first
construct a cylinder with the radius set to the largest value of the
bounds of the your shape. Make a pick with that, and if it does not
interesect, things are cool. If it does intersect things get tricky, did
we intersect bits that really don't represent the object etc etc. The
best way I can think of dealing with this is to then build a much more
complex PickBounds using a BoundingPolytope class to hold the exact
geometry of your new object.

--
Justin Couch                         http://www.vlc.com.au/~justin/
Freelance Java Consultant                  http://www.yumetech.com/
Author, Java 3D FAQ Maintainer                  http://www.j3d.org/
-------------------------------------------------------------------
"Humanism is dead. Animals think, feel; so do machines now.
Neither man nor woman is the measure of all things. Every organism
processes data according to its domain, its environment; you, with
all your brains, would be useless in a mouse's universe..."
                                              - Greg Bear, Slant
-------------------------------------------------------------------

===========================================================================
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