@pixi/3d
    Preparing search index...

    Interface PointLike4D

    A PointData4D you can also set, copy and compare

    const point: PointLike4D = new Vector4(10, 20, 30, 1);
    point.set(40, 50, 60, 1);

    const other = new Vector4();
    point.copyTo(other);

    const same = point.equals(other); // true
    interface PointLike4D {
        copyFrom: (p: PointData4D) => this;
        copyTo: <T extends PointLike4D>(p: T) => T;
        equals: (p: PointData4D) => boolean;
        set: (x?: number, y?: number, z?: number, w?: number) => this;
        w: number;
        x: number;
        y: number;
        z: number;
    }

    Hierarchy (View Summary)

    Implemented by

    Index
    copyFrom: (p: PointData4D) => this

    Copies x, y, z and w from p

    Type Declaration

    point.copyFrom({ x: 0, y: 1, z: 0, w: 1 });
    
    copyTo: <T extends PointLike4D>(p: T) => T

    Writes this point's x, y, z and w into p

    Type Declaration

      • <T extends PointLike4D>(p: T): T
      • Type Parameters

        Parameters

        • p: T

          The point to copy into

        Returns T

        The given point with values updated

    point.copyTo(previousPoint);
    
    equals: (p: PointData4D) => boolean

    Checks whether x, y, z and w all match p exactly, with no tolerance

    Type Declaration

    const unchanged = point.equals(previousPoint);
    
    set: (x?: number, y?: number, z?: number, w?: number) => this

    Sets all four components

    Type Declaration

      • (x?: number, y?: number, z?: number, w?: number): this
      • Parameters

        • Optionalx: number

          The x component

        • Optionaly: number

          The y component, defaults to x

        • Optionalz: number

          The z component, defaults to x

        • Optionalw: number

          The fourth component, defaults to 1, not to x

        Returns this

    point.set(0, 2, 0);
    direction.set(0, 0, -1, 0);
    w: number

    Fourth component, by convention 1 for a position and 0 for a direction

    const behindCamera = clip.w <= 0;
    
    x: number

    The x component

    const clip = new Vector4(point.x, point.y, point.z, 1).applyMatrix4(camera.viewProjection);
    const screenX = clip.x / clip.w;
    y: number

    The y component

    const screenY = clip.y / clip.w;
    
    z: number

    The z component

    const depth = clip.z / clip.w;