Hello friends, I want to create grasshopper code or algorithm for linear interpolation for object array =(eg box) (parameter array) like para3d plugin mechanism in 3dmax, but with regard to object objects, the c# code is very far from others ,…{mechanism=when i move or Scale or Rotate ,..on of box[i] of 1000box Array then other <List>boxes Interpolate linear (Map) to This box[i])
have you any suggestions. to simulate it by KangarooSolver or c#. Better!? Thanks
private void RunScript(
IList<Box> boxes,
Vector3d moveAmount,
int ix,
ref object a)
{
Box referenceBox = boxes[ix]; // Assuming the first box is the reference
List<Box> movedBoxes = new List<Box>();
referenceBox.Transform(Transform.Translation(moveAmount));
movedBoxes.Add(referenceBox);
for (int i = 1; i < boxes.Count; i++)
{
Box newBox = new Box(boxes[i]);
Vector3d movement = new Vector3d(referenceBox.Center-newBox.Center); // Move in X direction
//movement.Unitize();
double t = newBox.Center.DistanceTo(referenceBox.Center) ;
newBox.Transform(Transform.Translation(movement*t*.4));
movedBoxes.Add(newBox);
}
a =movedBoxes;
}
}
I want to better simulation like above video in para3d
I think para3d use custom formula for interpolation an linear control box
But i don’t know that formula
In gh file i send the example that import from 3dmax to reverse engine…
Maybe kangaroo slover is better way to simulation it! @DanielPiker
OK, don’t panic I’ll fix that later (when near to some computer, that is). And what has K2 to do with this?
You want the general case (i.e. any object collection VS any collection of attractors) or just boxes? Or - maybe - you want an “auto voxelation” (LOL) of a given collection?
I want code for any objects
Kangaroo.slover can be pull and push all boxes in forces(vector) and the force can be divide for the per box base in distance form reference box
Hard to see what K2 has to do with that: we are talking elementary maths and elementary C#.
The only thing worth the name is how to avoid passing the “horizon point” (mode Pull - hope that you understand what this means > see mp4: no matter how big your values are … pts would never “overpass” the attractors WHILE never collapse into some sort of “visual” singularity, so to speak).
See the concept against an abstract ortho pts Grid (where pts could be the Voxels centers).
Found some ralated snaps - deform pts and never overpass (pull) … blah, blah. But the classic Methods shown are not a big help for you since you are a C# novice.
Obviously not (nor the “relative” Topology changes - so to speak).
With regard the object related with the point (say some Voxel for this case) an if more is required (i.e. stop the party if a given pt is prox to any other - where prox means pt.DistanceTo(other) > Voxel diagonal).
And … why you are after these freaky things? are you an artist of some sort? (I do hope that you are not an Architect willing to design a building like this).
Surely when there is no rotation, it could work.
I think when the 2nd box is oriented there is something like a Slerp used in order to translate and orient the objects.
I put the Wikipedia link, no offense to you, I know you know this!
Hello
I think you must look at Tween function like implemented in Pufferfish.
An object in a box has coordinate (u, v, w) ranfing to 0 to 1, and lets say you use u as the factor of tween.
Here a factor going to 0 to 1 by 0.1 step
Hmm … but what about some LOL this (and that)? I.e. doing the pts (any N of attractors) then var size Boxes (Point3dList etc etc).
Here’s the deal: I’ll do half the job, then you can add whatever you like (some more art , that is) , then La Biennale di Venezia (Note: we’ll split profits acc a decent 90/10 %)
As a challenge do: mastermind a way to get Voxels taking into account the relative Mesh Box x/y/z sizes (i.e. given a Mesh List … get “as same as possible” Voxels).
BTW: I rather overestimated ETA for my return to practice. I’m on site (meaning big cranes, big heavy trucks, big panic, big chaos … blah, blah) for some Project under construction … meaning that only Karma can tell when … blah, blah.