Changeset 2201


Ignore:
Timestamp:
02/01/07 16:00:32 (13 years ago)
Author:
curtis
Message:

Fix bug in domainToPixel (use 0 instead of Double.NaN for missing axes).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/visbio/util/DisplayUtil.java

    r2199 r2201  
    391391    double[] domain = new double[3]; 
    392392    for (int i=0; i<3; i++) { 
    393       domain[i] = scale[i] == null ? Double.NaN : 
     393      domain[i] = scale[i] == null ? 0 : 
    394394        (cursor[i] - scale[i][1]) / scale[i][0]; 
    395395    } 
     396    System.out.println("cursorToDomain cursor=" + cursor[0] + "," + cursor[1] + "; domain=" + domain[0] + "," + domain[1]);//TEMP 
    396397    return domain; 
    397398  } 
     
    405406    double[] cursor = new double[3]; 
    406407    for (int i=0; i<3; i++) { 
    407       cursor[i] = scale[i] == null ? Double.NaN : 
     408      cursor[i] = scale[i] == null ? 0 : 
    408409        scale[i][0] * domain[i] + scale[i][1]; 
    409410    } 
     411    System.out.println("domainToCursor cursor=" + cursor[0] + "," + cursor[1] + "; domain=" + domain[0] + "," + domain[1]);//TEMP 
    410412    return cursor; 
    411413  } 
     
    426428    MouseBehavior mb = d.getDisplayRenderer().getMouseBehavior(); 
    427429    VisADRay ray = mb.findRay(x, y); 
     430    System.out.println("pixelToCursor: cursor=" + ray.position[0] + "," + ray.position[1] + "; pixel=" + x + "," + y);//TEMP 
    428431    return ray.position; 
    429432  } 
     
    433436    if (d == null) return null; 
    434437    MouseBehavior mb = d.getDisplayRenderer().getMouseBehavior(); 
    435     return mb.getScreenCoords(cursor); 
     438    int[] pixel = mb.getScreenCoords(cursor); 
     439    System.out.println("cursorToPixel: cursor=" + cursor[0] + "," + cursor[1] + "; pixel=" + pixel[0] + "," + pixel[1]);//TEMP 
     440    return pixel; 
    436441  } 
    437442 
    438443  /** Converts the given pixel coordinates to domain coordinates. */ 
    439444  public static double[] pixelToDomain(DisplayImpl d, int x, int y) { 
    440     return cursorToDomain(d, pixelToCursor(d, x, y)); 
     445    double[] domain = cursorToDomain(d, pixelToCursor(d, x, y)); 
     446    int[] pixel = domainToPixel(d, domain);//TEMP 
     447    return domain; 
    441448  } 
    442449 
Note: See TracChangeset for help on using the changeset viewer.