wag method
Implementation
void wag(
{Vector3 direction = RIGHT,
Vector3 axis = DOWN,
double wagFactor = 1.0}) {
for (var mob in getFamilyWithPoints()) {
var points = Array(values: [for (var pt in mob.points) pt.toList()]);
var alphas = points.matMul(axis.toArray());
var minAlpha = alphas.values[0].reduce((acc, elem) => min(acc, elem));
var maxAlpha = alphas.values[0].reduce((acc, elem) => max(acc, elem));
alphas -= Array.fromValue(minAlpha, shape: alphas.shape);
alphas /= Array.fromValue(maxAlpha, shape: alphas.shape);
alphas = alphas.map((value, pos) => pow(value, wagFactor).toDouble());
var wagMove = alphas.matMul(direction.toArray(row: true));
mob.points.map((pt) => pt + wagMove);
}
}