|
![](/i/fill.gif) |
Dan Johnson wrote:
>
> Tor Olav Kristensen wrote:
>
> > Dan Johnson wrote:
> > >
> > > #macro Arrange_3d (A,B,C,N)
> > > ( (mod(N+A-1,A))*x + (B-mod(div(N+A-1,A)+B-1,B))*y +
(mod(div(N+B*A-1,B*A)+C-1,C))*z -<A-1,B+1,C-1>/2)
> > > #end // use only natural numbers aka 1,2,3,4,5,6... no fractions 0 or negative
numbers
> > >...
>
>...
> I think it took me three days to figure out how to make that macro work. After that
I didn't want to look at it anymore. Do you
> understand what it does, and how?
Yes, I understand what it does.
And now I also understand what's going on.
I think this macro is a clever idea !
> This function started when I made my fist cube out of cylinders, and I looked at the
resulting points.
> <0,0,0>
> <0,0,1>
> <0,1,0>
> <0,1,1>
> <1,0,0>
> <1,0,1>
> <1,1,0>
> <1,1,1>
>
> Hmm binary. So I made a little macro based on base10 to binary conversion.
>
> //macro Cube_points returns a vector for a corner of a cube given an integer 1-8
periodic after 8
> #macro Cube_points (N)
> (mod(N,2)*2*z + mod(div(N+1,2),2)*2*y + mod(div(N+3,4),2)*2*x -1)
> #end
Of course I have to "twist" your code a little bit ;)
<mod(div(N + 3, 4), 2), mod(div(N + 1, 2), 2), mod(N, 2)>*2 - <1, 1, 1>
Hmmm... so it would go on like this:
mod(div(N + (2^0 - 1), 2^0), 2) -> mod(div(N + 0, 1), 2) -> mod(N, 2)
mod(div(N + (2^1 - 1), 2^1), 2) -> mod(div(N + 1, 2), 2)
mod(div(N + (2^2 - 1), 2^2), 2) -> mod(div(N + 3, 4), 2)
mod(div(N + (2^3 - 1), 2^3), 2) -> mod(div(N + 7, 8), 2)
mod(div(N + (2^4 - 1), 2^4), 2) -> mod(div(N + 15, 16), 2)
...
> Then I realized that it could be made much more versatile, and I set out to make a
cubic lattice of any dimensions. Since the
> order of placement was still based on my binary algorithm it arranged things in a
way people don't usually think. I changed
> things around until it went left to right, top to bottom, front to back ( like a
book). The arrange 3d function is the result.
>
> More recently I figured out that it could be made even more versatile. I could do
things like have three in one row, and four in
> the next, and continue alternating. I think I may be able to make a macro that will
spit out the coordinates of icosahedron
> vertexes. That would go a long way towards simplifying the process of making an 8
frequency geodesic dome.
If you manage to do that (or even if you come close)
then please post your results !
--
Best regards,
Tor Olav
mailto:tor### [at] hotmail com
http://www.crosswinds.net/~tok/tokrays.html
Post a reply to this message
|
![](/i/fill.gif) |