POV-Ray : Newsgroups : povray.general : Equal distribution along stretched circle circumference - how to do it? : Re: Equal distribution along stretched circle circumference - how to do it? Server Time
8 Aug 2024 01:19:16 EDT (-0400)
  Re: Equal distribution along stretched circle circumference - how to do it?  
From: David Buck
Date: 30 Mar 2001 08:22:13
Message: <3AC4890D.4E089814@simberon.com>
I thought of an even better way using coding.  Divide the ellipse into, say, 1000
points based on equal angles
on a unit circle.  Calculate where these points reside on the ellipse.  Add up
Euclidean distances between
successive points to give 1000 arc lengths (from the degree mark to the given point)
and the total perimeter
of the ellipse. Now, divide the total perimeter by the number of markers you want to
position to give you the
distance between each marker.  Now it's easy to find the closest perimeter length for
each marker position.
You could even linearly interpolate or spline interpolate the final position, but it
shouldn't be necessary.

If you want results for one specific case, let me know and I wouldn't mind coding it
up and giving you the
results.  It's a pretty simple algorithm.

David Buck

David Buck wrote:

> I would suggest a simple but slow solution:  Guess the distance needed between the
points.  Generate the
> required number of points that are that distance apart (simple Euclidean distance)
plus one more.  If that
> last one is close enough to the first, stop.  If it's too short, increase the
distance.  If it's too far,
> decrease it.  Each time, through, cut the step size in half (bisection algorithm).
>
> For more accuracy, multiply the number of points to position by a fixed constant
(say, 10 times), do the
> above algorithm, then pick every tenth point.
>
> It may be slow, but it will save you time trying to implement differential equation
solvers and it should
> be fairly easy to code.
>
> David Buck
>
> David Fontaine wrote:
>
> > x and z as a function of t:
> > x = 40 cos t
> > z = 20 sin t
> >
> > arc length is the integral (sum) of distance formula (pythagorean theorem):
> >  /b   ___________________________
> >  |  \/(40 cos t)^2 + (20 sin t)^2 dt
> >  /a
> >
> > find arc length of the total ellipse and divide by however many sections you want,
find where those arc
> > lengths are
> >
> > this can only be done numerically. :( so Jan Cristoph & Francois are correct.
> >
> > --
> > David Fontaine  <dav### [at] faricynet>  ICQ 55354965
> > My raytracing gallery:  http://davidf.faricy.net/


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.