1 /**
  2  * The Render Engine
  3  * AABBHull
  4  *
  5  * @fileoverview A collision shape which represents an object's bounding box
  6  *                   as the convex hull.
  7  *
  8  * @author: Brett Fattori (brettf@renderengine.com)
  9  *
 10  * @author: $Author: bfattori $
 11  * @version: $Revision: 1555 $
 12  *
 13  * Copyright (c) 2011 Brett Fattori (brettf@renderengine.com)
 14  *
 15  * Permission is hereby granted, free of charge, to any person obtaining a copy
 16  * of this software and associated documentation files (the "Software"), to deal
 17  * in the Software without restriction, including without limitation the rights
 18  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 19  * copies of the Software, and to permit persons to whom the Software is
 20  * furnished to do so, subject to the following conditions:
 21  *
 22  * The above copyright notice and this permission notice shall be included in
 23  * all copies or substantial portions of the Software.
 24  *
 25  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 26  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 27  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 28  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 29  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 30  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 31  * THE SOFTWARE.
 32  *
 33  */
 34 
 35 // The class this file defines and its required classes
 36 R.Engine.define({
 37     "class":"R.collision.OBBHull",
 38     "requires":[
 39         "R.collision.ConvexHull",
 40         "R.math.Point2D"
 41     ]
 42 });
 43 
 44 /**
 45  * @class A rectangular convex hull.
 46  *
 47  * @param boundingBox {Rectangle2D} The object's bounding box
 48  *
 49  * @extends R.collision.ConvexHull
 50  * @constructor
 51  * @description Creates an Object Bounding Box hull.
 52  */
 53 R.collision.OBBHull = function () {
 54     "use strict";
 55     return R.collision.ConvexHull.extend(/** @scope R.collision.OBBHull.prototype */{
 56 
 57         /** @private */
 58         constructor:function (rect) {
 59             var points = [R.math.Point2D.create(0, 0), R.math.Point2D.create(rect.w, 0), R.math.Point2D.create(rect.w, rect.h), R.math.Point2D.create(0, rect.h)];
 60             this.base(points);
 61         }
 62 
 63     }, /** @scope R.collision.OBBHull.prototype */{
 64         /**
 65          * Get the class name of this object
 66          * @return {String} "R.collision.OBBHull"
 67          */
 68         getClassName:function () {
 69             return "R.collision.OBBHull";
 70         }
 71     });
 72 
 73 }