directionOf static method

(double, double, double) directionOf(
  1. int face,
  2. double s,
  3. double t
)

The direction (not normalized) a face's texel at s, t (0–1, s along a row, t down the rows) stands for.

Implementation

static (double, double, double) directionOf(int face, double s, double t) {
  final a = 2 * s - 1, b = 2 * t - 1;
  return switch (face) {
    0 => (1.0, -b, -a),
    1 => (-1.0, -b, a),
    2 => (a, 1.0, b),
    3 => (a, -1.0, -b),
    4 => (a, -b, 1.0),
    _ => (-a, -b, -1.0),
  };
}