Minimal { x, y, z, w } shape that 4D math methods accept
{ x, y, z, w }
Any plain object with these four numbers can be passed in place of a full Vector4.
const p: PointData4D = { x: 1, y: 2, z: 3, w: 1 };const v4 = new Vector4();v4.copyFrom(p); Copy
const p: PointData4D = { x: 1, y: 2, z: 3, w: 1 };const v4 = new Vector4();v4.copyFrom(p);
Fourth component, by convention 1 for a position and 0 for a direction
1
0
const behindCamera = clip.w <= 0; Copy
const behindCamera = clip.w <= 0;
The x component
const clip = new Vector4(point.x, point.y, point.z, 1).applyMatrix4(camera.viewProjection);const screenX = clip.x / clip.w; Copy
const clip = new Vector4(point.x, point.y, point.z, 1).applyMatrix4(camera.viewProjection);const screenX = clip.x / clip.w;
The y component
const screenY = clip.y / clip.w; Copy
const screenY = clip.y / clip.w;
The z component
const depth = clip.z / clip.w; Copy
const depth = clip.z / clip.w;
Minimal
{ x, y, z, w }shape that 4D math methods acceptAny plain object with these four numbers can be passed in place of a full Vector4.
Example