POV-Ray : Newsgroups : povray.general : At wits' end Server Time
13 Jun 2024 22:05:16 EDT (-0400)
  At wits' end (Message 21 to 24 of 24)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Anthony D  Baye
Subject: Re: At wits' end
Date: 14 Mar 2016 20:05:01
Message: <web.56e7512c509d798cfd6b6fe10@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> "Anthony D. Baye" <Sha### [at] spamnomorehotmailcom> wrote:
>
> > don't worry about it. I can be a little sensitive.
>
> It's OK - I understand.
> Didn't mean to step on any toes.
> Glad it's working out for you though.
>
> Believe it or not, someone was asking me about where to get lots of equilateral
> triangles to make some tetra and octahedrons, and I found this looking for
> "triangular tiles"
>
> http://mathafou.free.fr/themes_en/fractzoo.html
>
> Scroll down a little more than halfway to "FlowSnake"
> More math. Less geometry   :)

you could make a model and then have it 3D printed.  Don't know what the cost
would be.

Regards,
A.D.B.


Post a reply to this message

From: scott
Subject: Re: At wits' end
Date: 15 Mar 2016 03:43:47
Message: <56e7bd33@news.povray.org>
> I've tried that. I get "too many nested symbol tables"

Odd, I wrote it like that to test out the math I posted yesterday and it 
worked fine. The complete code is copy & pasted below (I just tried it 
with 10 recursion depth and it's fine - higher maybe work too but I ran 
out of patience waiting for it to parse).

The non-recursive version could just have an array of points (start with 
just two). Each time you run the macro it would create a new array, and 
for each pair of points in the input array create 3 new points in the 
output array. You'd then use that output array as the input for the next 
call...

------


#version 3.7;

global_settings { assumed_gamma 1.8 }

#include "colors.inc"
#include "math.inc"

light_source { <0.0, 0.0, -10.0> rgb 1 }

camera {
  perspective
  location <0.0, 0.0, -10.0>
  up y
  right x*(image_width/image_height)
  look_at <0.0, 0.0, 0.0>
  }

#default {
     pigment { Orange }
     finish { ambient 0 diffuse 0.7 }
     }

#macro vec2rot(V, A)
     #local _X_ = V.u*cos(A) - V.v*sin(A);
     #local _Y_ = V.u*sin(A) + V.v*cos(A);
     #local RESULT = <_X_,_Y_>;
     RESULT
#end

#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

#declare TH = degrees(asin(sqrt(3)/(2*sqrt(7))));
#declare L = 6.0/sqrt(7);
#debug concat("L: " str(L,0,6) "\n")

#declare pA = <-3,0>;
#declare pB = <3,0>;

gosper_axiom(pA,pB,10)


Post a reply to this message

From: Bald Eagle
Subject: Re: At wits' end
Date: 15 Mar 2016 09:50:00
Message: <web.56e811e2509d798c5e7df57c0@news.povray.org>
It doesn't look like you ever decrement N once you enter the macro.
You CHECK #if(N>=0), but it doesn't look like you ever CHANGE N.

But then again I just woke up and coffee #1 has hardly been sipped yet.  :O

I chose to keep N>0, simply because I was using it move things around, and
because I was using it as my denominator for changing HSV values for the
different levels.

I've actually taken to using for loops rather than while loops lately - just too
stupid and inattentive at time to add that critical var=var+1 thing, and the
next thing I know POV is eating up every petabyte of memory in the metropolitan
area.
"Why is this tiny little scene taking so long to parse?"  ....   duh.

I've gotten into the habit of typing #for #end, or #if #end, and THEN filling in
the middle.   Even then I don't always avoid mind-bending debugging disasters.
;)


Post a reply to this message

From: scott
Subject: Re: At wits' end
Date: 15 Mar 2016 12:56:20
Message: <56e83eb4$1@news.povray.org>
> It doesn't look like you ever decrement N once you enter the macro.
> You CHECK #if(N>=0), but it doesn't look like you ever CHANGE N.

I do it in the call to the next one:

gosper_axiom(p0,np1,N-1)

> But then again I just woke up and coffee #1 has hardly been sipped yet.  :O

OK I'll let you off :-)


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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