/ Clamp a vector to a bounding box.
431001
function(bb, v)
{
    var x = min(max(bb.l, v.x), bb.r);
    var y = min(max(bb.b, v.y), bb.t);
    return new Vect(x, y);
}
1248493
function clamp(num, min, max) {
        return num < min?  min
             : num > max?  max
             :             num
    }
725924
public static float clamp (float v, float lower, float upper) {
        if (v < lower) return lower;
        else if (v > upper) return upper;
        else return v;
    }
510165
def clamp(min, max)
      value = self
      value = [value, min].max if min
      value = [value, max].min if max
      value
    end
905921
public static BoundingBox getProjectedBoundingBox(Projection projection,
			long x, long y, int zoom) {

		BoundingBox boundingBox = getWebMercatorBoundingBox(x, y, zoom);

		if (projection != null) {
			ProjectionTransform transform = webMercator
					.getTransformation(projection);
			boundingBox = boundingBox.transform(transform);
		}

		return boundingBox;
	}
49300
public static double Clamp(double x, double min, double max) {
        if (x < min)
            return min;
        if (x > max)
            return max;
        return x;
    }
1373736
def bound(self, p1, p2=None):
    """"""
    r = Rect(p1, p2)
    return Point(min(max(self.x, r.l), r.r), min(max(self.y, r.t), r.b))
1044457
static double clamp(double x, double low, double high) {
        return x < low ? low : (x > high ? high : x);
    }
854371
function clampSelf(low, high) {
         return this._set(me.Math.clamp(this.x, low, high), me.Math.clamp(this.y, low, high));
       }
53683
def bounds_handler(ctx, param, value):
    """"""
    retval = from_like_context(ctx, param, value)
    if retval is None and value is not None:
        try:
            value = value.strip(", []")
            retval = tuple(float(x) for x in re.split(r"[,\s]+", value))
            assert len(retval) == 4
            return retval
        except Exception:
            raise click.BadParameter(
                "{0!r} is not a valid bounding box representation".format(value)
            )
    else:  # pragma: no cover
        return retval
1100702
def clamp_within_range(self, x, y):
        
        x = int(x)
        y = int(y)

        if x < 0:
            x = 0
        if y < 0:
            y = 0
        if x > self.size_in_tiles.X:
            x = self.size_in_tiles.X
        if y > self.size_in_tiles.Y:
            y = self.size_in_tiles.Y

        return x, y
603251
def get_bounding_box(self, crs):
        """"""
        return self.from_bounds(*self.get_bounds(crs), crs=crs)
894471
function(min, max) {
    return function limitVfov(params) {
      params.fov = clamp(params.fov, min, max);
      return params;
    };
  }
499596
def bounding_box(dset):
    ''''''
    o = nl.run(["3dAutobox","-input",dset])
    ijk_coords = re.findall(r'[xyz]=(\d+)\.\.(\d+)',o.output)
    from_rai = ijk_to_xyz(dset,[float(x[0]) for x in ijk_coords])
    to_rai = ijk_to_xyz(dset,[float(x[1]) for x in ijk_coords])
    return (from_rai,to_rai)
1325520
function () {
        var bbox = this.boundingBox;
        if (!bbox) {
            bbox = this.boundingBox = new BoundingBox();
        }
        var posArr = this.attributes.position.value;
        if (posArr && posArr.length) {
            var min = bbox.min;
            var max = bbox.max;
            var minArr = min.array;
            var maxArr = max.array;
            vec3.set(minArr, posArr[0], posArr[1], posArr[2]);
            vec3.set(maxArr, posArr[0], posArr[1], posArr[2]);
            for (var i = 3; i < posArr.length;) {
                var x = posArr[i++];
                var y = posArr[i++];
                var z = posArr[i++];
                if (x < minArr[0]) { minArr[0] = x; }
                if (y < minArr[1]) { minArr[1] = y; }
                if (z < minArr[2]) { minArr[2] = z; }

                if (x > maxArr[0]) { maxArr[0] = x; }
                if (y > maxArr[1]) { maxArr[1] = y; }
                if (z > maxArr[2]) { maxArr[2] = z; }
            }
            min._dirty = true;
            max._dirty = true;
        }
    }
7421
def bounding_box_oriented(self):
        
        from . import primitives, bounds
        to_origin, extents = bounds.oriented_bounds(self)
        obb = primitives.Box(transform=np.linalg.inv(to_origin),
                             extents=extents,
                             mutable=False)
        return obb
850666
def calculate_bounding_box(data):
    
    mins = data.min(0)
    maxes = data.max(0)
    return mins, maxes