Skip to content

Commit

Permalink
Change some variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanhahmann committed Mar 13, 2023
1 parent bcabed8 commit ff2987e
Showing 1 changed file with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ private void computeBranchSinuosity()

private double computeSinuosity( final BranchSpot branchSpot )
{
final double[] currentSpotCoordinates = new double[ branchSpot.numDimensions() ];
final double[] currentCoordinates = new double[ branchSpot.numDimensions() ];

Spot spot;
double accumulatedLifeCycleDistance = 0d;
// accumulated distance during the life cycle of the branch
double accumulatedDistance = 0d;

final Iterator< Spot > spotIterator = branchGraph.vertexBranchIterator( branchSpot );
if ( !spotIterator.hasNext() )
Expand All @@ -58,18 +59,18 @@ private double computeSinuosity( final BranchSpot branchSpot )
if ( !spotIterator.hasNext() )
return Double.NaN;

spot.localize( currentSpotCoordinates );
double[] previousSpotCoordinates = Arrays.copyOf( currentSpotCoordinates, currentSpotCoordinates.length );
double[] branchStartCoordinates = Arrays.copyOf( currentSpotCoordinates, currentSpotCoordinates.length );
spot.localize( currentCoordinates );
double[] previousCoordinates = Arrays.copyOf( currentCoordinates, currentCoordinates.length );
double[] startCoordinates = Arrays.copyOf( currentCoordinates, currentCoordinates.length );

while ( spotIterator.hasNext() )
{
spot = spotIterator.next();
spot.localize( currentSpotCoordinates );
accumulatedLifeCycleDistance += LinAlgHelpers.distance( currentSpotCoordinates, previousSpotCoordinates );
previousSpotCoordinates = Arrays.copyOf( currentSpotCoordinates, currentSpotCoordinates.length );
spot.localize( currentCoordinates );
accumulatedDistance += LinAlgHelpers.distance( currentCoordinates, previousCoordinates );
previousCoordinates = Arrays.copyOf( currentCoordinates, currentCoordinates.length );
}
double directLifeCycleDistance = LinAlgHelpers.distance( currentSpotCoordinates, branchStartCoordinates );
return accumulatedLifeCycleDistance / directLifeCycleDistance;
double directDistance = LinAlgHelpers.distance( currentCoordinates, startCoordinates );
return accumulatedDistance / directDistance;
}
}

0 comments on commit ff2987e

Please sign in to comment.