threepipe
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789
  1. import {MathUtils, Vector2} from 'threepipe'
  2. export const computeFocalLengths = (width: number, height: number, fov: number, aspect: number, dpr: number) => {
  3. const fovRad = MathUtils.degToRad(fov)
  4. const fovXRad = 2 * Math.atan(Math.tan(fovRad / 2) * aspect)
  5. const fy = dpr * height / (2 * Math.tan(fovRad / 2))
  6. const fx = dpr * width / (2 * Math.tan(fovXRad / 2))
  7. return new Vector2(fx, fy)
  8. }