*/
public void setClipping(Vector min, Vector max) throws UnableToComplyException {
// if only one dimension was given, expand to all dimensions.
if(min.getRowDimensionality() == 1 && max.getRowDimensionality() == 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, 0, min.get(0));
clipmax.set(i, 0, max.get(0));
}
return;
}
if(dim != min.getRowDimensionality()) {
throw new UnableToComplyException("Clipping vector dimensionalities do not match: " + dim + " vs. " + min.getRowDimensionality());
}
if(dim != max.getRowDimensionality()) {
throw new UnableToComplyException("Clipping vector dimensionalities do not match: " + dim + " vs. " + max.getRowDimensionality());
}
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;
}