[Kangaroo] How to avoid points to be merged

Hi everyone,

I’m playing with a mesh and is been very complicate to be able to simulate, starting from the original mesh point locations, a kangaroo simulation that simulates independently strips along that mesh. I have those strips as separated meshes as input in several goals components but it seams that Kangaroo combine all their points in the calculation state so the strips behave as a single linked mesh and not independently. I tried to lower the tolerance to 0 (I know, it doesn’t even sound right) and of course it didn’t work. The first capture shows the strip-like shape address running the definition for each strip independently choosing one branch of the data tree at a time. The second capture (in red) shows what happen if you supply the data tree with one strip per branch to Kangaroo.

Is there any way to ensure that those strips are simulated independently?

BTW, in mesh tools in kangaroo the component HingePoints doesn’t seam to work.Nothing is returned no matter what mesh as input is supplied.

Cheers.
Kind Regards.

Hi Angel,

With the Kangaroo components, points closer than the tolerance distance will always be merged. Also the input data is always flattened, so putting the strips on separate branches will not get around this.

However, if you call the solver from a script you can get around this.
Here is an example script that calls the solver without first flattening the input, so you can run each branch as a separate simulation:
separate_branches.gh (13.8 KB)

Also - for a quick and hacky workaround, you can scale or offset the vertices by some miniscule amount, and set the tolerance to 0.

1 Like

Hi Daniel,

Thanks a lot for your fast reply. It suit perfectly my issue. I have to say that I tried the 0 tolerance thing but it didn’t work very well with the solver stability (probably to tiny offsets?). Anyway I will go with the script approach is cleaner and gives me more control over the model.

Thanks again!
Cheers.

If anyone wants Daniel code in python, find it pasted below.

import clr
from System.Collections.Generic import List

clr.AddReference('KangarooSolver.dll')

import KangarooSolver as ks
import System

PS = ks.PhysicalSystem()
PS.Restart()
tol = 0.0001
goalList = List[ks.IGoal]()

for g in x:
    
    PS.AssignPIndex(g,tol)
    goalList.Add(g)
    
counter = 0
threshold = 1e-10

while counter < 1000:
    PS.Step(goalList,False,threshold)
    if PS.GetvSum() < threshold or len(x) == 0:
        break
    counter += 1

A = PS.GetOutput(goalList)
B = counter
2 Likes