Clustering of waveforms based on FPCA direction