• Advertisement

Archived

This topic is now archived and is closed to further replies.

generating point equal distance on a oval

This topic is 5027 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i need to find a formula that will generate points equal distance along the oval, so I give the formula the oval specs and the distance apart i want the points. anyone know the formula or where i can get it

Share this post


Link to post
Share on other sites
Advertisement
Center of oval (a,b)
x is radius on the x-axis
d is radius on the y-axis
pts is how many points you want
stp calculates the step value used to position points equally apart


a# = 100
b# = 100
c# = 60
d# = 40

pts = 50
stp = 360/pts

do
cls


for t = 1 to 360 step stp
x# = a# + c#*cos(t)
y# = b# + d#*sin(t)
dot x#, y#
next t

loop

Share this post


Link to post
Share on other sites
You need points on the oval, and the distance must be equal?

The formula is easy, but I won't calculate the integral!

Equatation of an oval (at least the upper half of it):
y=a*sqrt(b²-x²)
(a and b are known)

You chose your start point (x=x1) and you wish to travel a distance of n along the oval. This is the formula:
n=the integral from x1 till x2 of sqrt(1+y'(x)²)dx
Solve this to find x2.

I posted this formula a previous time, and they asked me where it comes from. just accept it's true, I won't give the proof since i can't type an integral sign.

[edited by - koroljov on April 14, 2004 1:23:48 PM]

[edited by - koroljov on April 14, 2004 1:24:16 PM]

Share this post


Link to post
Share on other sites
The only way the points are going to be equal is the shape is an ellipse not oval. It can be simulated by using the radius of the height and width.

x = H*cos(angle/PI*180)
y = W*sin(angle/PI*180)

The points on the opposite side should be equal.

Share this post


Link to post
Share on other sites
thanx for replying... of the 3, none of those will work. the 1st and 3rd are what i have right now. but that makes so the points are equal distance from the center of the oval only. the 2nd one... well i tried solving for it, but then realize it would do me no good as this has to be a dynamic formula for a program iam making so it will do me no good.

Share this post


Link to post
Share on other sites
Use the equation to move each angle that is equal, the "points" are going to be equal.

Meaning you want the points to be 10 pixels between them, then your going to need to calculate the angle between them. If you plug 2 degrees into the equation then they all will be 2 degrees apart. Your equal spacing....

--
What are you nutz?

I have nothing to say to your unevolved little brain. The more I say gives you more weapons to ask stupid questions.

[edited by - afterburn on April 14, 2004 5:44:07 PM]

Share this post


Link to post
Share on other sites
all your opinions are wrong, if i understand the problem correctly.

so you want the collection of points at a fixed distance from an elipse?

lets stay with axis aligned elipses for a moment. they can be written as:

Ex = a*cos(t)
Ey = b*sin(t)

now from each point on this elipse, we need to move outwards along the normal, which is given by:

Nx = Ey/dt / |N|
Ny = -Ex/dt / |N|

where
|N| = b*cos(t)^2+a*sin(t)^2

and your shape S with distance d from the elipse is then:

Sx = Ex+Nx*d
Sy = Ey+Ny*d

DISCLAIMER:
this isnt tested, but im pretty sure it works. sorry im too lazy to explain it properly. the calculation of |N| is what im not 100% sure about, but it seems about right to me.

Share this post


Link to post
Share on other sites
This sounds like homework to me. Just like he doesn''t understand the equation or the idea behind it.

To the last post yes my equation works. I have written the it almost 5 years ago in javascript to move a layer. At the dawn of DHTML when IE 3.02 was still less used than netscape.

Share this post


Link to post
Share on other sites
[url]http://origins-unknown.com/Ellipse/Script.asp[/url]

Is the exact equation that I posted before just implemented in ASP.



[edited by - afterburn on April 14, 2004 9:02:01 PM]

Share this post


Link to post
Share on other sites
I misunderstood the question on the first reading, too.

He doesn''t want to have points that are equal angles away, but the points themself shall have same distance to each other.

just imagine a pretty flat elipse.
say you head on in 10° steps, so you have 36 points...
with a large distance from the center of the elipse 10° become a big distance between the points, too. on the other hand close to the center 10° between two points is almost no distance between the points on the eclipse.

Eelco''s answer is probably the best so far.
Hm, but on the other hand this problem is nasty enough to let me think "why should i do not use equal angle distance instead?"

Share this post


Link to post
Share on other sites
this is what it should look like i think



[edited by - stickman on April 16, 2004 3:42:43 PM]

oops the last oval drawing is wrong, but i think u get the idea

[edited by - stickman on April 16, 2004 3:45:41 PM]

Share this post


Link to post
Share on other sites
well that raises the question: equal distance in what system? equal distance along the oval or equal distance in worldspace?

not that it seems like the OP is still watching his own thread (pretty annoying habit btw), but the latter might be quite hard. equal distance in worldspace would be a rather straightforward solving of the distance and oval formula.

Share this post


Link to post
Share on other sites
afterburn that is not what i need, equal angles will not work with ovals. the drawing stickman did is correct except that last picture which he stated was wrong.

iam making a edge detector and the person will have to put an oval around the object, this is a project for school. iam suppose to implement the edge detector the way the person did it in the paper. so anyways the person was using ovals so iam required to do ovals. all the points must be close to being equal distance for the edge detection to work(its the way the algorithm works). all the points must be the same disance away from its neighboring points. the distance between each point will be set by the user. this will also i believe cause a problem with the last point generated because the distance they pick wont match the oval perfectly... so it might have to be generated outside of the circle to make it equal distance... but of course i dont have a clue how to do this.... so i need your help

[edited by - DeadlyPencil on April 16, 2004 5:44:17 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
This is so trivial...

Pick a point on the ellipse, any point will do. Now compute a circle of radius R, centered at the point. Compute the intersection between the ellipse and the circle. This will give you 2 points a distance R from the original point. You can choose either one (or both). Repeat the process as necessary.

Share this post


Link to post
Share on other sites
i have thought of this before. problem is you can accually get way more than 2 intersections with a skinny oval. also there is more things to take into consideration... i cant just choose any point i find with that radius... what if i go forwards than backwards, even if discard the last point generated because that will be a intercept for the next radius it is still posible to go backwards if i get into a situation with 4 intercepts... that could cause an infinite loop, or a really messed up oval. also when would i stop generating the points?

[edited by - DeadlyPencil on April 16, 2004 6:20:35 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by DeadlyPencil
i have thought of this before. problem is you can accually get way more than 2 intersections with a skinny oval. also there is more things to take into consideration... i cant just choose any point i find with that radius... what if i go forwards than backwards, even if discard the last point generated because that will be a intercept for the next radius it is still posible to go backwards if i get into a situation with 4 intercepts... that could cause an infinite loop, or a really messed up oval. also when would i stop generating the points?

<SPAN CLASS=editedby>[edited by - DeadlyPencil on April 16, 2004 6:20:35 PM]</SPAN>


No, you can''t get ''way'' more. The maximum you can get is 4 intersections. You can solve for each one and choose the one in the right direction. How do you know what direction to choose? A good first start would be taking the derivative of the ellipse in polar coordinates. This will give you the slope for all 2-4 intersection points, which you can then use to choose the appropriate one.

Obviously, you stop when your first point is less than a distance R from your most recently computed point.

Of course, the spacing will not be constant for the last point, as you pointed out. There''s no way around that. You can''t give the user the freedom to choose the number of points, and yet have the spacing be equal. It doesn''t work that way.

Share this post


Link to post
Share on other sites

  • Advertisement