By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,736 Members | 1,982 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,736 IT Pros & Developers. It's quick & easy.

Intersections between transforms

P: n/a
Hi All,
New to Java2D and am trying to do something I know should be relatively
simple but isn't turning out to be.
I want to draw intersecting rectangles across an arbitrary shape that can
rotate to any position around the center of the screen. The shape can
rotate but the rectangles cannot. They must stay horizontal.
I have been investigating the AffineTransform class but am still a little

Couple things are going on that I don't understand:
1) The shape I am drawing on can be rotated to some angle. The rectangles
crossing it won't be. I need to find the intersections of the rectangles
and the shape but they are using different rotational transformations so
their coordinate systems are different. How do I determine where the
rectangles intersect the transformed shape? I see I can use the Area class
to do an intersect between the rectangle and the shape but how is this
accomplished when both are in different coordinate spaces?

2) The user can use the mouse to grab onto the shape or rectangles and move
them. I can track the mouse click by using createInverse that will return
the pretransformed mouse point, but how do I drag the shape so that when the
user moves the mouse horizontally the shape moves horizontally rather than
moving according to its transformed axes? I know I am missing something
simple somewhere. Any help would be appreciated.

Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.