add plane dist code