protected PointF getRelativePositionToSuperobject() { float x = centerX; float y = centerY; if (this.isCustomPivotUsed()) { if (this.angle == 0.0f) { x += this.getPivotXRelativeToCenter() * this.scaleX; y += this.getPivotYRelativeToCenter() * this.scaleY; } else { PointF pivotPosition = this.getPivotPointPositionConsideringScalingAndAngle(); x += pivotPosition.x; y += pivotPosition.y; } } float superAngle = superDrawable.angle; float angleToCenter = (float) Math.atan2(y - superDrawable.centerY, x - superDrawable.centerX); float angle = superAngle - angleToCenter; float radius = (float) Math.sqrt( Math.pow(Math.abs(x - superDrawable.centerX), 2) + Math.pow(Math.abs(y - superDrawable.centerY), 2)) / superDrawable.scaleX; float newX = (float) (radius * Math.cos(angle) + superDrawable.getWidth() / 2); float newY = (float) (radius * Math.sin(angle * -1) + superDrawable.getHeight() / 2); return new PointF(newX, newY); }