Generated on Fri Oct 6 16:26:43 2006 for Gecode/J by doxygen 1.4.7

BoundingBox.java

Go to the documentation of this file.
00001 /*
00002  *  Main authors:
00003  *     Guido Tack <tack@gecode.org>
00004  *
00005  *  Copyright:
00006  *     Guido Tack, 2006
00007  *
00008  *  Last modified:
00009  *     $Date: 2006-02-09 16:32:56 +0100 (Thu, 09 Feb 2006) $ by $Author: tack $
00010  *     $Revision: 2943 $
00011  *
00012  *  This file is part of Gecode, the generic constraint
00013  *  development environment:
00014  *     http://www.gecode.org
00015  *
00016  *  See the file "LICENSE" for information on usage and
00017  *  redistribution of this file, and for a
00018  *     DISCLAIMER OF ALL WARRANTIES.
00019  *
00020  */
00021 
00022 package org.gecode.explorer.postscript;
00023 
00024 class BoundingBox {
00025     int minx, maxx;
00026     int miny, maxy;
00027 
00028     public BoundingBox(int minx0, int maxx0, int miny0, int maxy0) {
00029         minx = minx0;
00030         maxx = maxx0;
00031         miny = miny0;
00032         maxy = maxy0;
00033     }
00034 
00035     public void merge(BoundingBox b) {
00036         if (b.minx < minx) minx = b.minx;
00037         if (b.maxx > maxx) maxx = b.maxx;
00038         if (b.miny < miny) miny = b.miny;
00039         if (b.maxy > maxy) maxy = b.maxy;
00040     }
00041 
00042     public void translate(double scale, double translatex, double translatey) {
00043         minx = (int) (((double)minx)*scale+translatex);
00044         maxx = (int) (((double)maxx)*scale+translatex);
00045         miny = (int) (((double)miny)*scale+translatey);
00046         maxy = (int) (((double)maxy)*scale+translatey);
00047     }
00048 }