@ue-too/board / index / convert2WorldSpaceWithTransformationMatrix
関数: convert2WorldSpaceWithTransformationMatrix()
convert2WorldSpaceWithTransformationMatrix(
point,transformationMatrix):Point
定義: packages/board/src/camera/utils/coordinate-conversion.ts:567
Transforms a viewport point to world space using a precomputed transformation matrix. Faster than repeated function calls when transforming many points with the same camera state.
パラメータ
point
Point
Point in viewport coordinates (origin at center)
transformationMatrix
Precomputed transformation matrix from transformationMatrixFromCamera
戻り値
Point
World space coordinates of the point
Remarks
Use this for batch transformations when the camera state is constant:
- Create matrix once with transformationMatrixFromCamera
- Transform many points with this function
This avoids recalculating sin/cos and matrix operations for each point.
例
typescript
// Transform many points efficiently
const matrix = transformationMatrixFromCamera(
{ x: 100, y: 200 },
1.5,
Math.PI / 4
);
const worldPoints = viewportPoints.map(vp =>
convert2WorldSpaceWithTransformationMatrix(vp, matrix)
);参照
transformationMatrixFromCamera to create the matrix