Performing Union and Intersection to Create New Widgets

3 views
Skip to first unread message

Aras

unread,
Nov 11, 2010, 2:14:53 AM11/11/10
to pymt-dev
Hi,
I have a few task that requires defining shapes based on intersection
of other shapes. For example, I have two circles that overlap and I
want to color the intersection differently and also handle touch
events on that region independently. What do you think would be a good
way of achieving this? Can I do intersection of SVG widgets?

Thanks,
Aras

Thomas Hansen

unread,
Nov 11, 2010, 2:22:51 AM11/11/10
to pymt...@googlegroups.com
could you just set the blending mode while drawing the circles to get the different color for the intersecting region?  for teh touches you'll have to check if they fall within the circles (distance(touch, center) < radius ).  if its inside both circles, it will be in the intersection.

--
Thomas


--
You received this message because you are subscribed to the Google Groups "pymt-dev" group.
To post to this group, send email to pymt...@googlegroups.com.
To unsubscribe from this group, send email to pymt-dev+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pymt-dev?hl=en.


Aras Balali Moghaddam

unread,
Nov 11, 2010, 4:35:08 PM11/11/10
to pymt...@googlegroups.com
Thomas,
Thanks for getting back to me. I'll give that a shot and see how far I can get using this technique. However, I am afraid that things might get complicated as I work with more complex shapes. I cant envision how I could cut out or detach the intersection using this technique. I want to create a new widget from the intersection and then continue working with them even after I move the original shapes (the two circles in this case).

I have seen a feature like this in some other toolkits. For example in SWT you can perform union, subtraction, and intersection on basic shapes and create new shape objects from them. Also the w3c SVG working draft defines methods for performing these functions. This is simple but extremely powerful feature. If it is not already possible to do this with PyMT, I would like to request this feature.

Cheers,
Aras
Reply all
Reply to author
Forward
0 new messages