Skip to content
thread3dPublic

About

A flimsy excuse to play with Quaternions

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

3D Bouncer

A WPF application that renders text as 3D geometry and bounces it inside a translucent cube.

3D Bouncer WPF HelixToolkit

Overview

Enter any text and watch it come alive as a 3D object bouncing around inside a translucent cube. The application offers three control modes to suit your preference:

  • Automatic — Physics-based animation with realistic bouncing and rotation
  • User — Direct control over position and orientation via sliders
  • Mixed — Physics simulation with user-defined offsets

Features

  • 3D Text Rendering — Text is converted to extruded 3D geometry using WPF's FormattedText API
  • Physics Simulation — Velocity, collision detection, and angular momentum
  • Rendering Modes — Choose between solid fill, wireframe, or point cloud visualization
  • Real-time Controls — Adjust position, rotation, speed, and more while the simulation runs
  • Smooth Animation — Frame-synchronized rendering via CompositionTarget.Rendering

Quick Start

# Build and run
dotnet run --project src/3dBouncer.csproj

# Or use the solution
dotnet run --project src/3dBouncer.sln

Requires .NET 8.0 SDK and Windows.

Controls

Control Description
Text Input Enter text to render (click "Bounce!" to apply)
Change Color Randomize the text color
Speed Slider Animation speed (0.1x to 10x)
Position (X/Y/Z) Translate the text along each axis
Rotation (Pitch/Roll/Yaw) Rotate the text around each axis
Triangle Size Subdivision level for mesh quality
Point Count Number of points in point cloud mode
Point Size Size of points in point cloud mode

Rendering Modes

  • Solid Fill — Extruded text with smooth shading
  • Wireframe — Cyan mesh showing the underlying geometry
  • Point Cloud — Scattered points across the text surface

Control Modes

  • Automatic — Pure physics: the text bounces off cube walls with velocity damping
  • User — Sliders directly control position and rotation
  • Mixed — Physics simulation runs, but user offsets are added to the result

Architecture

src/
├── 3dBouncer.csproj    # Project file with HelixToolkit.Wpf dependency
├── 3dBouncer.sln        # Solution file
├── App.xaml             # Application entry point
├── MainWindow.xaml      # UI layout with HelixViewport3D
├── MainWindow.xaml.cs   # All application logic
└── styles.xaml           # UI resource dictionary

Key Implementation Details

  • Text Triangulation — Uses ear clipping algorithm with hole detection via WPF's CombinedGeometry
  • Animation Loop — CompositionTarget.Rendering syncs with display refresh rate
  • Physics — Simple bounds checking with configurable damping factors
  • Rotation — Quaternions via CreateQuaternionFromEulerAngles for smooth 3D rotation

Dependencies

License

MIT

About

A flimsy excuse to play with Quaternions

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages