Skip to content

Commit 45b514a

Browse files
committed
fix: remove debug lines
1 parent 07f5e02 commit 45b514a

1 file changed

Lines changed: 1 addition & 79 deletions

File tree

web/src/subject/ephys-viz-3d.js

Lines changed: 1 addition & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import {
3131
import { ITEM_COLORS } from './brain-viz.js';
3232
import { parseTranslation, computeProbeDirection, computeProbeDirectionSteps } from '../lib/coord-systems.js';
3333
import { createOrbitControls } from '../lib/orbit-controls.js';
34-
import { createOrbitControls } from '../lib/orbit-controls.js';
3534

3635
// Probe cylinder diameter: 70 µm = 0.07 mm
3736
const PROBE_DIAMETER_MM = 0.07;
@@ -40,15 +39,6 @@ const PROBE_RADIUS_MM = PROBE_DIAMETER_MM / 2;
4039
// Default probe length drawn above the tip (mm). Long enough to be visible.
4140
const PROBE_LENGTH_MM = 10;
4241

43-
// Length of each debug direction line (mm)
44-
const DEBUG_LINE_LENGTH_MM = 8;
45-
46-
// ── Debug toggle ─────────────────────────────────────────────────────────────
47-
// Set to true to draw transform-step debug lines anchored at bregma.
48-
// Each line shows the probe direction after one additional transform is applied;
49-
// white = at rest (no transforms), fading to black = after all transforms.
50-
const DEBUG_PROBE_TRANSFORMS = true;
51-
5242
// CDN base for OBJ meshes
5343
const MESH_BASE = 'https://allen-data-views.s3.amazonaws.com/data-asset-cache/meshes/';
5444

@@ -386,75 +376,7 @@ function _buildEphysProbes(THREE, scene, probes) {
386376
group.position.copy(tipPos);
387377

388378
scene.add(group);
389-
390-
// ── Debug lines: one per transform step, all anchored at bregma ──────
391-
if (DEBUG_PROBE_TRANSFORMS) {
392-
_buildDebugLines(THREE, scene, p.transforms, ITEM_COLORS[i % ITEM_COLORS.length]);
393-
}
394379
}
395380
}
396381

397-
/**
398-
* Draw one cylinder per transform step, all anchored at bregma.
399-
* Color interpolates from white (step 0, at rest) toward the probe's own
400-
* color in 15% increments per step.
401-
* Three.js LineBasicMaterial ignores linewidth on WebGL, so thin cylinders
402-
* are used instead (radius = 0.1 mm).
403-
*
404-
* @param {THREE} THREE
405-
* @param {THREE.Scene} scene
406-
* @param {Array} transforms - Raw transform array from the probe config.
407-
* @param {string} cssColor - Probe CSS hex color e.g. '#FF6B6B'.
408-
*/
409-
function _buildDebugLines(THREE, scene, transforms, cssColor) {
410-
// Parse target color from CSS hex
411-
const hex = cssColor.replace('#', '');
412-
const tr = parseInt(hex.substring(0, 2), 16);
413-
const tg = parseInt(hex.substring(2, 4), 16);
414-
const tb = parseInt(hex.substring(4, 6), 16);
415-
416-
const steps = computeProbeDirectionSteps(transforms);
417-
const cylinderUp = new THREE.Vector3(0, 1, 0); // CylinderGeometry default axis
418-
419-
for (let s = 0; s < steps.length; s++) {
420-
// 0% probe color at step 0 (white), +15% per step, capped at 100%
421-
const t = Math.min(s * 0.15, 1.0);
422-
const r = Math.round(255 + (tr - 255) * t);
423-
const g = Math.round(255 + (tg - 255) * t);
424-
const b = Math.round(255 + (tb - 255) * t);
425-
const color = (r << 16) | (g << 8) | b;
426-
427-
const { dir, pos, type } = steps[s];
428-
const [dx, dy, dz] = dir;
429-
const [px, py, pz] = pos;
430-
const origin = new THREE.Vector3(px, py, pz);
431-
const direction = new THREE.Vector3(dx, dy, dz);
432-
const tip = origin.clone().addScaledVector(direction, DEBUG_LINE_LENGTH_MM);
433-
434-
if (type === 'Translation') {
435-
// Show translation as an arrow: sphere at new position + small cylinder along direction
436-
const sphere = new THREE.Mesh(
437-
new THREE.SphereGeometry(0.25, 10, 10),
438-
new THREE.MeshBasicMaterial({ color }),
439-
);
440-
sphere.position.copy(origin);
441-
scene.add(sphere);
442-
443-
// Short stub to show current direction at this position
444-
const geo = new THREE.CylinderGeometry(0.1, 0.1, DEBUG_LINE_LENGTH_MM * 0.5, 6, 1);
445-
const mat = new THREE.MeshBasicMaterial({ color });
446-
const mesh = new THREE.Mesh(geo, mat);
447-
mesh.position.copy(origin).addScaledVector(direction, DEBUG_LINE_LENGTH_MM * 0.25);
448-
mesh.quaternion.setFromUnitVectors(cylinderUp, direction);
449-
scene.add(mesh);
450-
} else {
451-
// Rotation or initial — full-length cylinder from current position in current direction
452-
const geo = new THREE.CylinderGeometry(0.1, 0.1, DEBUG_LINE_LENGTH_MM, 6, 1);
453-
const mat = new THREE.MeshBasicMaterial({ color });
454-
const mesh = new THREE.Mesh(geo, mat);
455-
mesh.position.copy(origin).addScaledVector(direction, DEBUG_LINE_LENGTH_MM / 2);
456-
mesh.quaternion.setFromUnitVectors(cylinderUp, direction);
457-
scene.add(mesh);
458-
}
459-
}
460-
}
382+

0 commit comments

Comments
 (0)