POV-Ray : Newsgroups : povray.advanced-users : Approximating a circle arc with line segments Server Time
28 Jul 2024 18:16:15 EDT (-0400)
  Approximating a circle arc with line segments (Message 1 to 9 of 9)  
From: Rune
Subject: Approximating a circle arc with line segments
Date: 5 Nov 2004 20:46:06
Message: <418c2cde$1@news.povray.org>
Disclaimer: This post doesn't contain a question. It is about something I've 
found out. Not something that'll be significant for anyone, and even for me 
the ultimate usefulness is probably quite limited. This post is a testimony 
of how I can sometimes spend several hours figuring out interesting 
relations between numbers, irregardless of how important it is for my final 
application.

Well, I wanted to approximate a circle arc with a number of straight line 
segments. I needed the circle arc to have a variable angle but a constant 
length, like you have a long object you can bend. Actually it is to become a 
bendable bone in a skeletal system I'm working on. It could be used for a 
spinal cord or similar.

Now, it'll be practical to have only one type of bones in my system, so I 
wanted to simulate this bendable "circle arc" bone using a number of 
straight bones after each other.

I set up these criteria:

* The total length of the line segments must equal the length of the circle 
arc.
* Individual line segments may not change length during bending (change of 
angle).
* The first and last line segment must "touch" (be a tangent to) the circle 
arc at the start and end of the circle arc.
* All the angles between the line segments must be the same.
* The first and last line segment may have a different length than the other 
line segments.

Now, this problem is a bit tricky. The only way to meet the first four 
criteria is to indeed have the first and last line segment be shorter than 
the rest. But how much shorter exactly? 50%? More? Less?

The problem is that this varies with both angle and number of segments. So 
for a given number of segments and a given angle I need to find the optimal 
ratio between middle segment length and end segment length. I made a 
POV-script that found this optimal ratio using binary searching.

It turned out that the optimal ratio varies very little with angle (less 
than one degree), as long as the angle is smaller than about 135 degrees. 
Very lucky, since I couldn't have fulfilled all criteria otherwise!

It changes a lot with the number of segments though. For 3 segments (2 
joints) the first and last segment should be 0.25 times the length of the 
other segments. For 3 joints the ratio is 0.33, for 4 joints it's 0.38. For 
10 joints it's 0.45 and for 50 joints it's 0.49.

Analyzing this a bit it seems like the ratio is 0.5-(0.5/joints). 
Interesting eh?

So now I can simulate a circle arc bone using any number of straight bones 
with optimal accuracy. I'm sure it'll help me make *much* more realistic 
spinal cord movements! And it only took me a few hours to figure out... ;)

Rune


Post a reply to this message

From: Stefan Viljoen
Subject: Re: Approximating a circle arc with line segments
Date: 8 Nov 2004 13:33:23
Message: <418fbbf1@news.povray.org>
Rune wrote:

> Disclaimer: This post doesn't contain a question. It is about something
> I've found out. Not something that'll be significant for anyone, and even
> for me the ultimate usefulness is probably quite limited. This post is a
.
.
.
> So now I can simulate a circle arc bone using any number of straight bones
> with optimal accuracy. I'm sure it'll help me make *much* more realistic
> spinal cord movements! And it only took me a few hours to figure out... ;)
> 
> Rune

Wow - hey Rune, you live in Scandinavia, right?

Why is it that all the great -real- programmers live in or near the Arctic
circle? All the real good demo groups were base there (like Future Crew),
Linus Torvalds comes from Finland, you live there, etc.

This is VERY impressive - I would never ever be able to figure something
like that out on my own. The closest I have come was when I figured out an
assembly bitblitter for 320x200x256. And that took me weeks. That was
nothing compared to this!

You plan to release a bones system for Pov maybe?

Kind regards,
-- 
Stefan Viljoen
Software Support Technician
Polar Design Solutions


Post a reply to this message

From: Warp
Subject: Re: Approximating a circle arc with line segments
Date: 8 Nov 2004 14:15:24
Message: <418fc5cc@news.povray.org>
Stefan Viljoen <ryl### [at] intekomcoza> wrote:
> Why is it that all the great -real- programmers live in or near the Arctic
> circle?

  If I started explaining my theories on this I would most probably
sound like a racist (which is not my intent), so I won't. ;)

-- 
plane{-x+y,-1pigment{bozo color_map{[0rgb x][1rgb x+y]}turbulence 1}}
sphere{0,2pigment{rgbt 1}interior{media{emission 1density{spherical
density_map{[0rgb 0][.5rgb<1,.5>][1rgb 1]}turbulence.9}}}scale
<1,1,3>hollow}text{ttf"timrom""Warp".1,0translate<-1,-.1,2>}//  - Warp -


Post a reply to this message

From: Rune
Subject: Re: Approximating a circle arc with line segments
Date: 8 Nov 2004 16:24:33
Message: <418fe411@news.povray.org>
Stefan Viljoen wrote:
> Wow - hey Rune, you live in Scandinavia, right?

Yep, in Denmark.

> Why is it that all the great -real- programmers live
> in or near the Arctic circle?

Do they? I have no idea why.

> This is VERY impressive - I would never ever be able
> to figure something like that out on my own.

It was partly a joke. :) It will have limited usefullness in my system - it 
was more meant to illustrate the way I often think...

> The closest I have come was when I figured out an
> assembly bitblitter for 320x200x256. And that took
> me weeks. That was nothing compared to this!

A bitblitter is something with displaying sprites on the screen, right? Or 
what? I'm not sure...

> You plan to release a bones system for Pov maybe?

Oh, but I've only just started on it. I expect the project to take years...

Rune
-- 
3D images and anims, include files, tutorials and more:
rune|vision:  http://runevision.com
POV-Ray Ring: http://webring.povray.co.uk


Post a reply to this message

From: Stefan Viljoen
Subject: Re: Approximating a circle arc with line segments
Date: 9 Nov 2004 01:19:11
Message: <4190615f@news.povray.org>
Warp wrote:

> Stefan Viljoen <ryl### [at] intekomcoza> wrote:
>> Why is it that all the great -real- programmers live in or near the
>> Arctic circle?
> 
>   If I started explaining my theories on this I would most probably
> sound like a racist (which is not my intent), so I won't. ;)
> 

I think it has to do with the cold and superconduction...:)

-- 
Stefan Viljoen
Software Support Technician
Polar Design Solutions


Post a reply to this message

From: Stefan Viljoen
Subject: Re: Approximating a circle arc with line segments
Date: 9 Nov 2004 01:21:14
Message: <419061d8@news.povray.org>
Darren New wrote:

> Stefan Viljoen wrote:
>> Why is it that all the great -real- programmers live in or near the
>> Arctic circle?
> 
> "Donald Ervin Knuth. Born: 10 Jan 1938 in Milwaukee, Wisconsin, USA"
> 
> OK, I guess Wisconsin counts as Actic, especially compared to where I
> live. ;-)

Naw - just a joke Darren. I've always admired persons programming in
Scandinavia especially when I was at highschool and the old Amiga style
demos were all the rage. To my innocent boyhood eyes (!) it seemed all
programming "gods" lived in the high North.

But anyway!

-- 
Stefan Viljoen
Software Support Technician
Polar Design Solutions


Post a reply to this message

From: Stefan Viljoen
Subject: Re: Approximating a circle arc with line segments
Date: 9 Nov 2004 01:23:35
Message: <41906264@news.povray.org>
Rune wrote:


>> The closest I have come was when I figured out an
>> assembly bitblitter for 320x200x256. And that took
>> me weeks. That was nothing compared to this!
> 
> A bitblitter is something with displaying sprites on the screen, right? Or
> what? I'm not sure...

Somesuch - I saw Space Quest I on a PC and I just HAD to do that for myself.
I had not net access then - it took my weeks to figure out the theory, then
a further two to figure out why it was flickering so bad, then another week
to come up with the algo, etc. etc.

But my big weakness is maths I think.

Anyway! Enough bandwidth wasted - keep up posted on that bones system. Even
if it is going to take years...!

Kind regards,

-- 
Stefan Viljoen
Software Support Technician
Polar Design Solutions


Post a reply to this message

From: Stefan Viljoen
Subject: Re: Approximating a circle arc with line segments
Date: 9 Nov 2004 01:27:20
Message: <41906348@news.povray.org>
Stefan Viljoen wrote:

> Warp wrote:
> 
>> Stefan Viljoen <ryl### [at] intekomcoza> wrote:
>>> Why is it that all the great -real- programmers live in or near the
>>> Arctic circle?

Whoops! That should be Polar Circle methinks.

-- 
Stefan Viljoen
Software Support Technician
Polar Design Solutions


Post a reply to this message

From: Derek Chen-Becker
Subject: Re: Approximating a circle arc with line segments
Date: 16 Dec 2004 17:18:18
Message: <41c209aa$1@news.povray.org>
Darren New wrote:
> A blitter, on the other hand, copies blocks of memory to other blocks of 
> memory.

Yup. Trivia note: Blit comes from "BLT", short for "BLock Transfer".

Derek


Post a reply to this message

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