<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>I wrote this to Darrin, but didn't CC cafe:</div><div><br></div><div>On Mar 17, 2010, at 9:20 PM, Darrin Chandler wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">type Cartesian_coord = Float<br><br>type Latitude &nbsp;= Float<br>type Longitude = Float<br><br>data Point<span class="Apple-tab-span" style="white-space: pre; ">        </span>= Cartesian (Cartesian_coord, Cartesian_coord)<br><span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span>| Spherical (Latitude, Longitude)<br><br>type Center = Point<br>type Radius = Float<br><br>data Shape<span class="Apple-tab-span" style="white-space: pre; ">        </span>= Circle Center Radius<br><span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span>| Polygon [Point]<br><br>This obviously stinks since a Polygon could contain mixed Cartesian and<br>Spherical points. Polygon needs to be one or the other, but not mixed.</span></blockquote></div><br><div>My suggestion would be to use an alternate representation of "spherical" points in terms of polar coordinates, and then to normalize and mix at will:</div><div><br></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px; ">type Theta = Float</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px; ">type Radius = Float</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px; "><br></span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px; ">data Point = Cartesian (Cartesian_coord, Cartesian_coord)</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px; ">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | Polar &nbsp; (Theta, Radius)</span></font></div><div><font class="Apple-style-span" face="Courier"><br></font></div><div><font class="Apple-style-span" face="Courier">normalize_point :: Point -&gt; Point</font></div><div><font class="Apple-style-span" face="Courier">normalize_point Cartesian x y = Cartesian x y</font></div><div><font class="Apple-style-span" face="Courier">normalize_point Polar t r = Cartesian x y where x = r * cos t; y = r * sin t;</font></div><div><font class="Apple-style-span" face="Courier"><br></font></div><div><font class="Apple-style-span" face="Courier">It really depends on what you want to do with your points. &nbsp;If you want to do linear algebra, you might want your points to depend on a basis, for example. &nbsp;But your "spherical" points don't really form a basis in three-space, or even over all of two-space.</font></div></body></html>