Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public APPoint getTopRight()
- {
- double x = myWidth * Math.cos( myAngle );
- double y = myWidth * Math.sin( myAngle );
- return new APPoint( myTopLeft.getX() + x,
- myTopLeft.getY() - y );
- }
- public APPoint getBottomRight()
- {
- APPoint tr = getTopRight();
- double x = myHeight * Math.sin( myAngle );
- double y = myHeight * Math.cos( myAngle );
- return new APPoint( tr.getX() + x,
- tr.getY() + y );
- }
- public APPoint getBottomLeft()
- {
- APPoint tl = getTopLeft();
- double x = myHeight * Math.sin( myAngle );
- double y = myHeight * Math.cos( myAngle );
- return new APPoint( tl.getX() + x,
- tl.getY() + y );
- }
- public void draw( Graphics g )
- {
- APPoint topLeft = myTopLeft;
- APPoint topRight = getTopRight();
- APPoint bottomLeft = getBottomLeft();
- APPoint bottomRight = getBottomRight();
- g.drawLine( (int)topLeft.getX(), (int)topLeft.getY(), (int)topRight.getX(), (int)topRight.getY() );
- g.drawLine( (int)bottomLeft.getX(), (int)topLeft.getY(), (int)bottomLeft.getX(), (int)bottomRight.getY());
- g.drawLine( (int)bottomLeft.getX(), (int)bottomRight.getY(), (int)topRight.getX(), (int)bottomRight.getY());
- g.drawLine( (int)topRight.getX(), (int)bottomRight.getY(), (int)topRight.getX(), (int)topRight.getY());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement