public double calcPointToLineDistance(Entry startEntry,Entry endEntry,Entry entryPoint){
  float xDiffEndStart=(float)endEntry.getXIndex() - (float)startEntry.getXIndex();
  float xDiffEntryStart=(float)entryPoint.getXIndex() - (float)startEntry.getXIndex();
  double normalLength=Math.sqrt((xDiffEndStart) * (xDiffEndStart) + (endEntry.getVal() - startEntry.getVal()) * (endEntry.getVal() - startEntry.getVal()));
  return Math.abs((xDiffEntryStart) * (endEntry.getVal() - startEntry.getVal()) - (entryPoint.getVal() - startEntry.getVal()) * (xDiffEndStart)) / normalLength;
}

public double calcPointToLineDistance ( Entry startEntry , Entry endEntry , Entry entryPoint ) { float xDiffEndStart = ( float ) endEntry . getXIndex ( ) - ( float ) startEntry . getXIndex ( ) ; float xDiffEntryStart = ( float ) entryPoint . getXIndex ( ) - ( float ) startEntry . getXIndex ( ) ; double normalLength = Math . sqrt ( ( xDiffEndStart ) * ( xDiffEndStart ) + ( endEntry . getVal ( ) - startEntry . getVal ( ) ) * ( endEntry . getVal ( ) - startEntry . getVal ( ) ) ) ; return Math . abs ( ( xDiffEntryStart ) * ( endEntry . getVal ( ) - startEntry . getVal ( ) ) - ( entryPoint . getVal ( ) - startEntry . getVal ( ) ) * ( xDiffEndStart ) ) / normalLength ; }
calculate the distance between a line between two entries and an entry ( point )
