¡@

Home 

java Programming Glossary: centery

Java 2d rotation in direction mouse point

http://stackoverflow.com/questions/11911316/java-2d-rotation-in-direction-mouse-point

Here's a simple implementation int centerX width 2 int centerY height 2 double angle Math.atan2 centerY mouseY centerX mouseX.. width 2 int centerY height 2 double angle Math.atan2 centerY mouseY centerX mouseX Math.PI 2 Graphics2D g .rotate angle centerX.. mouseX Math.PI 2 Graphics2D g .rotate angle centerX centerY g.fillRect ... draw your rectangle If you want to remove the..

How to rotate a vertex around a certain point?

http://stackoverflow.com/questions/12161277/how-to-rotate-a-vertex-around-a-certain-point

float distX Math.abs centerX point2X float distY Math.abs centerY point2Y float dist FloatMath.sqrt distX distX distY distY So.. newX centerX point2x centerX Math.cos x point2y centerY Math.sin x newY centerY point2x centerX Math.sin x point2y centerY.. point2x centerX Math.cos x point2y centerY Math.sin x newY centerY point2x centerX Math.sin x point2y centerY Math.cos x Note that..

How do I draw an arrowhead (in Android)?

http://stackoverflow.com/questions/6713757/how-do-i-draw-an-arrowhead-in-android

View Context mContext private int centerX private int centerY private int radius private double arrLength private int radius.. .getColor R.color.arrowColor centerX getWidth 2 centerY getHeight 2 arrLength radius 10 if centerX centerY radius centerX.. 2 centerY getHeight 2 arrLength radius 10 if centerX centerY radius centerX margin else radius centerY margin Draw Shaft..

AffineTransform truncates image, what do I wrong?

http://stackoverflow.com/questions/8719473/affinetransform-truncates-image-what-do-i-wrong

image.getHeight int w1 w0 int h1 h0 int centerX w0 2 int centerY h0 2 if numquadrants 2 1 w1 h0 h1 w0 if numquadrants 4 1 if.. 1 w1 h0 h1 w0 if numquadrants 4 1 if w0 h0 centerX h0 2 centerY h0 2 else if h0 w0 centerX w0 2 centerY w0 2 if h0 w0 then.. h0 centerX h0 2 centerY h0 2 else if h0 w0 centerX w0 2 centerY w0 2 if h0 w0 then use default else if numquadrants 4 3 if..