flcc Posted June 20, 2021 Share Posted June 20, 2021 (edited) Hi guys, I try to carve an infinite golden Spiral. The final goal is to make an infinte zoom. The spiral is build recursively in a for-loop. Then I create some groups to carve each "iteration" successively. This is where I get stuck. I can almost do it but I don't know how to keep the state of the shapes that have been already carved. Don't know how to explain better. There is a file if some want to take a look. I have tried different solutions including another forloop, but don't find the solution for now. InfiniteSpiralCarve.hipnc Edited June 20, 2021 by flcc Quote Link to comment Share on other sites More sharing options...
Librarian Posted June 20, 2021 Share Posted June 20, 2021 hm If we can make somehow in the loop prim-length and measure together .. void adjustPrimLength(const int geo, prim; const float currentlength, targetlength) { float diff = targetlength - currentlength; int points[] = primpoints(geo, prim); if(diff > 0) { vector posA = point(geo, "P", points[-2]); vector posB = point(geo, "P", points[-1]); vector posC = diff * normalize(posB-posA) + posB; int ptnum = addpoint(geo, posC); addvertex(geo, prim, ptnum); } else if(diff < 0) { vector lastpos = 0; float length = 0; int cut = 0; foreach(int idx; int pt; points) { vector pos = point(geo, "P", pt); if(idx > 0 && !cut) { float seglength = distance(pos, lastpos); if(length+seglength > targetlength) { float frac = (targetlength-length)/seglength; vector newpos = lerp(lastpos, pos, frac); int ptnum = addpoint(geo, newpos); for(int i=idx; i<len(points); i++) removepoint(geo, points[i]); addvertex(geo, prim, ptnum); break; } length += seglength; } lastpos = pos; } #include <groom.h> adjustPrimLength(0, @primnum, @perimeter, @perimeter*chf("dist")); @Aizatulin when he Have Time ...he have those vex-tricks and knowledge in the Little Finger @flcc I'm also interested in this .... 1 Quote Link to comment Share on other sites More sharing options...
Aizatulin Posted June 20, 2021 Share Posted June 20, 2021 Hi, is this coming close to what you are trying to achieve? InfiniteSpiralCarve_mod.hipnc 2 1 Quote Link to comment Share on other sites More sharing options...
flcc Posted June 20, 2021 Author Share Posted June 20, 2021 (edited) @Aizatulin Thank you very much Perfect, this is exactly what I was looking for. I understand what you did but I don't think I could have done it by myself. I'm not very comfortable with for loops. I would have had a hard time doing it this way since, since I didn't even think of using my class attribute in the piece attribute field of the block end. But now I got it ! Ahah @Librarian Thanks Tesan, it seems interesting, but I prefer a solution close to what I had already tried to implement. But I'll take a look once I'm not in the rush anymore. Edited June 20, 2021 by flcc 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.