Linear Interpolate parametric Array Like Para3d in 3dmax

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

Sample mechanism in Para3d:



my c#script in Grasshopper:


C# Code

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;
  }
}

interpolate box.gh (213.5 KB)

This C# … well … what supposedly does? Anyway you want that thing fixed or what?

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).


Ok it is great but my goal isn’t voxel
It is parametric interpolation array in separate geometries

This means prior the translation(s) you want Voxels (acc user x/y/z res) out of objects? (Breps/Meshes/Cats/Dogs etc).

BTW: Plans changed. I would be near a computer (with various similar C# Methods available) tomorrow (or Wednesday max).

Yes Thank’s

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.



In sample of para3d the object should not never intersect together
In this your example code maybe point3d overlap? Or box intersecting?

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).

image

I don’t think so

He means “in the perfect solution” I guess

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!

1 Like

Indeed.

That said: why someone should care about flying Voxels ? (I hate Voxels). What about some artistic (LOL) stuff related with Ducatis (*)?

(*) forget that 999 (ugliest thing ever or what?)

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

1 Like

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 %)

1 Like

Very good suggestions tween from multi list to reference box in Range?

Get the Voxel part (use any valid 3d Mesh List).

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).

Voxels_ForAmateurs_Public_V1.gh (123.4 KB)

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.