c# - How to get coords inside a transformed sprite? -
i trying x , y coordinates inside transformed sprite. have simple 200x200 sprite rotates in middle of screen - origin of (0,0) keep things simple. i have written piece of code can transform mouse coordinates specified x or y value. int ox = (int)(mousepos.x - position.x); int oy = (int)(mousepos.y - position.y); relative.x = (float)((ox - (math.sin(rotation) * y /* problem here */)) / math.cos(rotation)); relative.y = (float)((oy + (math.sin(rotation) * x /* problem here */)) / math.cos(rotation)); how can achieve this? or how can fix equation? the general way express transformation matrix. way, can add other transformation later, if find need it. for given transformation, matrix is: var mat = matrix.createrotationz(rotation) * matrix.createtranslation(position); this matrix can interpreted system transformation sprite space world space. want inverse transformation - system transformation world space sprite space. var inv = matrix.invert(mat); you can tr...