java - Translate point coordinates to image -


how translate cartesian point coordinates bufferedimage pixels top left corner? question in context of plotting 2d math functions.

let image of height h , width w limited (ymin,ymax) , (xmin,xmax).

so far i've managed translate x coordinates, have no idea second dimension.

private int transformx(double x) {               return (int)((double)w*(x-xmin)/(xmax-xmin)); }  private int transformy(double x) {               ? } 

@update

it's not homework. transformy more complex because y axis reversed.

private int transformy(double y)       {                   return (int)((double)h*(-y+ymax)/(ymax-ymin));       } 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -