WPF: Moving Lines by degrees

Oct 19 2010 12:25 PM
Hi there, 

I'm not new to programming but I'm still new to C# and WPF and I'm somehow stuck.

My problem is: A have a robot-device with several sonar-sensors. Let's assume three sensors for the beginning. One is pointing straight ahead (0°), one is pointing at -15° and the last one at 15°. I'm receiving data from these sensors stating in what distance an object is "seen". That could be interpreted as points with a direction in degrees and a distance. For the beginning I just want to draw lines through these points. 
Let's say a have a grid of 500x500 pixel, assuming my device is right at the center-point (250, 250). Drawing lines in certain distances of course is no big deal. But how do I deal with the degree-data? 

How do I draw a line that is moved by 15° to the right respectively 15° degrees to the left?

I'm somehow stuck with my ideas and approaches and I'm feeling that I need to be pointed on another better working solution than calculating the desired movement in pixels manually o_O

Many thanks in advance for any ideas! Probably I just don't know about proper transformation- or translation-methods available in C#/WPF?

Greetings, 
Andreas

Answers (1)