POV-Ray : Newsgroups : povray.off-topic : A small math problem (in code) Server Time
31 Oct 2024 16:17:05 EDT (-0400)
  A small math problem (in code) (Message 1 to 3 of 3)  
From: Anthony D  Baye
Subject: A small math problem (in code)
Date: 17 Mar 2016 02:25:01
Message: <web.56ea4cf2b5a59f66fd6b6fe10@news.povray.org>
So I have the following program which I wrote to calculate the boundary of a
gosper island, which it does quite admirably.  However, according to my logic,
all resultant points should have an x coordinate -length/2 <= x </ length/2 but
I consistantly get a couple coordinates outside that area for values of epsilon
smaller than ~0.17

The only thing I can think of is that, below that length, the normalized vector
gets flipped, but I can't think of any reason this should be happening if the
sign of both x coordinates is the same, and since the left coordinate is always
p0, the vector p1 - p0 should always point toward the positive x.

unless I'm missing something very subtle, or there's an elephant in the code and
I'm just not seeing it.

Maybe another set of eyes will see what mine don't.

Regards,
A.D.B.


Post a reply to this message


Attachments:
Download 'gosper.cpp.txt' (5 KB)

From: scott
Subject: Re: A small math problem (in code)
Date: 17 Mar 2016 04:08:44
Message: <56ea660c$1@news.povray.org>
> So I have the following program which I wrote to calculate the boundary of a
> gosper island, which it does quite admirably.  However, according to my logic,
> all resultant points should have an x coordinate -length/2 <= x </ length/2

What logic is that? To me it seems feasible that if you just consider 
the very left-most piece at each iteration, it's just rotating 
anti-clockwise, so eventually it might start to point left rather than 
right?

> but
> I consistantly get a couple coordinates outside that area for values of epsilon
> smaller than ~0.17

FWIW if you zoom in on the POV version it does indeed go back further 
than the starting point after the 5th iteration (see attached).


Post a reply to this message


Attachments:
Download 'croppercapture[9].png' (22 KB)

Preview of image 'croppercapture[9].png'
croppercapture[9].png


 

From: Anthony D  Baye
Subject: Re: A small math problem (in code)
Date: 17 Mar 2016 11:25:00
Message: <web.56eacb25a11d56f1fd6b6fe10@news.povray.org>
scott <sco### [at] scottcom> wrote:
> > So I have the following program which I wrote to calculate the boundary of a
> > gosper island, which it does quite admirably.  However, according to my logic,
> > all resultant points should have an x coordinate -length/2 <= x </ length/2
>
> What logic is that? To me it seems feasible that if you just consider
> the very left-most piece at each iteration, it's just rotating
> anti-clockwise, so eventually it might start to point left rather than
> right?
>
It occurred to me that it could be the rotation as I was going to bed.

Regards,
A.D.B.


Post a reply to this message

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