*/
public void setClipping(Vector min, Vector max) throws UnableToComplyException {
// if only one dimension was given, expand to all dimensions.
if(min.getDimensionality() == 1 && max.getDimensionality() == 1) {
if(min.get(0) >= max.get(0)) {
throw new UnableToComplyException("Clipping range empty.");
}
clipmin = new Vector(dim);
clipmax = new Vector(dim);
for(int i = 0; i < dim; i++) {
clipmin.set(i, min.get(0));
clipmax.set(i, max.get(0));
}
return;
}
if(dim != min.getDimensionality()) {
throw new UnableToComplyException("Clipping vector dimensionalities do not match: " + dim + " vs. " + min.getDimensionality());
}
if(dim != max.getDimensionality()) {
throw new UnableToComplyException("Clipping vector dimensionalities do not match: " + dim + " vs. " + max.getDimensionality());
}
for(int i = 0; i < dim; i++) {
if(min.get(i) >= max.get(i)) {
throw new UnableToComplyException("Clipping range empty in dimension " + (i + 1));
}
}
clipmin = min;
clipmax = max;
}