protected PointF getAbsolutePositionOfSubobject(MultiTouchDrawable subobject) { float xBeforeRotate = this.minX + subobject.getRelativeX() * scaleX; float yBeforeRotate = this.minY + subobject.getRelativeY() * scaleY; float radius = (float) Math.sqrt( Math.pow(Math.abs(centerX - xBeforeRotate), 2) + Math.pow(Math.abs(centerY - yBeforeRotate), 2)); float angleBeforeRotate = (float) Math.atan2(yBeforeRotate - centerY, xBeforeRotate - centerX); float newAngle = angle + angleBeforeRotate; float newY = (float) (centerY + radius * Math.sin(newAngle)); float newX = (float) (centerX + radius * Math.cos(newAngle)); // Move the drawable according to it's pivot point if one is set if (subobject.isCustomPivotUsed()) { if (subobject.angle == 0.0f) { newX -= subobject.getPivotXRelativeToCenter() * subobject.scaleX; newY -= subobject.getPivotYRelativeToCenter() * subobject.scaleY; } else { PointF pivotPosition = subobject.getPivotPointPositionConsideringScalingAndAngle(); newX -= pivotPosition.x; newY -= pivotPosition.y; } } return new PointF(newX, newY); }