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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1267 - (download) (annotate)
Fri Jan 20 13:59:06 2012 UTC (6 years, 10 months ago) by jhr
File size: 682 byte(s)
  Working on new SML3d core library
(* aabb3f.sml
 *
 * COPYRIGHT (c) 2012 The SML3d Project (http://sml3d.cs.uchicago.edu)
 * All rights reserved.
 *
 * Axis-aligned bounding boxes.
 *)

structure AABBox3f : AXIS_ALIGNED_BOUNDING_BOX =
  struct

    type flt = Float.float
    type vec = flt SML3dTypes.vec3

    type bbox = {min : vec, max : vec}

    fun union (bb1 : bbox, bb2 : bbox) = {
	    min = Vec3f.map2 Float.min (#min bb1, #min bb2),
	    max = Vec3f.map2 Float.max (#max bb1, #max bb2)
	  }

    fun containsPt ({min, max} : bbox) (p : vec) = (
	  (#1 min <= #1 p) andalso (#1 p <= #1 max) andalso
	  (#2 min <= #2 p) andalso (#2 p <= #2 max) andalso
	  (#3 min <= #3 p) andalso (#3 p <= #3 max))

  end

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