TorsionSketch

Copyright © 2026 Massachusetts Institute of Technology (MIT).

Author: Theron Guo.

Funding: ONR Grant N000142312573 and MIT Department of Mechanical Engineering.

README: How To Use TorsionSketch

TorsionSketch estimates the torsional rigidity of a 2D cross‑section. You draw a shape, the app converts it into a signed distance field (SDF), and a neural network uses the SDF to predict torsional rigidity.

Quick workflow

  1. Draw a closed shape in the left panel (free draw or vertex mode).
  2. Set the Grid Spacing (distance between grid points in each direction) and Grid Size (number of grid points in each direction).
  3. Check the SDF preview.
  4. Review the area, perimeter, and predicted torsional rigidity.
  5. The sentinel value is scale-independent and internally used for the prediction.

Coordinates and grid

  • Cursor coordinates are shown relative to the canvas center (0, 0).
  • To avoid corner/boundary artifacts, avoid placing points in the immediate vicinity of the sketch-canvas boundary.
  • The grid slider sets the Grid Size (number of grid points in each direction).
  • For the SDF, the drawn shape is automatically centered and scaled to a fixed area; extreme aspect ratios may affect accuracy.

Prediction accuracy

  • The model predicts the scale-independent sentinel, defined as (torsional rigidity × perimeter²) / area³, and then the torsional rigidity.
  • The model was trained and tested on many cross sections, including ellipses, rectangles, triangles, I-, L-, C-shaped sections, polygons, and star‑shaped geometries.
  • Average relative error: 0.9%. Maximum error: 20.5%. R²: 0.992.
Prediction accuracy and R² score plot.
Figure 1. Predicted over True Sentinel Values.
Log relative error distribution.
Figure 2. Log Relative Error Distribution.

Gallery

CaseSentinel PredictionSentinel ExactRelative Error
Disk1.9992.0000.050%
Square2.2492.2500.044%
Equilateral triangle2.3962.4000.167%
Right isosceles triangle2.4312.4200.455%
CaseSentinel PredictionSentinel Quasi-Exact*Relative Error
I-beam1.5921.5830.581%
L-beam1.5831.5970.864%
C-beam1.5061.5211.019%
Polygon arrow notch2.3242.2831.779%
Polygon wedge3.0133.2527.360%
Star five point2.1232.1160.319%
Star mixed modes A2.1642.1670.165%
Star mixed modes B2.4942.4720.890%

*Here Quasi-Exact refers to a finite element calculation on a fine mesh. The error | Prediction - Exact | is typically dominated by the neural network contribution; therefore, | Prediction - Quasi-Exact | differs negligibly from | Prediction - Exact |. Mesh convergence was verified using uniform mesh refinement and (conservative) extrapolation a posteriori error estimators: we can conclude that |Quasi-Exact - Exact|/|Quasi-Exact| is below 0.05%.

Draw

SDF

Torsional Rigidity:
Perimeter:
Area:
Sentinel: