title: Transforming the cartesian representation of a segment into polar form and viceversa
body: <p>Suppose to have a segment described by its two extremes on cartesian plane, as two couples of coordinates.
  I need to represent such segment in "polar form", as a couple <em>theta, d</em>, where <em>theta</em> is its slope and <em>d</em> its distance from origin of cartesian axes.</p>
  
  <p>I guess I correctly computed <em>theta</em> as the slope of line containing segment.
  On the other end, I have some doubts about <em>d</em>, because it seems to me that distance of origin from line containing segment is not exactly distance of segment from origin.
  How would you compute the couple <em>theta, d</em>?</p>
  
  <p>One more question: suppose to have a correct couple <em>theta, d</em>: do you think it's possible to get back to original cartesian representation and get back to original segment's extremes?</p>
  
  <p>thanks for help.</p>