resizing a rotated rect
in
Programming Questions
•
7 months ago
Would like to resize a rotated rectangle by changing the position of one corner to the position of the mouse.
Unclear of the best way to do this... open to ideas.
- int topCornerX = 100;
- int topCornerY = 100;
- int degreesRot = 30;
- void setup( ) {
- size( 500, 500 );
- }
- void draw( ) {
- background( 255, 0, 0 );
- pushMatrix( );
- translate( topCornerX, topCornerY );
- rotate( radians(degreesRot) );
- stroke( 0 );
- fill( 255 );
- rectMode( CORNER );
- rect( 0, 0, 100, 100 );
- ellipseMode( CENTER );
- fill( 0, 255, 0 );
- ellipse( 100, 100, 10, 10 );
- popMatrix( );
- noStroke( );
- fill( 0, 0, 255 );
- ellipseMode( CENTER );
- ellipse( mouseX, mouseY, 10, 10 );
- }
1