1 /**
  2  * @author mrdoob / http://mrdoob.com/
  3  */
  4 
  5 /**@constructor*/
  6 THREE.Rectangle = function () {
  7 
  8 	var _left = 0;
  9 	var _top = 0;
 10 	var _right = 0;
 11 	var _bottom = 0;
 12 	var _width = 0;
 13 	var _height = 0;
 14 	var _isEmpty = true;
 15 
 16 	function resize() {
 17 
 18 		_width = _right - _left;
 19 		_height = _bottom - _top;
 20 
 21 	}
 22 
 23 	this.getX = function () {
 24 
 25 		return _left;
 26 
 27 	};
 28 
 29 	this.getY = function () {
 30 
 31 		return _top;
 32 
 33 	};
 34 
 35 	this.getWidth = function () {
 36 
 37 		return _width;
 38 
 39 	};
 40 
 41 	this.getHeight = function () {
 42 
 43 		return _height;
 44 
 45 	};
 46 
 47 	this.getLeft = function() {
 48 
 49 		return _left;
 50 
 51 	};
 52 
 53 	this.getTop = function() {
 54 
 55 		return _top;
 56 
 57 	};
 58 
 59 	this.getRight = function() {
 60 
 61 		return _right;
 62 
 63 	};
 64 
 65 	this.getBottom = function() {
 66 
 67 		return _bottom;
 68 
 69 	};
 70 
 71 	this.set = function ( left, top, right, bottom ) {
 72 
 73 		_isEmpty = false;
 74 
 75 		_left = left; _top = top;
 76 		_right = right; _bottom = bottom;
 77 
 78 		resize();
 79 
 80 	};
 81 
 82 	this.addPoint = function ( x, y ) {
 83 
 84 		if ( _isEmpty === true ) {
 85 
 86 			_isEmpty = false;
 87 			_left = x; _top = y;
 88 			_right = x; _bottom = y;
 89 
 90 			resize();
 91 
 92 		} else {
 93 
 94 			_left = _left < x ? _left : x; // Math.min( _left, x );
 95 			_top = _top < y ? _top : y; // Math.min( _top, y );
 96 			_right = _right > x ? _right : x; // Math.max( _right, x );
 97 			_bottom = _bottom > y ? _bottom : y; // Math.max( _bottom, y );
 98 
 99 			resize();
100 		}
101 
102 	};
103 
104 	this.add3Points = function ( x1, y1, x2, y2, x3, y3 ) {
105 
106 		if ( _isEmpty === true ) {
107 
108 			_isEmpty = false;
109 			_left = x1 < x2 ? ( x1 < x3 ? x1 : x3 ) : ( x2 < x3 ? x2 : x3 );
110 			_top = y1 < y2 ? ( y1 < y3 ? y1 : y3 ) : ( y2 < y3 ? y2 : y3 );
111 			_right = x1 > x2 ? ( x1 > x3 ? x1 : x3 ) : ( x2 > x3 ? x2 : x3 );
112 			_bottom = y1 > y2 ? ( y1 > y3 ? y1 : y3 ) : ( y2 > y3 ? y2 : y3 );
113 
114 			resize();
115 
116 		} else {
117 
118 			_left = x1 < x2 ? ( x1 < x3 ? ( x1 < _left ? x1 : _left ) : ( x3 < _left ? x3 : _left ) ) : ( x2 < x3 ? ( x2 < _left ? x2 : _left ) : ( x3 < _left ? x3 : _left ) );
119 			_top = y1 < y2 ? ( y1 < y3 ? ( y1 < _top ? y1 : _top ) : ( y3 < _top ? y3 : _top ) ) : ( y2 < y3 ? ( y2 < _top ? y2 : _top ) : ( y3 < _top ? y3 : _top ) );
120 			_right = x1 > x2 ? ( x1 > x3 ? ( x1 > _right ? x1 : _right ) : ( x3 > _right ? x3 : _right ) ) : ( x2 > x3 ? ( x2 > _right ? x2 : _right ) : ( x3 > _right ? x3 : _right ) );
121 			_bottom = y1 > y2 ? ( y1 > y3 ? ( y1 > _bottom ? y1 : _bottom ) : ( y3 > _bottom ? y3 : _bottom ) ) : ( y2 > y3 ? ( y2 > _bottom ? y2 : _bottom ) : ( y3 > _bottom ? y3 : _bottom ) );
122 
123 			resize();
124 
125 		};
126 
127 	};
128 
129 	this.addRectangle = function ( r ) {
130 
131 		if ( _isEmpty === true ) {
132 
133 			_isEmpty = false;
134 			_left = r.getLeft(); _top = r.getTop();
135 			_right = r.getRight(); _bottom = r.getBottom();
136 
137 			resize();
138 
139 		} else {
140 
141 			_left = _left < r.getLeft() ? _left : r.getLeft(); // Math.min(_left, r.getLeft() );
142 			_top = _top < r.getTop() ? _top : r.getTop(); // Math.min(_top, r.getTop() );
143 			_right = _right > r.getRight() ? _right : r.getRight(); // Math.max(_right, r.getRight() );
144 			_bottom = _bottom > r.getBottom() ? _bottom : r.getBottom(); // Math.max(_bottom, r.getBottom() );
145 
146 			resize();
147 
148 		}
149 
150 	};
151 
152 	this.inflate = function ( v ) {
153 
154 		_left -= v; _top -= v;
155 		_right += v; _bottom += v;
156 
157 		resize();
158 
159 	};
160 
161 	this.minSelf = function ( r ) {
162 
163 		_left = _left > r.getLeft() ? _left : r.getLeft(); // Math.max( _left, r.getLeft() );
164 		_top = _top > r.getTop() ? _top : r.getTop(); // Math.max( _top, r.getTop() );
165 		_right = _right < r.getRight() ? _right : r.getRight(); // Math.min( _right, r.getRight() );
166 		_bottom = _bottom < r.getBottom() ? _bottom : r.getBottom(); // Math.min( _bottom, r.getBottom() );
167 
168 		resize();
169 
170 	};
171 
172 	this.intersects = function ( r ) {
173 
174 		// http://gamemath.com/2011/09/detecting-whether-two-boxes-overlap/
175 
176 		if ( _right < r.getLeft() ) return false;
177 		if ( _left > r.getRight() ) return false;
178 		if ( _bottom < r.getTop() ) return false;
179 		if ( _top > r.getBottom() ) return false;
180 
181 		return true;
182 
183 	};
184 
185 	this.empty = function () {
186 
187 		_isEmpty = true;
188 
189 		_left = 0; _top = 0;
190 		_right = 0; _bottom = 0;
191 
192 		resize();
193 
194 	};
195 
196 	this.isEmpty = function () {
197 
198 		return _isEmpty;
199 
200 	};
201 
202 };
203 

nike free rn new balance hombre baratas cinturones gucci ugg rebajas cinturon gucci ray ban baratas nike cortez peuterey mujer christian louboutin madrid mbt zapatos gafas ray ban baratas mbt ofertas air max blancas mbt barcelona nike air max 90 woolrich barcelona nike mujer botas ugg gafas de sol carrera aratas air max 2016 baratas oakley baratas nike air max 2016

mbt skor nike sverige louboutin skor hollister sverige polo ralph lauren skjorta woolrich jacka dam canada goose jacka woolrich jacka ray ban rea canada goose rea michael kors rea new balance skor ralph lauren skjorta new balance rea uggs sverige lacoste rea christian louboutin skor moncler jacka nike shox barbour jacka uggs rea