OffAxisProjection.symmetric constructor

OffAxisProjection.symmetric({
  1. double fovRadiansY = 45 * degrees2Radians,
  2. double aspectRatio = 1.0,
  3. double near = 0.1,
  4. double far = 1000.0,
})

The frustum a PerspectiveProjection of fovRadiansY rendered at aspectRatio has, for a symmetric view through this class.

Implementation

factory OffAxisProjection.symmetric({
  double fovRadiansY = 45 * degrees2Radians,
  double aspectRatio = 1.0,
  double near = 0.1,
  double far = 1000.0,
}) {
  final up = tan(fovRadiansY * 0.5);
  final right = up * aspectRatio;
  return OffAxisProjection(
    tanLeft: -right,
    tanRight: right,
    tanDown: -up,
    tanUp: up,
    near: near,
    far: far,
  );
}