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

SCM Repository

[smlnj] Annotation of /sml/trunk/src/eXene/graph-util/poly.sml
ViewVC logotype

Annotation of /sml/trunk/src/eXene/graph-util/poly.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (view) (download)

1 : monnier 2 fun polygonRegion (l as [_,_,_], fill_rule) = poly(l,fill_rule)
2 :     | polygonRegion (l as [a,b,c,d], fill_rule) =
3 :     if isRect(a,b,c,d) then mkRect(a,b,c,d) else poly(l,fill_rule)
4 :     | polygonRegion (l as [a,b,c,d,e], fill_rule) = poly(l,fill_rule)
5 :     if a = e andalso isRect(a,b,c,d) then mkRect(a,b,c,d) else poly(l,fill_rule)
6 :     | polygonRegion (l as (_::_::_::_), fill_rule) = poly(l,fill_rule)
7 :     | polygonRegion _ = zeroRegion
8 :    
9 :    
10 :     fun isRect(PT{x=ax,y=ay},PT{x=bx,y=by},PT{x=cx,y=cy},PT{x=dx,y=dy}) =
11 :     ((ay = by andalso bx = cx andalso cy = dy andalso dx = ax) orelse
12 :     (ax = bx andalso by = cy andalso cx = dx andalso dy = ay)) andalso
13 :     let
14 :     val x1 = min(ax, cx)
15 :     val y1 = min(ay, cy)
16 :     val x2 = max(ax, cx)
17 :     val y2 = max(ay, cy)
18 :     in x1 <> x2 andalso y1 <> yw end
19 :    

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