'snap to' pixel after applying transformations

edited September 2015 in Questions about Code
//given these coordinates for a rectangle (which I will draw with rectmode CORNER)
float layerX = -50;
float layerY = -50;
float layerW = 100;
float layerH = 100;

//and these transformations
translate( 300, 0 );
scale( 12, 1.5 );
scale( .5, .5 );

//which project those coordinates here.
float sx = screenX( layerX, layerY );
float sy = screenY( layerX, layerY );
float sw = screenX( layerX+layerW, layerY+layerH );
float sh = screenY( layerX+layerW, layerY+layerH );

//(this spits out 0, -37.5, 600, 37.5)
println( sx, sy, sw, sh );

//how do I modify the transformation to 'snap' the transformed values to [0, -38, 600, 38], effectively snapping to the pixel (and widening the rectangle)?

Answers

Sign In or Register to comment.