project method

Offset? project(
  1. List<double> rotation,
  2. List<double> worldDirection
)

Projects a world direction (East, North, Up) seen with the attitude rotation to a screen point, or null when it is behind the camera.

Implementation

Offset? project(List<double> rotation, List<double> worldDirection) {
  final v = ArRotation.multiplyVector(rotation, worldDirection);
  // The camera looks along -z: anything at z >= 0 is behind or beside it.
  final depth = -v[2];
  if (depth <= 1e-6) return null;
  return Offset(
    width / 2 + focalLength * v[0] / depth,
    height / 2 - focalLength * v[1] / depth,
  );
}