POV-Ray : Newsgroups : povray.general : At wits' end : Re: At wits' end Server Time
18 May 2024 16:13:05 EDT (-0400)
  Re: At wits' end  
From: scott
Date: 14 Mar 2016 12:18:40
Message: <56e6e460$1@news.povray.org>
>> (L/2)^2 = (S/2 + S*sin(30))^2 + (Scos(30))^2
>> (L/2)^2 = (S/2 + S/2      )^2 + 3/4*S^2
>> (L/2)^2 = 7/4 * S^2
>>    L^2    = 7 * S^2
>>    L      = sqrt(7) * S
>
>
> You two seem to have a peculiar (to me) way of going about your trig.
> Either they do it a different and, admittedly, interesting way on "The Other
> Side of The Pond", than we do here in 'Murica, or -
> "We" do it weird, or -
> I just never really learned it very well.
>
> I recall going through something like this puzzling out Friederich Lohmueller's
> pulley/belt calculations with Jerome.
> You pick what, to me, is the least obvious approach.  :D
>
> I'd like to hear and see more about all of this side/2+side*sin(30) business.
> I did it what seems to me a more direct way, but got the same answer. {whew!}
> :)

The problem is, assuming the horizontal distance to be S requires you to 
either know that (I didn't) or figure it out from S/2+Ssin(30) or some 
other geometric method.

I think I did it because I have a habit to start from the minimum 
possible number of assumptions, in this case a hexagon has side length S 
and angle 120 degrees. That's enough information to solve it. I've found 
in past situations that faulty assumptions are often what cause errors, 
so I try not to make them if they are not needed.

> See my updated diagram.   Hopefully it's correct - I haven't yet finished coffee
> #1.
> I'm going to ponder how this gets converted into code, since there's an ever
> increasing number of line segments to be drawn at every next level.

Just get the macro to call itself again (with some countdown to prevent 
going forever):

#macro gosper_axiom(p0, p1,N)
  #if(N>=0)
     cylinder { p0, p1 0.0078125 }
     #local V = p1 - p0;
     #local vT = vnormalize(V);
     #local len = vlength(V);
     #local np1=p0+len/sqrt(7)*vec2rot( vT,asin(sqrt(3)/(2*sqrt(7))));
     #local np2=p1-len/sqrt(7)*vec2rot( vT,asin(sqrt(3)/(2*sqrt(7))));

     gosper_axiom(p0,np1,N-1)
     gosper_axiom(np1,np2,N-1)
     gosper_axiom(np2,p1,N-1)

  #end
#end

Call with eg:

gosper_axiom(<-3,0>,<3,0>,5)


Post a reply to this message

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