public void computeG( final double[] pt, final DenseMatrix64F mtx ) { final double r = Math.sqrt( normSqrd( pt ) ); final double nrm = r2Logr( r ); CommonOps.setIdentity( mtx ); CommonOps.scale( nrm, mtx ); }
public void computeDeformationContribution( final double[] thispt, final double[] result ) { final double[] tmpDisplacement = new double[ ndims ]; for ( int i = 0; i < ndims; ++i ) { result[ i ] = 0; tmpDisplacement[ i ] = 0; } int di = 0; for ( int lnd = 0; lnd < nLandmarks; lnd++ ) { srcPtDisplacement( lnd, thispt, tmpDisplacement ); final double nrm = r2Logr( Math.sqrt( normSqrd( tmpDisplacement ) ) ); for ( int d = 0; d < ndims; d++ ) result[ d ] += nrm * dMatrix.get( d, di ); di++; } }
final double r2 = normSqrd( tmpDisplacement ); // squared radius final double r = Math.sqrt( r2 ); // radius
/** * Returns the index of the target landmark closest to the input point as well * as the distance to that landmark. * * @param target the point * @return a pair containing the closest landmark point and its squared * distance to that landmark */ public IndexDistancePair closestTargetLandmarkAndDistance( final double[] target ) { int idx = -1; double distSqr = Double.MAX_VALUE; double thisDist = 0.0; final double[] err = new double[ this.ndims ]; for ( int l = 0; l < this.nLandmarks; l++ ) { tgtPtDisplacement( l, target, err ); thisDist = normSqrd( err ); if ( thisDist < distSqr ) { distSqr = thisDist; idx = l; } } return new IndexDistancePair( idx, distSqr ); }