Surface detection algorithm in three dimensional complex space