private float GetLocalWidth(Vertex point, Vertex v1, Vertex v2,float w1,float w2) { if (v1.CoordinatesEquals(v2)) { Debug.Log("same points!"); Debug.Log(v1); Debug.Log(v2); return 0; } //project point on line v1-v2 /////WTF? why is it here? //Vertex projectedP = fmc.ProjectPointOnLine(point, fmc.GetGeneralLineEquation(v1, v2)); //measure distance to v1 and v2 float dist1 = fmc.GetDistanceBetweenPoints(point, v1); float dist2 = fmc.GetDistanceBetweenPoints(point, v2); //Debug.Log(dist1); //Debug.Log(dist2); //map values to give total sum of 1 float factor = dist1 + dist2; float factor1 = (factor - dist1) / factor; float factor2 = (factor - dist2) / factor; //Debug.Log(factor); //Debug.Log(factor1); //Debug.Log(factor2); //return sum of given widths multiplied by calculated factors return w1 * factor1 + w2*factor2; }