In Silverlight, is there a way to determine the angle of a Line object? If I have a Line with coordinates of 0,0 - 30,80, is there a way to determine the angle, in degrees, that the line is running?
In Silverlight, is there a way to determine the angle of a Line object?
Share
You could try finding the arc tangent using the
Math.Atanfunction. You just need to find the atan of the (delta of) y-value over the (delta of) x-value.The answer will be in radians and you will need to convert it to degrees (rads * (180f / Math.PI)).
An example of this would be something like:
(Note: I’ve never used Silverlight and I’m just basing this off the docs, so this might be completely wrong… you can also use Math.Atan2(delta y, delta x) too…)