title: Calculating the bounding box of a random triangle using coordinates
body: <p>I am looking for an appropriate way to calculate the rectangular bounding box of a triangle shape which has three corners given as points - (x1,y1), (x2,y2), (x3,y3).</p>
  
  <p>Here is the data type that I am using (as suggested, I added more constructors):</p>
  
  <pre><code>data Shape =
       Circle Point Double |
       Rectangle Point Point |
       Triangle Point Point Point
  </code></pre>
  
  <p>The bounding box function should be of the form "bounding :: Shape -> Shape".
  I have also tried the bounding boxes of a rectangle and a circle:</p>
  
  <pre><code>bounding :: Shape -&gt; Shape
  bounding (Rectangle (Point x y) (Point z z1)) = (Rectangle (Point x y) (Point z z1))
  bounding (Circle (Point p w) r) = (Rectangle (Point (p-r) (w-r)) (Point (p+r) (w+r)))
  </code></pre>
  
  <p>Are these right provided that the graphics coordinate system should be used (where (x,y) coordinates should be treated as (x,-y) instead)?</p>
  
  <p>Could someone give me a helping hand please? 
  P.S. No graphics library is required.</p>