title: Most elegant way to clip a line?
body: <p>I have a Rectangle2D and a Line2D. I want to "clip" the line so that only the part of the line which is within the rectangle remains. If none of the line is within the rectangle I want the line to be set to (0,0,0,0). Basically something along the lines of a</p>
  
  <pre><code>Rectangle2D.intersect(Line2D src, Line2D dest)
  </code></pre>
  
  <p>or something similar.</p>
  
  <p>Is there a way to do this with the java.awt.geom API? Or an elegant way to code it "by hand"?</p>