Changed ComputePerpendicularDistance by a bounded approach