Skip to main content

Overview

The Wedge class creates 3D wedge shapes (triangular prisms). A wedge is defined by its center point, width, height, and depth, creating a geometric shape with a rectangular base and a triangular cross-section.

Constructor

IWedgeOptions

ogid
string
Unique identifier for the wedge. Auto-generated if not provided.
center
Vector3
required
Center point of the wedge in 3D space.
width
number
required
Width of the wedge base along the X-axis.
height
number
required
Height of the wedge along the Y-axis.
depth
number
required
Depth of the wedge along the Z-axis.
color
number
required
Hexadecimal color value for the wedge.

Methods

setConfig()

Updates the wedge configuration and regenerates geometry.
Example:

getBrepData()

Returns the B-Rep (Boundary Representation) data as a parsed JSON object.
Example:

generateGeometry()

Regenerates the THREE.js geometry from the current configuration. Called automatically after setConfig().

discardGeometry()

Disposes of the current geometry to free memory.

Properties

ogid
string
Unique identifier for the wedge instance.
options
IWedgeOptions
Current wedge configuration.
color
number
Get or set the wedge color.
outline
boolean
Enable or disable outline rendering for the wedge edges.
outlineMesh
THREE.Line | null
Reference to the outline mesh if outline is enabled.

Usage Examples

Basic Wedge

Ramp or Slope

Wedge with Outline

Roof Section

Array of Wedges

Implementation Details

Geometry Structure

A wedge consists of 6 vertices forming 5 faces:
  • 1 rectangular bottom face
  • 2 triangular end faces (front and back)
  • 2 rectangular side faces (left and right)
Rust Implementation: /workspace/source/main/opengeometry/src/primitives/wedge.rs:67-113

Face Topology

The wedge has 5 faces with specific vertex indices: Source: /workspace/source/main/opengeometry/src/primitives/wedge.rs:108-112

Material Configuration

Wedges use MeshStandardMaterial with transparency: Source: /workspace/source/main/opengeometry/src/shapes/wedge.ts:82-86

Triangulation

Quadrilateral faces are automatically triangulated for rendering: Source: /workspace/source/main/opengeometry/src/primitives/wedge.rs:125-146

Best Practices

Orientation: The wedge’s sloped edge runs from the top-left to bottom-right when viewed from the front. Rotate the wedge mesh for different orientations.
Non-Zero Dimensions: All dimensions (width, height, depth) must be greater than zero. Zero or negative values will cause rendering issues.
Use Cases: Wedges are ideal for creating ramps, roof sections, staircases, and architectural slope elements.

Geometric Properties

Vertex Count

6 vertices

Edge Count

9 edges

Face Count

5 faces (2 triangular, 3 quadrilateral)

Volume

The volume of a wedge is:

Live Demo

Wedge Demo

Try the Wedge shape in the browser

See Also

Cuboid

Rectangular boxes

Polygon

2D triangular shapes

Sweep

Custom extrusions
Last modified on March 14, 2026