POV-Ray : Newsgroups : povray.binaries.animations : Kochcurve3D(?) : Re: Kochcurve3D(?) Server Time
2 Nov 2024 15:23:23 EDT (-0400)
  Re: Kochcurve3D(?)  
From: Tom Bates
Date: 2 Dec 2001 17:38:08
Message: <3c0aad50@news.povray.org>
Jan Walzer wrote:
> Anders Haglund did some days ago something with a regular kochcurve in
POV,
> and as he said, he wanted to do it in 3d, but didn't know how ...
>
> I got the idea, to apply the algorithm to a regular triangle, dividing it
> into 6 triangles, greating one peak ...
>
> it looked nice, so I did it with a tetraedron ...
>
> the shape is no longer something lige a snowflake, but it converges
against
> the shape of a cube ...
>
> it's a pity, that my simplest math left me, when I tried, to make the
sides
> of the trianles equal ...
> Thats the reason(I think), why it looks like a distorted cube, and why it
> doesn't loop correctly...
>
> somewhere there must be some mistake...
> Can anyone spot, where I got wrong ?
>
> 1)
> the points of a regular tetraedron can have the following coordinates
>
> #declare h=sqrt(3/4);
> #declare p1=<   0,-1/3*h, 2/3>;
> #declare p2=< 1/2,-1/3*h,-1/3>;
> #declare p3=<-1/2,-1/3*h,-1/3>;
> #declare p4=<   0, 2/3*h,   0>;

Your geometry is close, but not quite.  Try this:

#declare h1 = sqrt(1/2);
#declare h2 = sqrt(3/4);
#declare p1=<   0,-1/3*h1, 2/3*h2>;
#declare p2=< 1/2,-1/3*h1,-1/3*h2>;
#declare p3=<-1/2,-1/3*h1,-1/3*h2>;
#declare p4=<   0, 2/3*h1,   0>;

or, even simpler (although in a different orientation):

#declare p1=< 1, 1, 1>;
#declare p2=< 1,-1,-1>;
#declare p3=<-1, 1,-1>;
#declare p4=<-1,-1, 1>;

>
> 2)
> to calculate the top of the new pyramid that I create on a triangle,
> I use the following:
> (I assume, if I'd use a "real" regular triangle, it could be simplified)
>
> p1,p2,p3 are now the points of the triangle, to be subdivided...
> p4 is the new point at the top of the pyramid..
>
> #local a=vlength(p2-p1);
> #local b=vlength(p3-p2);
> #local c=vlength(p1-p3);
> #local
n=vnormalize(vcross(p2-p1,p3-p1))*sqrt(a^2-(sqrt(b^2-(c/2)^2)/3)^2);
>
> #local p4=(p1+p2+p3)/3+n/3;

Assuming that, now, you have a truly regular tetrahedron, then a=b=c.
But, in case we're off a bit, we could average them.
so,
#local a=vlength(p2-p1);
#local b=vlength(p3-p2);
#local c=vlength(p1-p3);
#local h=(a+b+c)/3 * sqrt(1/2);

#local n=vnormalize(vcross(p2-p1,p3-p1));

#local p4=(p1+p2+p3)/3 + n*h;

>
> 3)
> if I rotate a regular tetraedron, resting on the floor, by
>
> rotate <0,120*clock,360*clock>
>
> Shouldn't it perfectly loop ?

It should.  Try it again with the new geometry.

>
> Can anyone spot the mistakes I did ? ...
>
> Any other comments ?
>
>
> --
> Jan Walzer <jan### [at] lzernet>
>
>

Tom Bates.


Post a reply to this message

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