Home My Page Projects Code Snippets Project Openings 3D graphics for Standard ML
Summary Activity SCM

SCM Repository

[sml3d] Annotation of /trunk/sml3d/src/sml3d/geometry/aabb3f.sml
ViewVC logotype

Annotation of /trunk/sml3d/src/sml3d/geometry/aabb3f.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1267 - (view) (download)

1 : jhr 1115 (* aabb3f.sml
2 :     *
3 : jhr 1265 * COPYRIGHT (c) 2012 The SML3d Project (http://sml3d.cs.uchicago.edu)
4 : jhr 1115 * All rights reserved.
5 :     *
6 :     * Axis-aligned bounding boxes.
7 :     *)
8 :    
9 :     structure AABBox3f : AXIS_ALIGNED_BOUNDING_BOX =
10 :     struct
11 :    
12 :     type flt = Float.float
13 : jhr 1267 type vec = flt SML3dTypes.vec3
14 : jhr 1115
15 : jhr 1267 type bbox = {min : vec, max : vec}
16 : jhr 1115
17 :     fun union (bb1 : bbox, bb2 : bbox) = {
18 :     min = Vec3f.map2 Float.min (#min bb1, #min bb2),
19 :     max = Vec3f.map2 Float.max (#max bb1, #max bb2)
20 :     }
21 :    
22 : jhr 1267 fun containsPt ({min, max} : bbox) (p : vec) = (
23 :     (#1 min <= #1 p) andalso (#1 p <= #1 max) andalso
24 :     (#2 min <= #2 p) andalso (#2 p <= #2 max) andalso
25 :     (#3 min <= #3 p) andalso (#3 p <= #3 max))
26 : jhr 1115
27 :     end

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