浏览代码

added offset()

ncannasse 12 年之前
父节点
当前提交
ca4a71b4de
共有 2 个文件被更改,包括 16 次插入0 次删除
  1. 7 0
      h2d/col/Bounds.hx
  2. 9 0
      h3d/col/Bounds.hx

+ 7 - 0
h2d/col/Bounds.hx

@@ -58,6 +58,13 @@ class Bounds {
 		yMax = my + dy * v;
 	}
 	
+	public inline function offset( dx : Float, dy : Float ) {
+		xMin += dx;
+		xMax += dx;
+		yMin += dy;
+		yMax += dy;
+	}
+	
 	public inline function getMin() {
 		return new Point(xMin, yMin);
 	}

+ 9 - 0
h3d/col/Bounds.hx

@@ -150,6 +150,15 @@ class Bounds {
 		this.zMax = zMax;
 	}
 	
+	public inline function offset( dx : Float, dy : Float, dz : Float ) {
+		xMin += dx;
+		xMax += dx;
+		yMin += dy;
+		yMax += dy;
+		zMin += dz;
+		zMax += dz;
+	}
+	
 	public inline function setMin( p : Vector ) {
 		xMin = p.x;
 		yMin = p.y;