?
Solved

drawing ellipses

Posted on 2006-06-20
5
Medium Priority
?
423 Views
Last Modified: 2012-06-27
HI,
i am drawing ellipses using actionScript.
i need to know if there is a way to know the common area of two ellipses, and fill it with a color.
thanks
0
Comment
Question by:mte01
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 7

Expert Comment

by:muxxter
ID: 16961235
How are you drawing them, with "curveTo"?
I just want to know what data you know about each one, so I can start to figure the math for you.

MuXx
0
 
LVL 7

Expert Comment

by:muxxter
ID: 16961245
And, yes. You can know the common area of them. :-) And once you know that you can change it's colour.
0
 
LVL 3

Author Comment

by:mte01
ID: 16990216
HI,
I AM USING THIS LIBRARY, it contain the classes needed to draw the ellipses, every thing works fine, i just need to get the common area
http://www.mediaverk.lv/asd/
thanks for the help
0
 
LVL 7

Accepted Solution

by:
muxxter earned 1500 total points
ID: 17005373
Hi mte01, sorry it took me so long to get back to you.

Ok, the library you use does give all the needed information. However, the math involved in finding out if two points from different ellipses is non-trivial. If the ellipse was at the origin, the equation for find a point is:

(x^2/a^2) + (Y^2/b^2) < 1 ... where 'a' and 'b' are the semi-major and semi-minor axis respectively

If a point (X, Y) safisfy this condition, it is inside in the ellipse. However, those ellipses you speak of are probably not both at the origin. Plus, that isn't a very prety way of getting an area, you'd have to do it a whole bunch of time just to get a few points.
I would suggest trying a more math oriented forum. Try "http://mathforum.org/dr.math/", it seems pretty good.

The good news is that the library you're using has all the goodies you need to be able to calculate the needed areas:

drawX - the X coordinate of the center of the ellipse
drawY - the Y coordinate

radiusX - the width of the ellipse (this would also be called the MAJOR axis)
radiusY - the height of the ellipse (this would also be called the MINOR axis)

rotation - the angle of orientation of the ellipse (judging from the example, I'd say it's in degrees, rotating clockwise)

Using these parameters, I'm sure there's math out there that can help you out. Unfortunately, my major in University was computer science, not math. :-)

I hope this helps,
MuXx
0
 
LVL 3

Author Comment

by:mte01
ID: 17009379
yeah man, thanks,
i already checked the library, pretty strong and it's easy to use, but i doubt that Dr. Math can have the time to answer me...
an idea i got it to loop on all the points in the graph, and check if this point verify the ellipse's equation... but 400pixel * 400 pixel * the number of ellipses it a lot..
anyways thanks for the help.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.
Suggested Courses

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question