本文整理汇总了Java中org.andengine.util.math.MathUtils.rotateAroundCenter方法的典型用法代码示例。如果您正苦于以下问题:Java MathUtils.rotateAroundCenter方法的具体用法?Java MathUtils.rotateAroundCenter怎么用?Java MathUtils.rotateAroundCenter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.andengine.util.math.MathUtils
的用法示例。
在下文中一共展示了MathUtils.rotateAroundCenter方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSceneCoordinatesFromSurfaceCoordinates
import org.andengine.util.math.MathUtils; //导入方法依赖的package包/类
public float[] getSceneCoordinatesFromSurfaceCoordinates(final float[] pSurfaceCoordinates, final int pSurfaceWidth, final int pSurfaceHeight) {
final float relativeX;
final float relativeY;
final float rotation = this.mRotation;
if (rotation == 0) {
relativeX = pSurfaceCoordinates[Constants.VERTEX_INDEX_X] / pSurfaceWidth;
relativeY = 1 - (pSurfaceCoordinates[Constants.VERTEX_INDEX_Y] / pSurfaceHeight);
} else if (rotation == 180) {
relativeX = 1 - (pSurfaceCoordinates[Constants.VERTEX_INDEX_X] / pSurfaceWidth);
relativeY = pSurfaceCoordinates[Constants.VERTEX_INDEX_Y] / pSurfaceHeight;
} else {
MathUtils.rotateAroundCenter(pSurfaceCoordinates, rotation, pSurfaceWidth >> 1, pSurfaceHeight >> 1); // TODO Use a Transformation object instead!?!
relativeX = pSurfaceCoordinates[Constants.VERTEX_INDEX_X] / pSurfaceWidth;
relativeY = 1 - (pSurfaceCoordinates[Constants.VERTEX_INDEX_Y] / pSurfaceHeight);
}
this.convertAxisAlignedSurfaceCoordinatesToSceneCoordinates(pSurfaceCoordinates, relativeX, relativeY);
return pSurfaceCoordinates;
}
示例2: convertSurfaceTouchEventToSceneTouchEvent
import org.andengine.util.math.MathUtils; //导入方法依赖的package包/类
public void convertSurfaceTouchEventToSceneTouchEvent(final TouchEvent pSurfaceTouchEvent, final int pSurfaceWidth, final int pSurfaceHeight) {
final float relativeX;
final float relativeY;
final float surfaceTouchEventX = pSurfaceTouchEvent.getX();
final float surfaceTouchEventY = pSurfaceTouchEvent.getY();
final float rotation = this.mRotation;
if (rotation == 0) {
relativeX = surfaceTouchEventX / pSurfaceWidth;
relativeY = 1 - (surfaceTouchEventY / pSurfaceHeight);
} else if (rotation == 180) {
relativeX = 1 - (surfaceTouchEventX / pSurfaceWidth);
relativeY = surfaceTouchEventY / pSurfaceHeight;
} else {
Camera.VERTICES_TMP[Constants.VERTEX_INDEX_X] = surfaceTouchEventX;
Camera.VERTICES_TMP[Constants.VERTEX_INDEX_Y] = surfaceTouchEventY;
MathUtils.rotateAroundCenter(Camera.VERTICES_TMP, rotation, pSurfaceWidth >> 1, pSurfaceHeight >> 1); // TODO Use a Transformation object instead!?!
relativeX = Camera.VERTICES_TMP[Constants.VERTEX_INDEX_X] / pSurfaceWidth;
relativeY = 1 - (Camera.VERTICES_TMP[Constants.VERTEX_INDEX_Y] / pSurfaceHeight);
}
this.convertAxisAlignedSurfaceTouchEventToSceneTouchEvent(pSurfaceTouchEvent, relativeX, relativeY);
}
示例3: convertSurfaceToSceneTouchEvent
import org.andengine.util.math.MathUtils; //导入方法依赖的package包/类
public void convertSurfaceToSceneTouchEvent(final TouchEvent pSurfaceTouchEvent, final int pSurfaceWidth, final int pSurfaceHeight) {
final float relativeX;
final float relativeY;
final float surfaceTouchEventX = pSurfaceTouchEvent.getX();
final float surfaceTouchEventY = pSurfaceTouchEvent.getY();
final float rotation = this.mRotation;
if(rotation == 0) {
relativeX = surfaceTouchEventX / pSurfaceWidth;
relativeY = surfaceTouchEventY / pSurfaceHeight;
} else if(rotation == 180) {
relativeX = 1 - (surfaceTouchEventX / pSurfaceWidth);
relativeY = 1 - (surfaceTouchEventY / pSurfaceHeight);
} else {
Camera.VERTICES_TMP[Constants.VERTEX_INDEX_X] = surfaceTouchEventX;
Camera.VERTICES_TMP[Constants.VERTEX_INDEX_Y] = surfaceTouchEventY;
MathUtils.rotateAroundCenter(Camera.VERTICES_TMP, rotation, pSurfaceWidth >> 1, pSurfaceHeight >> 1);
relativeX = Camera.VERTICES_TMP[Constants.VERTEX_INDEX_X] / pSurfaceWidth;
relativeY = Camera.VERTICES_TMP[Constants.VERTEX_INDEX_Y] / pSurfaceHeight;
}
this.convertAxisAlignedSurfaceToSceneTouchEvent(pSurfaceTouchEvent, relativeX, relativeY);
}
示例4: applyCameraSceneRotation
import org.andengine.util.math.MathUtils; //导入方法依赖的package包/类
private void applyCameraSceneRotation(final TouchEvent pSceneTouchEvent) {
final float cameraSceneRotation = this.mCameraSceneRotation;
if (cameraSceneRotation != 0) {
Camera.VERTICES_TMP[Constants.VERTEX_INDEX_X] = pSceneTouchEvent.getX();
Camera.VERTICES_TMP[Constants.VERTEX_INDEX_Y] = pSceneTouchEvent.getY();
MathUtils.rotateAroundCenter(Camera.VERTICES_TMP, cameraSceneRotation, this.getCameraSceneWidth() * 0.5f, this.getCameraSceneHeight() * 0.5f); // TODO Use a Transformation object instead!?!
pSceneTouchEvent.set(Camera.VERTICES_TMP[Constants.VERTEX_INDEX_X], Camera.VERTICES_TMP[Constants.VERTEX_INDEX_Y]);
}
}
示例5: applySceneRotation
import org.andengine.util.math.MathUtils; //导入方法依赖的package包/类
private void applySceneRotation(final TouchEvent pCameraSceneTouchEvent) {
final float rotation = this.mRotation;
if (rotation != 0) {
Camera.VERTICES_TMP[Constants.VERTEX_INDEX_X] = pCameraSceneTouchEvent.getX();
Camera.VERTICES_TMP[Constants.VERTEX_INDEX_Y] = pCameraSceneTouchEvent.getY();
MathUtils.rotateAroundCenter(Camera.VERTICES_TMP, rotation, this.getCenterX(), this.getCenterY()); // TODO Use a Transformation object instead!?!
pCameraSceneTouchEvent.set(Camera.VERTICES_TMP[Constants.VERTEX_INDEX_X], Camera.VERTICES_TMP[Constants.VERTEX_INDEX_Y]);
}
}
示例6: fillVertices
import org.andengine.util.math.MathUtils; //导入方法依赖的package包/类
private static void fillVertices(final Camera pCamera, final float[] pVertices) {
pVertices[0 + Constants.VERTEX_INDEX_X] = pCamera.getXMin();
pVertices[0 + Constants.VERTEX_INDEX_Y] = pCamera.getYMin();
pVertices[2 + Constants.VERTEX_INDEX_X] = pCamera.getXMax();
pVertices[2 + Constants.VERTEX_INDEX_Y] = pCamera.getYMin();
pVertices[4 + Constants.VERTEX_INDEX_X] = pCamera.getXMax();
pVertices[4 + Constants.VERTEX_INDEX_Y] = pCamera.getYMax();
pVertices[6 + Constants.VERTEX_INDEX_X] = pCamera.getXMin();
pVertices[6 + Constants.VERTEX_INDEX_Y] = pCamera.getYMax();
MathUtils.rotateAroundCenter(pVertices, pCamera.getRotation(), pCamera.getCenterX(), pCamera.getCenterY());
}
示例7: applyCameraSceneRotation
import org.andengine.util.math.MathUtils; //导入方法依赖的package包/类
private void applyCameraSceneRotation(final float[] pSceneCoordinates) {
final float cameraSceneRotation = this.mCameraSceneRotation;
if (cameraSceneRotation != 0) {
MathUtils.rotateAroundCenter(pSceneCoordinates, cameraSceneRotation, this.getCameraSceneWidth() * 0.5f, this.getCameraSceneHeight() * 0.5f); // TODO Use a Transformation object instead!?!
}
}
示例8: applySceneRotation
import org.andengine.util.math.MathUtils; //导入方法依赖的package包/类
private void applySceneRotation(final TouchEvent pCameraSceneTouchEvent) {
final float rotation = this.mRotation;
if(rotation != 0) {
Camera.VERTICES_TMP[Constants.VERTEX_INDEX_X] = pCameraSceneTouchEvent.getX();
Camera.VERTICES_TMP[Constants.VERTEX_INDEX_Y] = pCameraSceneTouchEvent.getY();
MathUtils.rotateAroundCenter(Camera.VERTICES_TMP, -rotation, this.getCenterX(), this.getCenterY());
pCameraSceneTouchEvent.set(Camera.VERTICES_TMP[Constants.VERTEX_INDEX_X], Camera.VERTICES_TMP[Constants.VERTEX_INDEX_Y]);
}
}
示例9: applyCameraSceneRotation
import org.andengine.util.math.MathUtils; //导入方法依赖的package包/类
private void applyCameraSceneRotation(final TouchEvent pSceneTouchEvent) {
final float cameraSceneRotation = -this.mCameraSceneRotation;
if(cameraSceneRotation != 0) {
Camera.VERTICES_TMP[Constants.VERTEX_INDEX_X] = pSceneTouchEvent.getX();
Camera.VERTICES_TMP[Constants.VERTEX_INDEX_Y] = pSceneTouchEvent.getY();
MathUtils.rotateAroundCenter(Camera.VERTICES_TMP, cameraSceneRotation, (this.mXMax - this.mXMin) * 0.5f, (this.mYMax - this.mYMin) * 0.5f);
pSceneTouchEvent.set(Camera.VERTICES_TMP[Constants.VERTEX_INDEX_X], Camera.VERTICES_TMP[Constants.VERTEX_INDEX_Y]);
}
}