pygfx.geometries.box_geometry

pygfx.geometries.box_geometry(width=1, height=1, depth=1, width_segments=1, height_segments=1, depth_segments=1)

Generate a box (rectangular cuboid).

Creates a box (a rectangular cuboid) of the given size that is centered around the local frame’s origin. Faces may be subdivided by specifying the number of segments along each axis. This will result in all faces parallel to the given axis to be evenly divided into the requested number of segments.

Parameters:
  • width (int) – Size along the x-axis.

  • height (int) – Size along the y-axis.

  • depth (int) – Size along the z-axis.

  • width_segments (int) – Number of segments along x-axis.

  • height_segments (int) – Number of segments along y-axis.

  • depth_segments (int) – Number of segments along z-axis.

Returns:

box – A geometry object containing the requested box shape. Mathematically, it consists of a set of open orientable manifolds.

Return type:

Geometry

Examples

Use gfx.show

Use gfx.show

Hello World

Hello World

Lights

Lights

Offscreen Rendering

Offscreen Rendering

Clipping Planes

Clipping Planes

Hello text

Hello text

Orbit Camera

Orbit Camera

Use gfx.show to show a Scene

Use gfx.show to show a Scene

Geometry Cubes

Geometry Cubes

Transform Control without Matrix Updating

Transform Control without Matrix Updating

Gizmo to transform world objects

Gizmo to transform world objects

Stats helper (Manual)

Stats helper (Manual)

Color Picking

Color Picking

Directional Shadow 1

Directional Shadow 1

Mesh Slice Material

Mesh Slice Material

Scene Overlay

Scene Overlay

Text snake

Text snake

Subplots 1

Subplots 1

Use a Skybox

Use a Skybox

Nested Scenes

Nested Scenes

Types of Cylinders

Types of Cylinders

Mesh Picking

Mesh Picking

Directional Shadow 2

Directional Shadow 2

Multi-Object Selection

Multi-Object Selection

Spotlight Shadow

Spotlight Shadow

Box Geometry

Box Geometry

Depth Overlay 2

Depth Overlay 2

Depth Overlay 1

Depth Overlay 1

Light and Shadow

Light and Shadow

Volume and Volume Slice Rendering

Volume and Volume Slice Rendering

Simple Cube with WX

Simple Cube with WX

Simple Cube with Qt

Simple Cube with Qt

GPU selection

GPU selection

Two Canvases

Two Canvases

Reactive rendering loop

Reactive rendering loop