Browse Source

Completed Box3 documentation

Greg Tatum 11 years ago
parent
commit
9f4693c61e
3 changed files with 135 additions and 97 deletions
  1. 12 12
      docs/api/math/Box2.html
  2. 121 85
      docs/api/math/Box3.html
  3. 2 0
      src/math/Box3.js

+ 12 - 12
docs/api/math/Box2.html

@@ -43,7 +43,7 @@
 
 
 
 
 
 
-		<h3>.set([page:Vector2 min], [page:Vector2 max]) [page:todo]</h3>
+		<h3>.set([page:Vector2 min], [page:Vector2 max]) [page:Box2 this]</h3>
 		<div>
 		<div>
 		min -- Lower (x, y) boundary of the box. <br />
 		min -- Lower (x, y) boundary of the box. <br />
 		max -- Upper (x, y) boundary of the box.
 		max -- Upper (x, y) boundary of the box.
@@ -52,7 +52,7 @@
 		Sets the lower and upper (x, y) boundaries of this box.
 		Sets the lower and upper (x, y) boundaries of this box.
 		</div>
 		</div>
 
 
-		<h3>.expandByPoint([page:Vector2 point]) [page:Box2]</h3>
+		<h3>.expandByPoint([page:Vector2 point]) [page:Box2 this]</h3>
 		<div>
 		<div>
 		point -- Point that should be included in the box.
 		point -- Point that should be included in the box.
 		</div>
 		</div>
@@ -77,7 +77,7 @@
 		Determines whether or not this box intersects *box*.
 		Determines whether or not this box intersects *box*.
 		</div>
 		</div>
 
 
-		<h3>.setFromPoints([page:Array points]) [page:Box2]</h3>
+		<h3>.setFromPoints([page:Array points]) [page:Box2 this]</h3>
 		<div>
 		<div>
 		points -- Set of points that the resulting box will envelop.
 		points -- Set of points that the resulting box will envelop.
 		</div>
 		</div>
@@ -103,7 +103,7 @@
 		lower bounds.
 		lower bounds.
 		</div>
 		</div>
 
 
-		<h3>.getParameter([page:Vector2 point]) [page:Vector2]</h3>
+		<h3>.getParameter([page:Vector2 point], [page:Vector2 optionalTarget]) [page:Vector2]</h3>
 		<div>
 		<div>
 		point -- Point to parametrize.
 		point -- Point to parametrize.
 		</div>
 		</div>
@@ -111,7 +111,7 @@
 		Returns point as a proportion of this box's width and height.
 		Returns point as a proportion of this box's width and height.
 		</div>
 		</div>
 
 
-		<h3>.expandByScalar([page:float scalar]) [page:Box2]</h3>
+		<h3>.expandByScalar([page:float scalar]) [page:Box2 this]</h3>
 		<div>
 		<div>
 		scalar -- Distance to expand.
 		scalar -- Distance to expand.
 		</div>
 		</div>
@@ -120,7 +120,7 @@
 		will be contracted.
 		will be contracted.
 		</div>
 		</div>
 
 
-		<h3>.intersect([page:Box2 box]) [page:Box2]</h3>
+		<h3>.intersect([page:Box2 box]) [page:Box2 this]</h3>
 		<div>
 		<div>
 		box -- Box to intersect with.
 		box -- Box to intersect with.
 		</div>
 		</div>
@@ -139,7 +139,7 @@
 		this function also returns true. 
 		this function also returns true. 
 		</div>
 		</div>
 
 
-		<h3>.translate([page:Vector2 offset]) [page:Box2]</h3>
+		<h3>.translate([page:Vector2 offset]) [page:Box2 this]</h3>
 		<div>
 		<div>
 		offset -- Direction and distance of offset.
 		offset -- Direction and distance of offset.
 		</div>
 		</div>
@@ -168,7 +168,7 @@
 		Returns true if this box and *box* share the same lower and upper bounds.
 		Returns true if this box and *box* share the same lower and upper bounds.
 		</div>
 		</div>
 
 
-		<h3>.expandByVector([page:Vector2 vector]) [page:Box2]</h3>
+		<h3>.expandByVector([page:Vector2 vector]) [page:Box2 this]</h3>
 		<div>
 		<div>
 		vector -- Amount to expand this box in each dimension.
 		vector -- Amount to expand this box in each dimension.
 		</div>
 		</div>
@@ -178,7 +178,7 @@
 		this box will be expanded by the y component of *vector* in both directions.
 		this box will be expanded by the y component of *vector* in both directions.
 		</div>
 		</div>
 
 
-		<h3>.copy([page:Box2 box]) [page:Box2]</h3>
+		<h3>.copy([page:Box2 box]) [page:Box2 this]</h3>
 		<div>
 		<div>
 		box -- Box to copy.
 		box -- Box to copy.
 		</div>
 		</div>
@@ -186,7 +186,7 @@
 		Copies the values of *box* to this box.
 		Copies the values of *box* to this box.
 		</div>
 		</div>
 
 
-		<h3>.makeEmpty() [page:Box2]</h3>
+		<h3>.makeEmpty() [page:Box2 this]</h3>
 		<div>
 		<div>
 		Makes this box empty.
 		Makes this box empty.
 		</div>
 		</div>
@@ -210,13 +210,13 @@
 
 
 		<h3>.containsPoint([page:Vector2 point]) [page:Boolean]</h3>
 		<h3>.containsPoint([page:Vector2 point]) [page:Boolean]</h3>
 		<div>
 		<div>
-		point -- Point to check for inclusion.
+		point -- [page:Vector2] to check for inclusion.
 		</div>
 		</div>
 		<div>
 		<div>
 		Returns true if the specified point lies within the boundaries of this box.
 		Returns true if the specified point lies within the boundaries of this box.
 		</div>
 		</div>
 
 
-		<h3>.setFromCenterAndSize([page:Vector2 center], [page:Vector2 size]) [page:Box2]</h3>
+		<h3>.setFromCenterAndSize([page:Vector2 center], [page:Vector2 size]) [page:Box2 this]</h3>
 		<div>
 		<div>
 		center -- Desired center position of the box. <br />
 		center -- Desired center position of the box. <br />
 		size -- Desired x and y dimensions of the box. 
 		size -- Desired x and y dimensions of the box. 

+ 121 - 85
docs/api/math/Box3.html

@@ -9,19 +9,19 @@
 	<body>
 	<body>
 		<h1>[name]</h1>
 		<h1>[name]</h1>
 
 
-		<div class="desc">todo</div>
+		<div class="desc">Represents a boundary box in 3d space.</div>
 
 
 
 
 		<h2>Constructor</h2>
 		<h2>Constructor</h2>
 
 
 
 
-		<h3>[name]([page:todo min], [page:todo max])</h3>
+		<h3>[name]([page:Vector3 min], [page:Vector3 max])</h3>
 		<div>
 		<div>
-		min -- todo <br />
-		max -- todo
+		min -- Lower (x, y, z) boundary of the box.<br />
+		max -- Upper (x, y, z) boundary of the box.
 		</div>
 		</div>
 		<div>
 		<div>
-		todo
+		Creates a box bounded by min and max. 
 		</div>
 		</div>
 
 
 		<h2>Properties</h2>
 		<h2>Properties</h2>
@@ -30,202 +30,238 @@
 
 
 		<h3>.[page:Vector3 max]</h3>
 		<h3>.[page:Vector3 max]</h3>
 		<div>
 		<div>
-		todo
+		Upper (x, y, z) boundary of this box.
 		</div> 
 		</div> 
 
 
 		<h3>.[page:Vector3 min]</h3>
 		<h3>.[page:Vector3 min]</h3>
 		<div>
 		<div>
-		todo
-		</div> 
+		Lower (x, y, z) boundary of this box.
+		</div>
 
 
 		<h2>Methods</h2>
 		<h2>Methods</h2>
 
 
 
 
 
 
-		<h3>.set([page:todo min], [page:todo max]) [page:todo]</h3>
+		<h3>.set([page:Vector3 min], [page:Vector3 max]) [page:Box3 this]</h3>
 		<div>
 		<div>
-		min -- todo <br />
-		max -- todo
+		min -- Lower (x, y, z) boundary of the box. <br />
+		max -- Upper (x, y, z) boundary of the box.
 		</div>
 		</div>
 		<div>
 		<div>
-		todo
+		Sets the lower and upper (x, y, z) boundaries of this box.
 		</div>
 		</div>
-
-		<h3>.applyMatrix4([page:todo matrix]) [page:todo]</h3>
+		
+		<h3>.addPoint([page:Vector3 point]) [page:Box3 this]</h3>
 		<div>
 		<div>
-		matrix -- todo
+		point -- [page:Vector3] to add to the box <br />
 		</div>
 		</div>
 		<div>
 		<div>
-		todo
+		If the *point* is outside the bounds of the box, the bounds are expanded
+		so that the point is within the bounds.
 		</div>
 		</div>
-
-		<h3>.expandByPoint([page:todo point]) [page:todo]</h3>
+		
+		<h3>.applyMatrix4([page:Matrix4 matrix]) [page:Box3 this]</h3>
 		<div>
 		<div>
-		point -- todo
+		matrix -- The [page:Matrix4] to apply
 		</div>
 		</div>
 		<div>
 		<div>
-		todo
+		Transforms this Box3 with the supplied matrix.
 		</div>
 		</div>
 
 
-		<h3>.clampPoint([page:todo point], [page:todo optionalTarget]) [page:todo]</h3>
+		<h3>.clampPoint([page:Vector3 point], [page:Vector3 optionalTarget]) [page:Vector3]</h3>
 		<div>
 		<div>
-		point -- todo <br />
-		optionalTarget -- todo
+		point -- Position to clamp. <br />
+		optionalTarget -- If specified, the clamped result will be copied here.
 		</div>
 		</div>
 		<div>
 		<div>
-		todo
+		Clamps *point* within the bounds of this box.
 		</div>
 		</div>
 
 
-		<h3>.isIntersectionBox([page:todo box]) [page:todo]</h3>
+		<h3>.isIntersectionBox([page:Box3 box]) [page:Boolean]</h3>
 		<div>
 		<div>
-		box -- todo
+		box -- Box to check for intersection against.
 		</div>
 		</div>
 		<div>
 		<div>
-		todo
+		Determines whether or not this box intersects *box*.
 		</div>
 		</div>
 
 
-		<h3>.setFromPoints([page:todo points]) [page:todo]</h3>
+		<h3>.setFromPoints([page:Array points]) [page:Box3 this]</h3>
 		<div>
 		<div>
-		points -- todo
+		points -- Set of points that the resulting box will envelop.
 		</div>
 		</div>
 		<div>
 		<div>
-		todo
+		Sets the upper and lower bounds of this box to include all of the points in *points*.
 		</div>
 		</div>
-
-		<h3>.size([page:todo optionalTarget]) [page:todo]</h3>
+		
+		<h3>.setFromObject([page:Object3D object]) [page:Box3 this]</h3>
 		<div>
 		<div>
-		optionalTarget -- todo
+		object -- [page:Object3D] to compute the bounding box for.
 		</div>
 		</div>
 		<div>
 		<div>
-		todo
+		Computes the world-axis-aligned bounding box of an object (including its children),
+		accounting for both the object's, and childrens', world transforms
 		</div>
 		</div>
+		
+		
 
 
-		<h3>.union([page:todo box]) [page:todo]</h3>
+		<h3>.size([page:Vector3 optionalTarget]) [page:Vector3]</h3>
 		<div>
 		<div>
-		box -- todo
+		optionalTarget -- If specified, the result will be copied here.
 		</div>
 		</div>
 		<div>
 		<div>
-		todo
+		Returns the width, height, and depth of this box.
 		</div>
 		</div>
 
 
-		<h3>.getParameter([page:todo point]) [page:todo]</h3>
+		<h3>.union([page:Box3 box]) [page:Box3]</h3>
 		<div>
 		<div>
-		point -- todo
+		box -- Box that will be unioned with this box.
 		</div>
 		</div>
 		<div>
 		<div>
-		todo
+		Unions this box with *box* setting the upper bound of this box to the greater of the 
+		two boxes' upper bounds and the lower bound of this box to the lesser of the two boxes'
+		lower bounds.
 		</div>
 		</div>
 
 
-		<h3>.expandByScalar([page:todo scalar]) [page:todo]</h3>
+		<h3>.getParameter([page:Vector3 point], [page:Vector3 optionalTarget]) [page:Vector3]</h3>
 		<div>
 		<div>
-		scalar -- todo
+		point -- Point to parametrize.
+		optionalTarget -- If specified, the result will be copied here.
 		</div>
 		</div>
 		<div>
 		<div>
-		todo
+		Returns point as a proportion of this box's width and height.
 		</div>
 		</div>
 
 
-		<h3>.intersect([page:todo box]) [page:todo]</h3>
+		<h3>.intersect([page:Box3 box]) [page:Box3 this]</h3>
 		<div>
 		<div>
-		box -- todo
+		box -- Box to intersect with.
 		</div>
 		</div>
 		<div>
 		<div>
-		todo
+		Returns the intersection of this and *box*, setting the upper bound of this box to the lesser </br>
+		of the two boxes' upper bounds and the lower bound of this box to the greater of the two boxes' </br>
+		lower bounds.
 		</div>
 		</div>
 
 
-		<h3>.containsBox([page:todo box]) [page:todo]</h3>
+		<h3>.containsBox([page:Box3 box]) [page:Boolean]</h3>
 		<div>
 		<div>
-		box -- todo
+		box -- Box to test for inclusion.
 		</div>
 		</div>
 		<div>
 		<div>
-		todo
+		Returns true if this box includes the entirety of *box*. If this and *box* overlap exactly,</br>
+		this function also returns true. 
 		</div>
 		</div>
 
 
-		<h3>.translate([page:todo offset]) [page:todo]</h3>
+		<h3>.containsPoint([page:Vector3 point]) [page:Boolean]</h3>
+		<div>
+		point -- [page:Vector3] to check for inclusion.
+		</div>
+		<div>
+		Returns true if the specified point lies within the boundaries of this box.
+		</div>
+		
+		<h3>.translate([page:Vector3 offset]) [page:Box3 this]</h3>
 		<div>
 		<div>
-		offset -- todo
+		offset -- Direction and distance of offset.
 		</div>
 		</div>
 		<div>
 		<div>
-		todo
+		Adds *offset* to both the upper and lower bounds of this box, effectively moving this box </br>
+		*offset* units in 3D space.
 		</div>
 		</div>
 
 
-		<h3>.empty() [page:todo]</h3>
+		<h3>.empty() [page:Boolean]</h3>
 		<div>
 		<div>
-		todo
+		Returns true if this box includes zero points within its bounds.</br>
+		Note that a box with equal lower and upper bounds still includes one point, the
+		one both bounds share.
 		</div>
 		</div>
 
 
-		<h3>.clone() [page:todo]</h3>
+		<h3>.clone() [page:Box3]</h3>
 		<div>
 		<div>
-		todo
+		Returns a copy of this box.
 		</div>
 		</div>
 
 
-		<h3>.equals([page:todo box]) [page:todo]</h3>
+		<h3>.equals([page:Box3 box]) [page:Boolean]</h3>
 		<div>
 		<div>
-		box -- todo
+		box -- Box to compare.
 		</div>
 		</div>
 		<div>
 		<div>
-		todo
+		Returns true if this box and *box* share the same lower and upper bounds.
 		</div>
 		</div>
 
 
-		<h3>.expandByVector([page:todo vector]) [page:todo]</h3>
+		<h3>.expandByPoint([page:Vector3 point]) [page:Box3 this]</h3>
 		<div>
 		<div>
-		vector -- todo
+		point -- Point that should be included in the box.
 		</div>
 		</div>
 		<div>
 		<div>
-		todo
+		Expands the boundaries of this box to include *point*.
 		</div>
 		</div>
-
-		<h3>.copy([page:todo box]) [page:todo]</h3>
+		
+		<h3>.expandByScalar([page:float scalar]) [page:Box3 this]</h3>
 		<div>
 		<div>
-		box -- todo
+		scalar -- Distance to expand.
 		</div>
 		</div>
 		<div>
 		<div>
-		todo
+		Expands each dimension of the box by *scalar*. If negative, the dimensions of the box <br/>
+		will be contracted.
+		</div>
+		
+		<h3>.expandByVector([page:Vector3 vector]) [page:Box3 this]</h3>
+		<div>
+		vector -- Amount to expand this box in each dimension.
 		</div>
 		</div>
-
-		<h3>.makeEmpty() [page:todo]</h3>
 		<div>
 		<div>
-		todo
+		Expands this box equilaterally by *vector*. The width of this box will be
+		expanded by the x component of *vector* in both directions. The height of 
+		this box will be expanded by the y component of *vector* in both directions.
+		The depth of this box will be expanded by the z component of *vector* in
+		both directions.
 		</div>
 		</div>
 
 
-		<h3>.center([page:todo optionalTarget]) [page:todo]</h3>
+		<h3>.copy([page:Box3 box]) [page:Box3 this]</h3>
+		<div>
+		box -- Box to copy.
+		</div>
 		<div>
 		<div>
-		optionalTarget -- todo
+		Copies the values of *box* to this box.
 		</div>
 		</div>
+
+		<h3>.makeEmpty() [page:Box3 this]</h3>
 		<div>
 		<div>
-		todo
+		Makes this box empty.
 		</div>
 		</div>
 
 
-		<h3>.getBoundingSphere([page:todo optionalTarget]) [page:todo]</h3>
+		<h3>.center([page:Vector3 optionalTarget]) [page:Vector3]</h3>
 		<div>
 		<div>
-		optionalTarget -- todo
+		optionalTarget -- If specified, the result will be copied here.
 		</div>
 		</div>
 		<div>
 		<div>
-		todo
+		Returns the center point of this box.
 		</div>
 		</div>
 
 
-		<h3>.distanceToPoint([page:todo point]) [page:todo]</h3>
+		<h3>.getBoundingSphere([page:Sphere optionalTarget]) [page:Sphere]</h3>
 		<div>
 		<div>
-		point -- todo
+		optionalTarget -- [page:Sphere] to optionally set the result to.
 		</div>
 		</div>
 		<div>
 		<div>
-		todo
+		Gets a sphere that bounds the box.
 		</div>
 		</div>
 
 
-		<h3>.containsPoint([page:todo point]) [page:todo]</h3>
+		<h3>.distanceToPoint([page:Vector3 point]) [page:Float]</h3>
 		<div>
 		<div>
-		point -- todo
+		point -- Point to measure distance to.
 		</div>
 		</div>
 		<div>
 		<div>
-		todo
+		Returns the distance from any edge of this box to the specified point. </br>
+		If the point lies inside of this box, the distance will be 0.
 		</div>
 		</div>
 
 
-		<h3>.setFromCenterAndSize([page:todo center], [page:todo size]) [page:todo]</h3>
+		<h3>.setFromCenterAndSize([page:Vector3 center], [page:Vector3 size]) [page:Box3 this]</h3>
 		<div>
 		<div>
-		center -- todo <br />
-		size -- todo
+		center -- Desired center position of the box. <br />
+		size -- Desired x and y dimensions of the box. 
 		</div>
 		</div>
 		<div>
 		<div>
-		todo
+		Centers this box on *center* and sets this box's width and height to the values specified
+		in *size*.
 		</div>
 		</div>
 
 
 		<h2>Source</h2>
 		<h2>Source</h2>

+ 2 - 0
src/math/Box3.js

@@ -54,6 +54,8 @@ THREE.Box3.prototype = {
 			this.max.z = point.z;
 			this.max.z = point.z;
 
 
 		}
 		}
+		
+		return this;
 
 
 	},
 	},