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:13:22 EDT (-0400)
  Re: Equal distribution along stretched circle circumference - how to do it?  
From: David Buck
Date: 30 Mar 2001 06:33:37
Message: <3AC46F98.2DEADB29@simberon.com>
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.