Thank you, for this post, very clear explanation. I will have a play round with this one, as I can already see some uses for this in some current projects, and it should work quite well in Xamarin as well.

]]>site carries amazing and actually good material for visitors. ]]>

Also there’s an `if` statement where the test was removed, probably because WordPress got confused by a < or >. Should it be `if (dp < sn2)`?

]]>// point : [x, y] // line segment : [x1, y1], [x2, y2] public static float DistancePointToLineSegement(float x, float y, float x1, float y1, float x2, float y2) { if (x1 == x2 && y1 == y2) return DistancePointToPoint(x1, y1, x, y); float sx = x2 - x1; float sy = y2 - y1; float ux = x - x1; float uy = y - x2; float dp = sx * ux + sy * uy; if (dp sn2) return DistancePointToPoint(x2, y2, x, y); float ah2 = dp * dp / sn2; float un2 = ux * ux + uy * uy; return Mathf.Sqrt(un2 - ah2); } public static float DistancePointToPoint(float x1, float y1, float x2, float y2) { float dx = x2 - x1; float dy = y2 - y1; return Mathf.Sqrt(dx * dx + dy * dy); }

So in addition to Excel, I have to add reference to OO-Calc libraries to my project and develop methods equivalent to my Excel report generation methods.

I’ve found it extremely difficult to use the Open Office libraries in C#, though it used to be quite simple in VB .Net.

]]>