Since the cross product of p1, p2, and p1, p3 are already computed earlier for the n_0 and n_1, this value could be reused for computing partial_n_*_per_partial_p_*.
This won't drastically improve the performances but I noticed while profiling that cross product represents 11% of the time spent in my simulation.
Like for https://github.com/yuki-koyama/elasty/issues/14, it improves performances but impacts code readability.
While running some experiments with bending constraints I noticed some missed optimizations due to
calc_grad_of_normalized_cross_prod_wrt_*
:https://github.com/yuki-koyama/elasty/blob/67c7a15c1483fe1979b8b3af64be4f34e110c760/src/constraint.cpp#L110-L119
Since the cross product of p1, p2, and p1, p3 are already computed earlier for the
n_0
andn_1
, this value could be reused for computingpartial_n_*_per_partial_p_*
.This won't drastically improve the performances but I noticed while profiling that cross product represents 11% of the time spent in my simulation. Like for https://github.com/yuki-koyama/elasty/issues/14, it improves performances but impacts code readability.