#### Archived

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

# generating point equal distance on a oval

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

## 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 on other sites
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# = 100b# = 100c# = 60d# = 40pts = 50stp = 360/ptsdo   cls   for t = 1 to 360 step stp      x# = a# + c#*cos(t)      y# = b# + d#*sin(t)      dot x#, y#   next tloop

##### 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 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 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 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 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 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 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 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?"

1. 1
Rutin
33
2. 2
3. 3
4. 4
5. 5

• 13
• 77
• 11
• 10
• 14
• ### Forum Statistics

• Total Topics
632968
• Total Posts
3009586
• ### Who's Online (See full list)

There are no registered users currently online

×