/
githubmirror
/
pixijs
Обзор
Документация
Войти
/
githubmirror
/
pixijs
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
src/rendering/renderers/shared/geometry/utils/transformVertices.ts
38 строк
1 KB
Zyie
chore: add standard/advanced tags to documentation (#11448)
03 июн 2025, 10:12
Не верифицирован
03 июн 2025, 10:12
7d91234
Код
Авторство
О чём код?
import type { Matrix } from '../../../../../maths/matrix/Matrix'; /** * Transforms the vertices in an array with the given matrix. * @param vertices - the vertices to transform * @param m - the matrix to apply to the vertices * @param offset - the offset of the vertices (defaults to 0) * @param stride - the stride of the vertices (defaults to 2) * @param size - the size of the vertices (defaults to vertices.length / stride - offset) * @category rendering * @internal */ export function transformVertices(vertices: number[], m: Matrix, offset?: number, stride?: number, size?: number) { const a = m.a; const b = m.b; const c = m.c; const d = m.d; const tx = m.tx; const ty = m.ty; offset ||= 0; stride ||= 2; size ||= (vertices.length / stride) - offset; let index = offset * stride; for (let i = 0; i < size; i++) { const x = vertices[index]; const y = vertices[index + 1]; vertices[index] = (a * x) + (c * y) + tx; vertices[index + 1] = (b * x) + (d * y) + ty; index += stride; } }