Thursday, 18 February 2016

Xamarin C# equivalent of Math.hypot

I'm doing some more Xamarin for the next few weeks, and today I'm working on a material-design circular reveal for an Android app. I had to convert this line of Java (amongst others) into C#:

float finalRadius = (float)Math.hypot(cx, cy);

And...the answer is.....

var finalRadius = (float)Math.Sqrt(cx * cx + cy * cy);

No comments:

Post a Comment

Comments are moderated, so you'll have to wait a little bit before they appear!