Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] View of /eXene/releases/release-110.63/graph-util/poly.sml
ViewVC logotype

View of /eXene/releases/release-110.63/graph-util/poly.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2378 - (download) (annotate)
Thu Mar 22 21:07:49 2007 UTC (12 years, 5 months ago) by blume
File size: 884 byte(s)
Release 110.63
    fun polygonRegion (l as [_,_,_], fill_rule) = poly(l,fill_rule)
      | polygonRegion (l as [a,b,c,d], fill_rule) =
          if isRect(a,b,c,d) then mkRect(a,b,c,d) else poly(l,fill_rule)
      | polygonRegion (l as [a,b,c,d,e], fill_rule) = poly(l,fill_rule)
          if a = e andalso isRect(a,b,c,d) then mkRect(a,b,c,d) else poly(l,fill_rule)
      | polygonRegion (l as (_::_::_::_), fill_rule) = poly(l,fill_rule)
      | polygonRegion _ = zeroRegion


    fun isRect(PT{x=ax,y=ay},PT{x=bx,y=by},PT{x=cx,y=cy},PT{x=dx,y=dy}) = 
          ((ay = by andalso bx = cx andalso cy = dy andalso dx = ax) orelse
          (ax = bx andalso by = cy andalso cx = dx andalso dy = ay)) andalso
          let
            val x1 = min(ax, cx)
            val y1 = min(ay, cy)
            val x2 = max(ax, cx)
            val y2 = max(ay, cy)
            in x1 <> x2 andalso y1 <> yw end


root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0