webgpu-utils

    Function createDiscVertices

    • Creates disc vertices. The disc will be in the xz plane, centered at the origin. When creating, at least 3 divisions, or pie pieces, need to be specified, otherwise the triangles making up the disc will be degenerate. You can also specify the number of radial pieces stacks. A value of 1 for stacks will give you a simple disc of pie pieces. If you want to create an annulus you can set innerRadius to a value > 0. Finally, stackPower allows you to have the widths increase or decrease as you move away from the center. This is particularly useful when using the disc as a ground plane with a fixed camera such that you don't need the resolution of small triangles near the perimeter. For example, a value of 2 will produce stacks whose outside radius increases with the square of the stack index. A value of 1 will give uniform stacks.

      Parameters

      • params: {
            divisions?: number;
            innerRadius?: number;
            radius?: number;
            stackPower?: number;
            stacks?: number;
        } = {}
        • Optionaldivisions?: number

          Number of triangles in the ground plane (at least 3). Default = 24

        • OptionalinnerRadius?: number

          Default = 0

        • Optionalradius?: number

          Radius of the ground plane. Default = 1

        • OptionalstackPower?: number

          Power to raise stack size to for decreasing width. Default = 1

        • Optionalstacks?: number

          Number of radial divisions. Default = 1

      Returns Arrays

      The created vertices.

    MMNEPVFCICPMFPCPTTAAATR