POV-Ray : Newsgroups : povray.binaries.images : Rotating Squares problem : Re: Rotating Squares problem Server Time
12 Aug 2024 07:25:08 EDT (-0400)
  Re: Rotating Squares problem  
From: Jellby
Date: 8 Oct 2003 16:20:19
Message: <3f847181@news.povray.org>
Among other things, Patrick Dugan wrote:

> I would like any help someone can give regarding a math problem in Povray.
> 
> I have included an image of what I'm trying to accomplish, however it's
> never quite perfect.  I'm trying to start with a small square in the
> center
> (1x1 size) and increase its size to 5x5 and rotate the square as I go.  I
> want the squares to match up so each square corner perfectly matches up
> with
> a line on the next larger square.  Basically end up with a curving line
> made of many squares. I'm doing it all by trail and error and never
> getting it
> clean enough.  The square image here is small and doesn't show the
> discrepancies as much, but once it is increased in size it never lines up
> cleanly. Is there a math formulae to create this?  Is there a name for
> this type of thing?

If I have understood it correctly, this is what you want (see picture 
attached).

The green corner (top-right) is the center of the squares, so that what you 
see are just the lower-left quadrants. The black square is the "old" (and 
smaller) one, with side L, the red square is a larger one (side L+x) laid 
over the black one and rotated.

As it is drawn, the cosine of the angle alpha is (L+x)/(sqrt(2)*L), but 
you're interested in angle beta, which is:

beta = 45 - degrees(acos( (L+x)/(sqrt(2)*L) ))
beta = 45 - degrees(acos( (1+x/L)/sqrt(2) ))

If, as it seems, you want to make the squares smaller and smaller, just 
substitute L+x -> L and L -> L-x:

beta = 45 - degrees(acos( L/(sqrt(2)*(L-x)) ))

... unless I've made a mistake...

-- 
light_source{9+9*x,1}camera{orthographic look_at(1-y)/4angle 30location
9/4-z*4}light_source{-9*z,1}union{box{.9-z.1+x clipped_by{plane{2+y-4*x
0}}}box{z-y-.1.1+z}box{-.1.1+x}box{.1z-.1}pigment{rgb<.8.2,1>}}//Jellby


Post a reply to this message


Attachments:
Download 'sample.gif' (11 KB)

Preview of image 'sample.gif'
sample.gif


 

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