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

Types of Cylinders

Types of Cylinders

Geometry Cubes

Geometry Cubes

Gizmo to transform world objects

Gizmo to transform world objects

Stats helper (Manual)

Stats helper (Manual)

Directional Shadow 1

Directional Shadow 1

Directional Shadow 2

Directional Shadow 2

Spotlight Shadow

Spotlight Shadow

Transform Control without Matrix Updating

Transform Control without Matrix Updating

Mesh Slice Material

Mesh Slice Material

Morph Targets

Morph Targets

Multi-Object Selection

Multi-Object Selection

Color Picking

Color Picking

Mesh Picking

Mesh Picking

Nested Scenes

Nested Scenes

Scene Overlay

Scene Overlay

Subplots 1

Subplots 1

Use gfx.show to show a Scene

Use gfx.show to show a Scene

Use a Skybox

Use a Skybox

Text snake

Text snake

Clipping Planes

Clipping Planes

Hello World

Hello World

Hello text

Hello text

Lights

Lights

Offscreen Rendering

Offscreen Rendering

Orbit Camera

Orbit Camera

Use gfx.show

Use gfx.show

Simple Cube with Qt

Simple Cube with Qt

Simple Cube with WX

Simple Cube with WX

GPU selection

GPU selection

High resolution screenshot

High resolution screenshot

Full-Screen Post Processing 1

Full-Screen Post Processing 1

Fullscreen Postprocessing 2

Fullscreen Postprocessing 2

Reactive rendering loop

Reactive rendering loop

Showing CPU usage in the title bar

Showing CPU usage in the title bar

Two Canvases

Two Canvases

Box Geometry

Box Geometry

Depth Overlay 1

Depth Overlay 1

Depth Overlay 2

Depth Overlay 2

Light and Shadow

Light and Shadow

Validate transforms

Validate transforms

Volume and Volume Slice Rendering

Volume and Volume Slice Rendering