Prompt specification
Build or customize the Three.js 3D scene "Arch and flat beam comparison" inside the active workspace.
Engineering Constraints:
1. Runtime & Orbit: Use Three.js r160 with OrbitControls (damping enabled) and ACESFilmicToneMapping.
2. Frame Timing: Drive all motion strictly with clock.getDelta() so animation speed is FPS-independent.
3. Viewport Hygiene: Handle window resize cleanly, cap DPR at Math.min(window.devicePixelRatio, 2), and dispose geometries/materials/renderer on unmount.
Scene Metadata:
Scene: Arch and flat beam comparison
Category: Biology & Nature · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/arch-and-flat-beam-comparison-x0982
Scene Description Prompt:
Create a single self-contained HTML file using Three.js from cdnjs that shows the human foot arch. Place an anatomical-inspired arch beside an engineering arch under schematic loads; compare force paths while explicitly stating that living feet are more complex than passive masonry. A 3D cutaway view.
Working Three.js Starter (arch-and-flat-beam-comparison-x0982):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Foot Arch vs. Masonry Arch — 3D Load-Path Study</title>
<style>
:root {
color-scheme: dark;
--bg: #071018;
--panel: rgba(10, 22, 31, 0.82);
--panel-border: rgba(170, 211, 224, 0.17);
--text: #edf6f8;
--muted: #9fb5bf;
--cyan: #58e0e6;
--coral: #ff856f;
--gold: #f6c85f;
--green: #77e2a4;
--shadow: 0 18px 50px rgba(0, 0, 0, 0.34);
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: var(--bg);
color: var(--text);
font-family:
Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
"Segoe UI", sans-serif;
}
button,
input {
font: inherit;
}
#viewport,
#viewport canvas {
position: fixed;
inset: 0;
width: 100%;
height: 100%;
}
#viewport canvas {
display: block;
touch-action: none;
outline: none;
}
.hero {
position: fixed;
z-index: 5;
top: 28px;
left: 32px;
width: min(540px, calc(100vw - 64px));
pointer-events: none;
text-shadow: 0 2px 18px rgba(0, 0, 0, 0.55);
}
.eyebrow {
display: flex;
align-items: center;
gap: 9px;
margin-bottom: 9px;
color: var(--cyan);
font-size: 11px;
font-weight: 800;
letter-spacing: 0.18em;
text-transform: uppercase;
}
.eyebrow::before {
width: 24px;
height: 2px;
content: "";
background: currentColor;
box-shadow: 0 0 12px currentColor;
}
h1 {
max-width: 520px;
margin: 0;
font-size: clamp(30px, 4vw, 54px);
font-weight: 680;
letter-spacing: -0.045em;
line-height: 0.98;
}
.hero p {
max-width: 500px;
margin: 14px 0 0;
color: #b9cbd2;
font-size: 14px;
line-height: 1.55;
}
.panel {
border: 1px solid var(--panel-border);
background:
linear-gradient(145deg, rgba(23, 43, 54, 0.78), rgba(8, 18, 26, 0.88)),
var(--panel);
box-shadow: var(--shadow);
backdrop-filter: blur(16px) saturate(1.2);
-webkit-backdrop-filter: blur(16px) saturate(1.2);
}
.controls {
position: fixed;
z-index: 10;
top: 24px;
right: 24px;
width: 252px;
padding: 16px;
border-radius: 16px;
}
.panel-heading {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 12px;
color: #d8e8ec;
font-size: 11px;
font-weight: 800;
letter-spacing: 0.15em;
text-transform: uppercase;
}
.cutaway-badge {
padding: 4px 7px;
border: 1px solid rgba(88, 224, 230, 0.28);
border-radius: 99px;
color: var(--cyan);
background: rgba(88, 224, 230, 0.07);
font-size: 9px;
letter-spacing: 0.08em;
}
.toggle-row {
display: flex;
align-items: center;
justify-content: space-between;
min-height: 38px;
border-top: 1px solid rgba(255, 255, 255, 0.065);
color: #c8d8dd;
font-size: 12px;
}
.toggle {
position: relative;
width: 37px;
height: 21px;
padding: 0;
border: 1px solid rgba(255, 255, 255, 0.15);
border-radius: 99px;
background: rgba(255, 255, 255, 0.06);
cursor: pointer;
transition: 180ms ease;
}
.toggle::after {
position: absolute;
top: 3px;
left: 3px;
width: 13px;
height: 13px;
border-radius: 50%;
content: "";
background: #91a6ad;
transition: 180ms ease;
}
.toggle.active {
border-color: rgba(88, 224, 230, 0.55);
background: rgba(88, 224, 230, 0.16);
}
.toggle.active::after {
left: 19px;
background: var(--cyan);
box-shadow: 0 0 10px rgba(88, 224, 230, 0.65);
}
.reset-button {
width: 100%;
margin-top: 12px;
padding: 9px 11px;
border: 1px solid rgba(255, 255, 255, 0.12);
border-radius: 9px;
color: #d7e7eb;
background: rgba(255, 255, 255, 0.045);
cursor: pointer;
font-size: 11px;
font-weight: 700;
letter-spacing: 0.06em;
text-transform: uppercase;
transition: 160ms ease;
}
.reset-button:hover {
border-color: rgba(88, 224, 230, 0.38);
background: rgba(88, 224, 230, 0.08);
}
.load-control {
margin-top: 14px;
padding-top: 12px;
border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.load-label {
display: flex;
justify-content: space-between;
color: #aebfc5;
font-size: 10px;
font-weight: 700;
letter-spacing: 0.08em;
text-transform: uppercase;
}
#load-value {
color: var(--gold);
}
input[type="range"] {
width: 100%;
height: 4px;
margin: 12px 0 5px;
border-radius: 99px;
accent-color: var(--gold);
cursor: pointer;
}
.scale-labels {
display: flex;
justify-content: space-between;
color: #738a93;
font-size: 9px;
}
.comparison {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 8px;
margin-top: 14px;
padding-top: 12px;
border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.comparison > div {
min-width: 0;
padding: 9px;
border: 1px solid rgba(255, 255, 255, 0.07);
border-radius: 9px;
background: rgba(0, 0, 0, 0.12);
}
.comparison span {
display: block;
margin-bottom: 5px;
color: #7f969f;
font-size: 8px;
font-weight: 800;
letter-spacing: 0.12em;
text-transform: uppercase;
}
.comparison b {
display: block;
color: #d5e4e8;
font-size: 10px;
font-weight: 600;
line-height: 1.35;
}
.comparison .bio b {
color: var(--cyan);
}
.comparison .stone b {
color: var(--coral);
}
#labels {
position: fixed;
z-index: 4;
inset: 0;
overflow: hidden;
pointer-events: none;
}
.scene-label {
position: absolute;
min-width: 130px;
padding: 9px 11px;
border: 1px solid rgba(255, 255, 255, 0.12);
border-radius: 10px;
background: rgba(6, 15, 22, 0.76);
box-shadow: 0 9px 25px rgba(0, 0, 0, 0.25);
opacity: 0;
transform: translate(-50%, -100%);
transition: opacity 120ms ease;
backdrop-filter: blur(8px);
}
.scene-label::after {
position: absolute;
bottom: -13px;
left: 50%;
width: 1px;
height: 13px;
content: "";
background: rgba(255, 255, 255, 0.25);
}
.scene-label strong {
display: block;
color: #eef8fa;
font-size: 10px;
font-weight: 800;
letter-spacing: 0.11em;
text-transform: uppercase;
}
.scene-label span {
display: block;
margin-top: 3px;
color: #9fb5bd;
font-size: 9px;
line-height: 1.35;
}
.scene-label.bio {
border-color: rgba(88, 224, 230, 0.3);
}
.scene-label.bio strong {
color: var(--cyan);
}
.scene-label.stone {
border-color: rgba(255, 133, 111, 0.3);
}
.scene-label.stone strong {
color: var(--coral);
}
.scene-label.path {
min-width: 0;
padding: 6px 9px;
border-radius: 99px;
}
.scene-label.path::after {
display: none;
}
.scene-label.path strong {
font-size: 8px;
}
.scene-label.tag {
min-width: 0;
padding: 5px 8px;
border-radius: 99px;
color: var(--gold);
font-size: 8px;
font-weight: 800;
letter-spacing: 0.1em;
text-transform: uppercase;
}
.scene-label.tag::after {
display: none;
}
.legend {
position: fixed;
z-index: 7;
bottom: 28px;
left: 32px;
display: flex;
flex-wrap: wrap;
gap: 9px 16px;
max-width: 440px;
padding: 12px 14px;
border-radius: 12px;
color: #b8c9cf;
font-size: 10px;
}
.legend-item {
display: flex;
align-items: center;
gap: 7px;
}
.swatch {
width: 18px;
height: 3px;
border-radius: 99px;
box-shadow: 0 0 8px currentColor;
}
.swatch.cyan {
color: var(--cyan);
background: var(--cyan);
}
.swatch.coral {
color: var(--coral);
background: var(--coral);
}
.swatch.gold {
color: var(--gold);
background: var(--gold);
}
.swatch.green {
color: var(--green);
background: var(--green);
}
.caveat {
position: fixed;
z-index: 8;
right: 24px;
bottom: 28px;
width: min(430px, calc(100vw - 48px));
padding: 14px 16px 14px 48px;
border: 1px solid rgba(246, 200, 95, 0.24);
border-radius: 13px;
background: rgba(12, 20, 25, 0.87);
box-shadow: var(--shadow);
color: #b7c6ca;
font-size: 11px;
line-height: 1.5;
backdrop-filter: blur(12px);
}
.caveat::before {
position: absolute;
top: 15px;
left: 17px;
display: grid;
width: 20px;
height: 20px;
place-items: center;
border: 1px solid rgba(246, 200, 95, 0.45);
border-radius: 50%;
content: "!";
color: var(--gold);
font-size: 11px;
font-weight: 900;
}
.caveat strong {
color: #f2d98e;
}
.hint {
position: fixed;
z-index: 6;
bottom: 87px;
left: 50%;
color: rgba(204, 222, 228, 0.62);
font-size: 9px;
font-weight: 700;
letter-spacing: 0.1em;
text-transform: uppercase;
transform: translateX(-50%);
pointer-events: none;
}
@media (max-width: 800px) {
.hero {
top: 18px;
left: 18px;
width: calc(100vw - 36px);
}
.hero p {
max-width: 70%;
font-size: 11px;
}
.controls {
top: auto;
right: 14px;
bottom: 116px;
width: 210px;
padding: 12px;
}
.comparison {
display: none;
}
.legend {
right: 14px;
bottom: 14px;
left: 14px;
max-width: none;
}
.caveat {
right: 14px;
bottom: 70px;
width: min(390px, calc(100vw - 28px));
}
.hint {
display: none;
}
}
@media (max-width: 520px) {
.hero p {
display: none;
}
.controls {
bottom: 125px;
width: 185px;
}
.panel-heading {
font-size: 9px;
}
.caveat {
font-size: 9px;
}
}
</style>
</head>
<body>
<div id="viewport"></div>
<header class="hero">
<div class="eyebrow">Structural biology · interactive study</div>
<h1>Two arches.<br />Two very different systems.</h1>
<p>
Explore a cutaway of an anatomical-inspired foot arch beside a masonry
compression ring. Drag to orbit, scroll to zoom, and inspect the
schematic load paths.
</p>
</header>
<aside class="controls panel" aria-label="View controls">
<div class="panel-heading">
<span>View controls</span>
<span class="cutaway-badge">3D cutaway</span>
</div>
<div class="toggle-row">
<span>Reveal foot interior</span>
<button
id="cutaway-toggle"
class="toggle active"
type="button"
aria-label="Reveal foot interior"
aria-pressed="true"
></button>
</div>
<div class="toggle-row">
<span>Force paths</span>
<button
id="paths-toggle"
class="toggle active"
type="button"
aria-label="Show force paths"
aria-pressed="true"
></button>
</div>
<div class="toggle-row">
<span>Load arrows</span>
<button
id="loads-toggle"
class="toggle active"
type="button"
aria-label="Show load arrows"
aria-pressed="true"
></button>
</div>
<div class="toggle-row">
<span>Animate transmission</span>
<button
id="animate-toggle"
class="toggle active"
type="button"
aria-label="Animate transmission"
aria-pressed="true"
></button>
</div>
<div class="load-control">
<label class="load-label" for="load-slider">
<span>Schematic load</span>
<span id="load-value">1.0×</span>
</label>
<input
id="load-slider"
type="range"
min="0.55"
max="1.45"
step="0.01"
value="1"
/>
<div class="scale-labels">
<span>0.55×</span>
<span>1.45×</span>
</div>
</div>
<button id="reset-view" class="reset-button" type="button">
Reset camera
</button>
<div class="comparison" aria-label="Structural comparison">
<div class="bio">
<span>Living foot</span>
<b>Bone + tendon<br />mixed force paths</b>
</div>
<div class="stone">
<span>Masonry</span>
<b>Compression ring<br />passive thrust</b>
</div>
</div>
</aside>
<div id="labels" aria-hidden="true">
<div id="label-anatomy" class="scene-label bio">
<strong>Living foot</strong>
<span>Compliant, active, adaptive</span>
</div>
<div id="label-masonry" class="scene-label stone">
<strong>Masonry arch</strong>
<span>Passive compression ring</span>
</div>
<div id="label-bio-path" class="scene-label path bio">
<strong>Mixed compression + tension</strong>
</div>
<div id="label-stone-path" class="scene-label path stone">
<strong>Compression thrust path</strong>
</div>
<div id="label-bio-load" class="scene-label tag">Schematic load</div>
<div id="label-stone-load" class="scene-label tag">Schematic load</div>
</div>
<div class="legend panel" aria-label="Legend">
<div class="legend-item">
<span class="swatch cyan"></span>
<span>Biological load path</span>
</div>
<div class="legend-item">
<span class="swatch coral"></span>
<span>Masonry compression path</span>
</div>
<div class="legend-item">
<span class="swatch gold"></span>
<span>Applied load</span>
</div>
<div class="legend-item">
<span class="swatch green"></span>
<span>Ground reaction</span>
</div>
</div>
<div class="hint">Drag to orbit · Scroll to zoom · Double-click to reset</div>
<div class="caveat">
<strong>Schematic analogy, not structural equivalence.</strong>
Living feet are far more complex than passive masonry: they combine bone,
cartilage, tendons, muscles, fat, and active control, while adapting to
fatigue and changing loads. Masonry arches primarily transmit compression
and horizontal thrust.
</div>
<script type="module">
import * as THREE from
"https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
const viewport = document.getElementById("viewport");
const scene = new THREE.Scene();
scene.background = new THREE.Color(0x071018);
scene.fog = new THREE.Fog(0x071018, 15, 27);
const renderer = new THREE.WebGLRenderer({
antialias: true,
alpha: false,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.12;
viewport.appendChild(renderer.domElement);
const camera = new THREE.PerspectiveCamera(
39,
window.innerWidth / window.innerHeight,
0.1,
60
);
const cameraTarget = new THREE.Vector3(-0.15, 1.15, 0);
const orbit = {
theta: 0.13,
phi: 1.13,
radius: 12.2,
targetTheta: 0.13,
targetPhi: 1.13,
targetRadius: 12.2
};
function updateCamera() {
orbit.theta += (orbit.targetTheta - orbit.theta) * 0.1;
orbit.phi += (orbit.targetPhi - orbit.phi) * 0.1;
orbit.radius += (orbit.targetRadius - orbit.radius) * 0.1;
const sinPhi = Math.sin(orbit.phi);
camera.position.set(
cameraTarget.x + orbit.radius * sinPhi * Math.sin(orbit.theta),
cameraTarget.y + orbit.radius * Math.cos(orbit.phi),
cameraTarget.z + orbit.radius * sinPhi * Math.cos(orbit.theta)
);
camera.lookAt(cameraTarget);
}
updateCamera();
const hemisphere = new THREE.HemisphereLight(0xaed9e7, 0x172029, 1.65);
scene.add(hemisphere);
const keyLight = new THREE.DirectionalLight(0xfff3dc, 3.4);
keyLight.position.set(-4, 9, 8);
keyLight.castShadow = true;
keyLight.shadow.mapSize.set(2048, 2048);
keyLight.shadow.camera.left = -9;
keyLight.shadow.camera.right = 9;
keyLight.shadow.camera.top = 8;
keyLight.shadow.camera.bottom = -5;
keyLight.shadow.camera.near = 1;
keyLight.shadow.camera.far = 24;
keyLight.shadow.bias = -0.00025;
scene.add(keyLight);
const cyanLight = new THREE.PointLight(0x38dce5, 18, 8, 2);
cyanLight.position.set(-4.3, 2.4, 3.2);
scene.add(cyanLight);
const coralLight = new THREE.PointLight(0xff755f, 15, 7, 2);
coralLight.position.set(3.2, 2.5, 3.1);
scene.add(coralLight);
const ground = new THREE.Mesh(
new THREE.PlaneGeometry(32, 20),
new THREE.MeshStandardMaterial({
color: 0x09141c,
roughness: 0.92,
metalness: 0.03
})
);
ground.rotation.x = -Math.PI / 2;
ground.position.y = -0.055;
ground.receiveShadow = true;
scene.add(ground);
const grid = new THREE.GridHelper(30, 30, 0x24404a, 0x132830);
grid.position.y = -0.035;
grid.material.transparent = true;
grid.material.opacity = 0.46;
scene.add(grid);
const anatomyGroup = new THREE.Group();
const masonryGroup = new THREE.Group();
const pathsGroup = new THREE.Group();
const loadsGroup = new THREE.Group();
scene.add(anatomyGroup, masonryGroup, pathsGroup, loadsGroup);
// Shared materials.
const boneMaterial = new THREE.MeshStandardMaterial({
color: 0xf2d8b4,
roughness: 0.63,
metalness: 0.02
});
const jointMaterial = new THREE.MeshStandardMaterial({
color: 0xb56c62,
roughness: 0.48,
metalness: 0.03
});
const skinMaterial = new THREE.MeshStandardMaterial({
color: 0x9adce4,
emissive: 0x123d48,
emissiveIntensity: 0.35,
roughness: 0.4,
metalness: 0.01,
transparent: true,
opacity: 0.16,
depthWrite: false,
side: THREE.DoubleSide
});
const frontSkinMaterial = skinMaterial.clone();
frontSkinMaterial.opacity = 0.12;
const edgeMaterial = new THREE.MeshBasicMaterial({
color: 0x7edbe2,
transparent: true,
opacity: 0.48
});
const forcePathMaterials = [];
const pathRecords = [];
function addEllipsoid(parent, position, scale, material, segments = 24) {
const mesh = new THREE.Mesh(
new THREE.SphereGeometry(1, segments, Math.max(12, segments / 2)),
material
);
mesh.position.copy(position);
mesh.scale.copy(scale);
mesh.castShadow = true;
mesh.receiveShadow = true;
parent.add(mesh);
return mesh;
}
function addBoneBetween(parent, start, end, radius, material = boneMaterial) {
const a = new THREE.Vector3(...start);
const b = new THREE.Vector3(...end);
const direction = b.clone().sub(a);
const length = direction.length();
const shaft = new THREE.Mesh(
new THREE.CylinderGeometry(radius * 0.78, radius, length, 16),
material
);
shaft.position.copy(a).add(b).multiplyScalar(0.5);
shaft.quaternion.setFromUnitVectors(
new THREE.Vector3(0, 1, 0),
direction.normalize()
);
shaft.castShadow = true;
shaft.receiveShadow = true;
parent.add(shaft);
const capA = new THREE.Mesh(
new THREE.SphereGeometry(radius * 0.8, 16, 12),
material
);
capA.position.copy(a);
capA.castShadow = true;
parent.add(capA);
const capB = capA.clone();
capB.position.copy(b);
parent.add(capB);
return shaft;
}
function createFootHalf(front = true) {
const profile = [
{ x: -5.05, bottom: 0.14, top: 0.48, width: 0.02 },
{ x: -4.78, bottom: 0.12, top: 0.88, width: 0.39 },
{ x: -4.38, bottom: 0.18, top: 1.10, width: 0.52 },
{ x: -4.02, bottom: 0.42, top: 1.28, width: 0.52 },
{ x: -3.68, bottom: 0.61, top: 1.39, width: 0.50 },
{ x: -3.34, bottom: 0.61, top: 1.39, width: 0.54 },
{ x: -3.02, bottom: 0.39, top: 1.28, width: 0.61 },
{ x: -2.68, bottom: 0.16, top: 1.08, width: 0.65 },
{ x: -2.36, bottom: 0.10, top: 0.73, width: 0.60 },
{ x: -2.18, bottom: 0.11, top: 0.48, width: 0.24 }
];
function smoothStep(t) {
return t * t * (3 - 2 * t);
}
function sampleAt(x) {
for (let i = 0; i < profile.length - 1; i++) {
const a = profile[i];
const b = profile[i + 1];
if (x >= a.x && x <= b.x) {
const t = smoothStep((x - a.x) / (b.x - a.x));
return {
bottom: THREE.MathUtils.lerp(a.bottom, b.bottom, t),
top: THREE.MathUtils.lerp(a.top, b.top, t),
width: THREE.MathUtils.lerp(a.width, b.width, t)
};
}
}
return profile[profile.length - 1];
}
const longitudinalSegments = 52;
const radialSegments = 24;
const positions = [];
const indices = [];
for (let i = 0; i <= longitudinalSegments; i++) {
const t = i / longitudinalSegments;
const x = THREE.MathUtils.lerp(profile[0].x, profile.at(-1).x, t);
const sample = sampleAt(x);
for (let j = 0; j <= radialSegments; j++) {
const angle = front
? -Math.PI / 2 + (j / radialSegments) * Math.PI
: Math.PI / 2 + (j / radialSegments) * Math.PI;
const z = sample.width * Math.cos(angle);
const y =
sample.bottom +
(sample.top - sample.bottom) * (0.5 + 0.5 * Math.sin(angle));
positions.push(x, y, z);
}
}
const row = radialSegments + 1;
for (let i = 0; i < longitudinalSegments; i++) {
for (let j = 0; j < radialSegments; j++) {
const a = i * row + j;
const b = a + row;
const c = b + 1;
const d = a + 1;
indices.push(a, b, d, b, c, d);
}
}
const geometry = new THREE.BufferGeometry();
geometry.setAttribute(
"position",
new THREE.Float32BufferAttribute(positions, 3)
);
geometry.setIndex(indices);
geometry.computeVertexNormals();
return geometry;
}
const backShell = new THREE.Mesh(
createFootHalf(false),
skinMaterial
);
backShell.renderOrder = 3;
anatomyGroup.add(backShell);
const frontShell = new THREE.Mesh(
createFootHalf(true),
frontSkinMaterial
);
frontShell.renderOrder = 3;
anatomyGroup.add(frontShell);
// Section edges along the sagittal cut plane.
const cutEdges = new THREE.Group();
const edgeCurves = [
[
[-5.02, 0.47, 0],
[-4.78, 0.88, 0],
[-4.38, 1.10, 0],
[-4.02, 1.28, 0],
[-3.68, 1.39, 0],
[-3.34, 1.39, 0],
[-3.02, 1.28, 0],
[-2.68, 1.08, 0],
[-2.36, 0.73, 0],
[-2.18, 0.48, 0]
],
[
[-5.02, 0.14, 0],
[-4.78, 0.12, 0],
[-4.38, 0.18, 0],
[-4.02, 0.42, 0],
[-3.68, 0.61, 0],
[-3.34, 0.61, 0],
[-3.02, 0.39, 0],
[-2.68, 0.16, 0],
[-2.36, 0.10, 0],
[-2.18, 0.11, 0]
]
];
for (const points of edgeCurves) {
const curve = new THREE.CatmullRomCurve3(
points.map((p) => new THREE.Vector3(...p))
);
const edge = new THREE.Mesh(
new THREE.TubeGeometry(curve, 80, 0.012, 6, false),
edgeMaterial
);
cutEdges.add(edge);
}
anatomyGroup.add(cutEdges);
// Anatomical-inspired bones.
addEllipsoid(
anatomyGroup,
new THREE.Vector3(-4.40, 0.43, 0),
new THREE.Vector3(0.61, 0.29, 0.37),
boneMaterial
);
addEllipsoid(
anatomyGroup,
new THREE.Vector3(-3.84, 0.83, 0),
new THREE.Vector3(0.38, 0.31, 0.34),
boneMaterial
);
addEllipsoid(
anatomyGroup,
new THREE.Vector3(-3.46, 0.71, 0),
new THREE.Vector3(0.29, 0.24, 0.29),
boneMaterial
);
addEllipsoid(
anatomyGroup,
new THREE.Vector3(-3.13, 0.60, 0),
new THREE.Vector3(0.27, 0.22, 0.30),
boneMaterial
);
// Joint markers emphasize the segmented, biological character.
for (const point of [
[-3.84, 0.82, 0.27],
[-3.46, 0.70, 0.23],
[-3.13, 0.59, 0.25]
]) {
addEllipsoid(
anatomyGroup,
new THREE.Vector3(...point),
new THREE.Vector3(0.075, 0.065, 0.035),
jointMaterial,
16
);
}
// Five schematic metatarsals.
for (let i = 0; i < 5; i++) {
const z = (i - 2) * 0.115;
addBoneBetween(
anatomyGroup,
[-3.05, 0.52 + Math.abs(i - 2) * 0.012, z],
[-2.35 - Math.abs(i - 2) * 0.025, 0.31, z * 0.72],
0.067
);
}
// Cropped tibia and fibula give the arch a clear load entry point.
addBoneBetween(
anatomyGroup,
[-3.82, 1.01, 0],
[-3.69, 2.43, 0],
0.205
);
addBoneBetween(
anatomyGroup,
[-3.80, 1.02, 0.25],
[-3.68, 2.20, 0.24],
0.082
);
// Plantar soft-tissue/fascia strand beneath the osseous arch.
const plantarCurve = new THREE.CatmullRomCurve3([
new THREE.Vector3(-4.70, 0.22, 0.12),
new THREE.Vector3(-4.30, 0.28, 0.14),
new THREE.Vector3(-3.75, 0.53, 0.16),
new THREE.Vector3(-3.23, 0.40, 0.16),
new THREE.Vector3(-2.64, 0.19, 0.14)
]);
const plantar = new THREE.Mesh(
new THREE.TubeGeometry(plantarCurve, 70, 0.045, 8, false),
new THREE.MeshStandardMaterial({
color: 0xf1a276,
roughness: 0.55,
emissive: 0x6b2418,
emissiveIntensity: 0.35
})
);
anatomyGroup.add(plantar);
// A soft platform under the foot.
const footPad = new THREE.Mesh(
new THREE.CylinderGeometry(1.35, 1.5, 0.055, 64),
new THREE.MeshStandardMaterial({
color: 0x102630,
roughness: 0.85,
metalness: 0.06
})
);
footPad.scale.z = 0.38;
footPad.position.set(-3.65, -0.025, 0);
footPad.receiveShadow = true;
anatomyGroup.add(footPad);
// Masonry arch.
const archCenter = new THREE.Vector3(2.38, 0.62, 0);
const innerRadius = 1.75;
const outerRadius = 2.25;
const blockCount = 13;
const depth = 0.82;
const faceMaterial = new THREE.MeshStandardMaterial({
color: 0xd2b07a,
roughness: 0.82,
metalness: 0.01
});
const sideMaterial = new THREE.MeshStandardMaterial({
color: 0x8e714c,
roughness: 0.9,
metalness: 0.01
});
const keystoneMaterial = new THREE.MeshStandardMaterial({
color: 0xe1c18d,
roughness: 0.72,
metalness: 0.01
});
for (let i = 0; i < blockCount; i++) {
const start = (i / blockCount) * Math.PI + 0.006;
const end = ((i + 1) / blockCount) * Math.PI - 0.006;
const shape = new THREE.Shape();
shape.moveTo(
outerRadius * Math.cos(start),
outerRadius * Math.sin(start)
);
for (let j = 1; j <= 6; j++) {
const a = THREE.MathUtils.lerp(start, end, j / 6);
shape.lineTo(
outerRadius * Math.cos(a),
outerRadius * Math.sin(a)
);
}
for (let j = 6; j >= 0; j--) {
const a = THREE.MathUtils.lerp(start, end, j / 6);
shape.lineTo(
innerRadius * Math.cos(a),
innerRadius * Math.sin(a)
);
}
shape.closePath();
const geometry = new THREE.ExtrudeGeometry(shape, {
depth,
steps: 1,
bevelEnabled: true,
bevelSegments: 2,
bevelSize: 0.024,
bevelThickness: 0.024,
curveSegments: 2
});
const isKeystone = i === Math.floor(blockCount / 2);
const materials = isKeystone
? [keystoneMaterial, sideMaterial]
: [faceMaterial, sideMaterial];
const block = new THREE.Mesh(geometry, materials);
block.position.set(
archCenter.x,
archCenter.y,
-depth / 2
);
block.castShadow = true;
block.receiveShadow = true;
masonryGroup.add(block);
const outline = new THREE.LineSegments(
new THREE.EdgesGeometry(geometry, 24),
new THREE.LineBasicMaterial({
color: 0x5e4931,
transparent: true,
opacity: 0.44
})
);
block.add(outline);
}
const pierMaterial = new THREE.MeshStandardMaterial({
color: 0xb79868,
roughness: 0.86,
metalness: 0.01
});
const pierGeometry = new THREE.BoxGeometry(0.78, 0.62, 0.86);
for (const x of [0.64, 4.12]) {
const pier = new THREE.Mesh(pierGeometry, pierMaterial);
pier.position.set(x, 0.31, 0);
pier.castShadow = true;
pier.receiveShadow = true;
masonryGroup.add(pier);
}
const slab = new THREE.Mesh(
new THREE.BoxGeometry(5.25, 0.11, 1.85),
new THREE.MeshStandardMaterial({
color: 0x26343a,
roughness: 0.72,
metalness: 0.12
})
);
slab.position.set(2.38, 0.035, 0);
slab.castShadow = true;
slab.receiveShadow = true;
masonryGroup.add(slab);
// Force path construction.
function createForcePath(parent, points, color, radius = 0.052, count = 8) {
const curve = new THREE.CatmullRomCurve3(
points.map((p) => new THREE.Vector3(...p)),
false,
"centripetal"
);
const material = new THREE.MeshStandardMaterial({
color,
emissive: color,
emissiveIntensity: 1.7,
roughness: 0.26,
metalness: 0.05,
transparent: true,
opacity: 0.92,
depthWrite: false
});
forcePathMaterials.push(material);
const tube = new THREE.Mesh(
new THREE.TubeGeometry(curve, 100, radius, 10, false),
material
);
tube.renderOrder = 5;
parent.add(tube);
const particleMaterial = new THREE.MeshBasicMaterial({
color: 0xffffff,
transparent: true,
opacity: 0.95
});
const particles = [];
for (let i = 0; i < count; i++) {
const particle = new THREE.Mesh(
new THREE.SphereGeometry(radius * 1.45, 12, 8),
particleMaterial
);
particle.renderOrder = 6;
parent.add(particle);
particles.push(particle);
}
pathRecords.push({
curve,
particles,
phase: Math.random() * 0.2
});
}
// The foot branches into two reaction paths through bone and soft tissue.
createForcePath(
pathsGroup,
[
[-3.73, 1.16, 0.46],
[-3.83, 0.85, 0.47],
[-4.16, 0.55, 0.47],
[-4.52, 0.33, 0.47],
[-4.73, 0.22, 0.47]
],
0x58e0e6,
0.055,
8
);
createForcePath(
pathsGroup,
[
[-3.70, 1.12, 0.48],
[-3.47, 0.73, 0.49],
[-3.12, 0.59, 0.49],
[-2.72, 0.38, 0.49],
[-2.39, 0.22, 0.49]
],
0x58e0e6,
0.055,
9
);
// Masonry thrust descends from the crown through both halves of the ring.
createForcePath(
pathsGroup,
[
[2.38, 2.77, 0.50],
[1.83, 2.51, 0.50],
[1.25, 1.76, 0.50],
[0.87, 0.90, 0.50],
[0.65, 0.57, 0.50]
],
0xff856f,
0.058,
9
);
createForcePath(
pathsGroup,
[
[2.38, 2.77, 0.51],
[2.93, 2.51, 0.51],
[3.50, 1.76, 0.51],
[3.89, 0.90, 0.51],
[4.12, 0.57, 0.51]
],
0xff856f,
0.058,
9
);
// Schematic arrows.
const arrows = {};
function createArrow(name, origin, direction, length, color) {
const arrow = new THREE.ArrowHelper(
direction,
origin,
length,
color,
Math.min(0.22, length * 0.3),
Math.min(0.13, length * 0.18)
);
arrow.line.material.transparent = true;
arrow.line.material.opacity = 0.95;
arrow.cone.material.transparent = true;
arrow.cone.material.opacity = 0.95;
loadsGroup.add(arrow);
arrows[name] = arrow;
return arrow;
}
createArrow(
"bioLoad",
new THREE.Vector3(-3.69, 2.88, 0.25),
new THREE.Vector3(0, -1, 0),
0.72,
0xf6c85f
);
createArrow(
"heelReaction",
new THREE.Vector3(-4.70, 0.03, 0.62),
new THREE.Vector3(0, 1, 0),
0.54,
0x77e2a4
);
createArrow(
"forefootReaction",
new THREE.Vector3(-2.43, 0.03, 0.62),
new THREE.Vector3(0, 1, 0),
0.47,
0x77e2a4
);
createArrow(
"stoneLoad",
new THREE.Vector3(2.38, 3.60, 0.25),
new THREE.Vector3(0, -1, 0),
0.83,
0xf6c85f
);
createArrow(
"leftReaction",
new THREE.Vector3(0.64, 0.09, 0.64),
new THREE.Vector3(0, 1, 0),
0.58,
0x77e2a4
);
createArrow(
"rightReaction",
new THREE.Vector3(4.12, 0.09, 0.64),
new THREE.Vector3(0, 1, 0),
0.58,
0x77e2a4
);
let loadScale = 1;
function updateArrowLengths() {
arrows.bioLoad.setLength(0.72 * loadScale, 0.2, 0.12);
arrows.heelReaction.setLength(0.54 * loadScale, 0.17, 0.11);
arrows.forefootReaction.setLength(0.47 * loadScale, 0.16, 0.1);
arrows.stoneLoad.setLength(0.83 * loadScale, 0.22, 0.13);
arrows.leftReaction.setLength(0.58 * loadScale, 0.18, 0.11);
arrows.rightReaction.setLength(0.58 * loadScale, 0.18, 0.11);
}
updateArrowLengths();
// HTML labels projected from 3D anchors.
const labelAnchors = [
{
element: document.getElementById("label-anatomy"),
point: new THREE.Vector3(-4.38, 1.72, -0.35)
},
{
element: document.getElementById("label-masonry"),
point: new THREE.Vector3(3.78, 3.02, -0.35)
},
{
element: document.getElementById("label-bio-path"),
point: new THREE.Vector3(-3.18, 0.34, 0.66)
},
{
element: document.getElementById("label-stone-path"),
point: new THREE.Vector3(2.38, 1.45, 0.66)
},
{
element: document.getElementById("label-bio-load"),
point: new THREE.Vector3(-3.05, 2.76, 0.25)
},
{
element: document.getElementById("label-stone-load"),
point: new THREE.Vector3(2.95, 3.46, 0.25)
}
];
function updateLabels() {
const width = window.innerWidth;
const height = window.innerHeight;
for (const item of labelAnchors) {
const projected = item.point.clone().project(camera);
const visible = projected.z > -1 && projected.z < 1;
if (!visible) {
item.element.style.opacity = "0";
continue;
}
const x = (projected.x * 0.5 + 0.5) * width;
const y = (-projected.y * 0.5 + 0.5) * height;
item.element.style.left = `${x}px`;
item.element.style.top = `${y}px`;
item.element.style.opacity = "1";
}
}
// Direct camera controls, implemented without external addons.
let dragging = false;
let previousX = 0;
let previousY = 0;
function resetView() {
orbit.targetTheta = 0.13;
orbit.targetPhi = 1.13;
orbit.targetRadius = 12.2;
cameraTarget.set(-0.15, 1.15, 0);
}
renderer.domElement.addEventListener("pointerdown", (event) => {
dragging = true;
previousX = event.clientX;
previousY = event.clientY;
renderer.domElement.setPointerCapture(event.pointerId);
});
renderer.domElement.addEventListener("pointermove", (event) => {
if (!dragging) return;
const dx = event.clientX - previousX;
const dy = event.clientY - previousY;
previousX = event.clientX;
previousY = event.clientY;
orbit.targetTheta -= dx * 0.006;
orbit.targetPhi = THREE.MathUtils.clamp(
orbit.targetPhi - dy * 0.005,
0.48,
1.46
);
});
function endDrag(event) {
dragging = false;
if (event.pointerId !== undefined) {
try {
renderer.domElement.releasePointerCapture(event.pointerId);
} catch (_) {}
}
}
renderer.domElement.addEventListener("pointerup", endDrag);
renderer.domElement.addEventListener("pointercancel", endDrag);
renderer.domElement.addEventListener(
"wheel",
(event) => {
event.preventDefault();
orbit.targetRadius = THREE.MathUtils.clamp(
orbit.targetRadius + event.deltaY * 0.008,
7.2,
18
);
},
{ passive: false }
);
renderer.domElement.addEventListener("dblclick", resetView);
renderer.domElement.addEventListener("contextmenu", (event) => {
event.preventDefault();
});
window.addEventListener("keydown", (event) => {
if (event.target instanceof HTMLInputElement) return;
switch (event.key) {
case "ArrowLeft":
orbit.targetTheta += 0.08;
break;
case "ArrowRight":
orbit.targetTheta -= 0.08;
break;
case "ArrowUp":
orbit.targetPhi = THREE.MathUtils.clamp(
orbit.targetPhi - 0.06,
0.48,
1.46
);
break;
case "ArrowDown":
orbit.targetPhi = THREE.MathUtils.clamp(
orbit.targetPhi + 0.06,
0.48,
1.46
);
break;
case "+":
case "=":
orbit.targetRadius = Math.max(7.2, orbit.targetRadius - 0.5);
break;
case "-":
orbit.targetRadius = Math.min(18, orbit.targetRadius + 0.5);
break;
case "r":
case "R":
resetView();
break;
}
});
// UI controls.
const cutawayToggle = document.getElementById("cutaway-toggle");
const pathsToggle = document.getElementById("paths-toggle");
const loadsToggle = document.getElementById("loads-toggle");
const animateToggle = document.getElementById("animate-toggle");
const loadSlider = document.getElementById("load-slider");
const loadValue = document.getElementById("load-value");
let cutawayOn = true;
let pathsOn = true;
let loadsOn = true;
let animateOn = true;
function setToggle(button, value) {
button.classList.toggle("active", value);
button.setAttribute("aria-pressed", String(value));
}
cutawayToggle.addEventListener("click", () => {
cutawayOn = !cutawayOn;
frontShell.visible = !cutawayOn;
cutEdges.visible = cutawayOn;
setToggle(cutawayToggle, cutawayOn);
});
pathsToggle.addEventListener("click", () => {
pathsOn = !pathsOn;
pathsGroup.visible = pathsOn;
document.getElementById("label-bio-path").style.visibility =
pathsOn ? "visible" : "hidden";
document.getElementById("label-stone-path").style.visibility =
pathsOn ? "visible" : "hidden";
setToggle(pathsToggle, pathsOn);
});
loadsToggle.addEventListener("click", () => {
loadsOn = !loadsOn;
loadsGroup.visible = loadsOn;
document.getElementById("label-bio-load").style.visibility =
loadsOn ? "visible" : "hidden";
document.getElementById("label-stone-load").style.visibility =
loadsOn ? "visible" : "hidden";
setToggle(loadsToggle, loadsOn);
});
animateToggle.addEventListener("click", () => {
animateOn = !animateOn;
setToggle(animateToggle, animateOn);
});
loadSlider.addEventListener("input", () => {
loadScale = Number(loadSlider.value);
loadValue.textContent = `${loadScale.toFixed(2)}×`;
updateArrowLengths();
});
document.getElementById("reset-view").addEventListener("click", resetView);
function resize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
}
window.addEventListener("resize", resize);
// Animation loop.
const clock = new THREE.Clock();
function animate() {
requestAnimationFrame(animate);
const elapsed = clock.getElapsedTime();
updateCamera();
for (const record of pathRecords) {
for (let i = 0; i < record.particles.length; i++) {
const particleT =
animateOn
? (elapsed * 0.16 + i / record.particles.length + record.phase) % 1
: (i + 0.5) / record.particles.length;
record.particles[i].position.copy(
record.curve.getPointAt(particleT)
);
const pulse = animateOn
? 0.82 + Math.sin(elapsed * 4 + i) * 0.16
: 0.9;
record.particles[i].scale.setScalar(pulse);
}
}
for (let i = 0; i < forcePathMaterials.length; i++) {
forcePathMaterials[i].emissiveIntensity = animateOn
? 1.45 + Math.sin(elapsed * 3.2 + i * 0.8) * 0.42
: 1.45;
}
updateLabels();
renderer.render(scene, camera);
}
animate();
</script>
</body>
</html>
```