Package java.awt.geom

Examples of java.awt.geom.Rectangle2D.outcode()


  public void testOutcode() {
    Point2D pInexact = new Point2D.Double(), pExact = new Point2D.Double();
    Rectangle2D rect = new Rectangle2D.Double(0, 0, 10, 10);
    pExact.setLocation(10, 5);
    pInexact.setLocation(10.00001, 5.00001);
    assertEquals("regular outcode() says outside", 4, rect.outcode(pInexact));
    assertEquals("custom outcode() should say inside", 0,
      GeometryUtil.getInstance().outcode(rect, pInexact));
  }

  /**
 
View Full Code Here


        // <<<< Get visible line candidates of these obstacles >>>>
        Vector<Line2D> visibleLineCandidates = new Vector<Line2D>();
        for (int i=0; i < visibleObstacleCandidates.size(); i++) {
          Rectangle2D obstacle = visibleObstacleCandidates.get(i);
          int outcode = obstacle.outcode(source);

          if ((outcode & Rectangle2D.OUT_BOTTOM) != 0) {
            visibleLineCandidates.add(
                new Line2D.Double(obstacle.getMinX(), obstacle.getMaxY(), obstacle.getMaxX(), obstacle.getMaxY()));
          }
View Full Code Here

     *   Right and above are prioritized higher than left and below.
     * @return
     */
    private static final <G,V> InnerNode<G,V> growUp(DynamicQuadTree.InnerNode<G,V> current, Rectangle2D toward) {
      Rectangle2D currentBounds = current.concernBounds();
      int outCode = currentBounds.outcode(toward.getX(), toward.getY());
     
      if (toward.intersects(currentBounds)
          || outCode ==0) {
        //If the new glyph touches the current bounds, then grow with the current data in the center.
        Rectangle2D newBounds = new Rectangle2D.Double(
View Full Code Here

        // <<<< Get visible line candidates of these obstacles >>>>
        Vector<Line2D> visibleLineCandidates = new Vector<Line2D>();
        for (int i=0; i < visibleObstacleCandidates.size(); i++) {
          Rectangle2D obstacle = visibleObstacleCandidates.get(i);
          int outcode = obstacle.outcode(source);

          if ((outcode & Rectangle2D.OUT_BOTTOM) != 0) {
            visibleLineCandidates.add(
                new Line2D.Double(obstacle.getMinX(), obstacle.getMaxY(), obstacle.getMaxX(), obstacle.getMaxY()));
          }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.