コード例 #1
0
ファイル: BezRectangle.java プロジェクト: plural/IgnoCodeLib
 /**
  * @param vt1 a LineVertex for interpolation
  * @param r1 a source rectangle for mapping
  * @param r2 a destination rectangle for mapping
  * @return a LineVertex mapped to the destination rectangle
  */
 public static Vertex2DINF map(Vertex2DINF vt1, BezRectangle r1, BezRectangle r2) {
   double x0 = vt1.x();
   double vlo = r1.getLeft();
   double vhi = r1.getRight();
   double dlo = r2.getLeft();
   double dhi = r2.getRight();
   double x1 = BezRectangle.map(x0, vlo, vhi, dlo, dhi);
   double y0 = vt1.y();
   vlo = r1.getTop();
   vhi = r1.getBottom();
   dlo = r2.getTop();
   dhi = r2.getBottom();
   double y1 = BezRectangle.map(y0, vlo, vhi, dlo, dhi);
   return new LineVertex((float) x1, (float) y1);
 }
コード例 #2
0
ファイル: BezRectangle.java プロジェクト: plural/IgnoCodeLib
 /**
  * Determines if this rectangle overlaps a specified rectangle
  *
  * @param r the rectangle to check against this one
  * @return {@code true} if this rectangle overlaps r, {@code false} otherwise
  */
 public boolean overlaps(BezRectangle r) {
   return (r.getBottom() >= this.top
       && r.getTop() <= this.bottom
       && r.getRight() >= this.left
       && r.getLeft() <= this.right);
 }
コード例 #3
0
ファイル: BezRectangle.java プロジェクト: plural/IgnoCodeLib
 /**
  * @param x x-coordinate of point to test
  * @param y y-coordinate of point to test
  * @param r rectangle to test
  * @return {@code true} if r contains the specified point
  */
 public static boolean containsPoint(float x, float y, BezRectangle r) {
   return (x >= r.getLeft() && x <= r.getRight() && y >= r.getTop() && y <= r.getBottom());
 }
コード例 #4
0
ファイル: BezRectangle.java プロジェクト: plural/IgnoCodeLib
 /**
  * Determines if one rectangle overlaps another rectangle
  *
  * @param one one rectangle to check for overlap
  * @param another another rectangle to check for overlap
  * @return {@code true} if one rectangle overlaps another, {@code false} otherwise
  */
 public static boolean overlaps(BezRectangle one, BezRectangle another) {
   return (another.getBottom() >= one.getTop()
       && another.getTop() <= one.getBottom()
       && another.getRight() >= one.getLeft()
       && another.getLeft() <= one.getRight());
 }