Dan-Piker / K2Goals

Example Goals for use with the Kangaroo2 solver
Other
63 stars 21 forks source link

Hinge Goal affected by triangle size #8

Open tomtachi opened 3 years ago

tomtachi commented 3 years ago

The hinge goal seems make the hinge excessively softer when the triangle is smaller.

This seems to come from two reasons. First, the face normals are not unitized when computing the force Move[]. e.g., Vector3d A = Cross0 D; A = Cross1 D;

Also I believe the following line

double D = AngleError H 0.5;

needs to be inverted and also different for each triangular panel like (although the balance could also depend on the weight of the vertex, the following code assumes Move[] corresponds to the applied force (not force divided by mass)):

double D1 = AngleError / H0 * 0.5;

double D2 = AngleError / H1 * 0.5;

I wanted to test my modification by writing my own C# goal object, but I got caught by some other issue of being unable to update the input variables, so I have not fully yet tested if this fix can fix the thing.

Dan-Piker commented 3 years ago

Hi Tomohiro!

Great to hear from you and thanks for the pointers. This is perfect timing - I was just looking recently at improving this as I'd noticed it is not behaving quite correctly. It currently also doesn't balance angular momentum and some folding simulations have a tendency to start spinning if not anchored.

Move[] in Kangaroo2 is not exactly applied force, but rather for each point affected by that goal, the vectors from the current position to the target position, ideally where the energy becomes zero.

All the Move vectors from the different goals affecting a point are combined in a weighted average, instead of just summed like the forces were in the old solver. This helps avoid overshooting the target, because some goals can be given higher priority than others just by increasing their weighting, without making the movement vector longer, which could cause instability in the old explicit solver. So Move[i]*Weighting[i] should be equal to the Force vector, and if it is it should converge to the same result as the old solver.

Some places where the old force based code used unitized vectors, I found that where goals were simply converted by using the force as the Move vector and keeping the Weighting constant, the goal would converge to the right thing, but in a scale dependent way - so very slowly for large objects and sometimes becoming unstable for small objects. For instance - this was the first attempt at the angle goal: https://github.com/Dan-Piker/K2Goals/blob/master/Angle.cs which I later updated to this, which avoids the unitize step and adjusts the weighting instead, which avoids the problem. https://github.com/Dan-Piker/K2Goals/blob/master/Angle2.cs

Dan-Piker commented 3 years ago

Here's a GH definition for testing changes to the hinge goal https://github.com/Dan-Piker/misc/blob/main/hinge_tests.gh

Dan-Piker commented 3 years ago

Another bending energy I've been looking at as an alternative is the one described in section 5 of https://page.math.tu-berlin.de/~bobenko/papers/2005_Bob.pdf where the distance between circumcentres is used in the weighting. I'm interested if you have any thoughts on how this compares to the one you describe in https://origami.c.u-tokyo.ac.jp/~tachi/cg/ElasticOrigami_Tachi_IASS2013.pdf

tomtachi commented 3 years ago

Here's a GH definition for testing changes to the hinge goal https://github.com/Dan-Piker/misc/blob/main/hinge_tests.gh

Thanks a lot! I will modify this and use for our current project!

tomtachi commented 3 years ago

Another bending energy I've been looking at as an alternative is the one described in section 5 of https://page.math.tu-berlin.de/~bobenko/papers/2005_Bob.pdf where the distance between circumcentres is used in the weighting. I'm interested if you have any thoughts on how this compares to the one you describe in https://origami.c.u-tokyo.ac.jp/~tachi/cg/ElasticOrigami_Tachi_IASS2013.pdf

I took a short look at Bobenko 2005. This uses potential bending energy of E = l/L \theta^2 where l is the length of the edge and L is the "perpendicular dimension".

This form is the same as my model, except that I used L as the harmonic mean or just the mean of triangular heights, while Bobenko uses the distance between centers of circumcenters of triangles.

Although Bobenko's method seem to have rigorous interpretation in the viewpoint of discrete differential geometry, the use of circumcenter might be problematic for ill-shaped triangles.

Kane-BorgMarkkula commented 8 months ago

COM model for hinge objective.zip Hi, I experienced a similar resultant rotation issue when using the hinge objective. In my efforts to solve the issue, I built this model that resolves moments round a center of mass of the 4 points. I would need to evaluate the component forces on all 4 points to convert this into a goal object. @tomtachi had you succeeded in creating a kangaroo goal that has no net rotations and translations?