How to implement point-merge detection? =======================================