Skip to content

Commit 4020862

Browse files
committed
fix: debugging issues with outside-of-brain algorithm
1 parent 1b6a843 commit 4020862

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

Assets/Scripts/Pinpoint/Probes/ProbeManager.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -770,12 +770,12 @@ public void DropProbeToBrainSurface()
770770
return;
771771
}
772772

773-
Debug.Log(entryCoordAtlasIdx);
773+
Vector3 worldU = BrainAtlasManager.ActiveReferenceAtlas.AtlasIdx2World(entryCoordAtlasIdx);
774+
Vector3 entryCoordAtlasT = BrainAtlasManager.WorldU2WorldT(worldU);
774775

775-
Vector3 w = BrainAtlasManager.ActiveReferenceAtlas.AtlasIdx2World(entryCoordAtlasIdx);
776-
Vector3 a = BrainAtlasManager.ActiveReferenceAtlas.World2Atlas(w);
777-
778-
var entryCoordAtlasT = BrainAtlasManager.ActiveAtlasTransform.U2T(a);
776+
//var entryCoordAtlasT = BrainAtlasManager.ActiveAtlasTransform.U2T(
777+
// BrainAtlasManager.ActiveReferenceAtlas.World2Atlas(
778+
// BrainAtlasManager.ActiveReferenceAtlas.AtlasIdx2World(entryCoordAtlasIdx)));
779779

780780
_probeController.SetProbePosition(entryCoordAtlasT);
781781
}
@@ -823,6 +823,7 @@ public void UpdateSurfacePosition()
823823

824824
Vector3 downDir = useDV ? Vector3.down : tipForwardWorldU;
825825
Vector3 downDirAtlas = BrainAtlasManager.ActiveReferenceAtlas.World2Atlas_Vector(downDir);
826+
Debug.Log(downDirAtlas);
826827

827828
// Check if we're in the brain
828829
bool probeInBrain = BrainAtlasManager.ActiveReferenceAtlas.GetAnnotationIdx(tipAtlasIdxU) > 0;
@@ -839,9 +840,11 @@ public void UpdateSurfacePosition()
839840
for (int i = 0; i < 2; i++)
840841
{
841842
Vector3 temporaryTip = tipAtlasIdxU + downDirAtlas * offset[i] * mult / BrainAtlasManager.ActiveReferenceAtlas.Resolution.z;
843+
Debug.Log(temporaryTip);
842844
if (BrainAtlasManager.ActiveReferenceAtlas.GetAnnotationIdx(temporaryTip) > 0)
843845
{
844846
tipInBrain = temporaryTip;
847+
Debug.Log(tipInBrain);
845848
done = true;
846849
break;
847850
}
@@ -854,7 +857,6 @@ public void UpdateSurfacePosition()
854857
if (!done)
855858
{
856859
Debug.LogWarning("Impossible to find brain surface from here");
857-
Debug.Log(tipInBrain);
858860
return (new Vector3(float.NaN, float.NaN, float.NaN), false);
859861
}
860862
}

0 commit comments

Comments
 (0)