Function buildBoxLinesGeometry

  • Creates a box-shaped wireframe geometry.

    This function generates the geometry arrays required for a box mesh in a wireframe style, consisting of line segments. The box's size and position can be customized by adjusting the half-sizes along the X, Y, and Z axes, as well as the center position. It returns the geometry arrays, including vertex positions and indices for the wireframe lines.

    const wireframeGeometry = buildBoxLinesGeometry({
    center: [0, 0, 0], // Center of the box
    xSize: 2, // Half-size along the X-axis
    ySize: 1, // Half-size along the Y-axis
    zSize: 1.5 // Half-size along the Z-axis
    });

    Parameters

    • cfg: { center?: FloatArrayParam; xSize?: number; ySize?: number; zSize?: number } = ...

      Configurations for the box wireframe geometry.

      • Optionalcenter?: FloatArrayParam

        The center of the box in 3D space, default is the origin [0, 0, 0].

      • OptionalxSize?: number

        Half-size of the box along the X-axis. The default value is 1.0.

      • OptionalySize?: number

        Half-size of the box along the Y-axis. The default value is 1.0.

      • OptionalzSize?: number

        Half-size of the box along the Z-axis. The default value is 1.0.

    Returns GeometryArrays

    The geometry arrays for a box wireframe, including positions and indices for the wireframe.

    If any of the sizes (xSize, ySize, or zSize) are negative, the function automatically inverts the sizes and logs a warning.