Skip to content

Commit

Permalink
BUG: Frenet frame disrupted along tubes
Browse files Browse the repository at this point in the history
When consecutive points created an ambiguous frenet frame along a tube,
it use to default to an axis-aligned frame.  However, this could cause
rapid changes / discontinuities in the frame along a tube.   Now
ambiguities revert to the last defined frame, eliminating the
discontinuities.
  • Loading branch information
aylward committed Jun 10, 2020
1 parent 51cfc29 commit 25bb5ca
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Modules/Core/SpatialObjects/include/itkTubeSpatialObject.hxx
Expand Up @@ -387,6 +387,9 @@ TubeSpatialObject<TDimension, TTubePointType>::ComputeTangentAndNormals()
// Compute the normal
CovariantVectorType n1;
CovariantVectorType n2;
CovariantVectorType prevN1;
prevN1.Fill(0);
prevN1[TDimension - 1] = 1;

it1 = 0;
it2 = 1;
Expand Down Expand Up @@ -445,10 +448,9 @@ TubeSpatialObject<TDimension, TTubePointType>::ComputeTangentAndNormals()
}
else
{
std::cerr << "Error: Duplicate points - normals undefined" << std::endl;
n1[0] = 0;
n1[1] = 0;
n1[2] = 1;
n1[0] = prevN1[0];
n1[1] = prevN1[1];
n1[2] = prevN1[2];
}
}
}
Expand All @@ -463,6 +465,7 @@ TubeSpatialObject<TDimension, TTubePointType>::ComputeTangentAndNormals()
((TubePointType *)(this->GetPoint(it1)))->SetNormal1InObjectSpace(n1);
((TubePointType *)(this->GetPoint(it1)))->SetNormal2InObjectSpace(n2);
}
prevN1 = n1;

it1++;
}
Expand Down

0 comments on commit 25bb5ca

Please sign in to comment.