Rotated Ellipse Collision Detection – Konva

I am currently working on Ellipse collision detection. I found a calculation for ellipse collison but it is not working for rotated ellipse with certain angle. I have the angle of rotation and ellipse coordinates , semi-major and semi-minor axis but the could not be able to fix the issue. Is there any library available for it or can you help me with this Problem.

Here is the calculation i have,

var dx= mousepointx – x;
var dy=mousepointy – y;

a- semi- major axis
b – semi minor axis
mousepointx, mousepointy- the point which i check for collision

((dxdx)/(aa)+(dydy)/(bb) <= 1);

and for rotated ellipse which i am currently having,

(((aa ) (Math.pow(Math.sin(angle), 2)) + bb * (Math.pow(Math.cos(angle), 2)) ) * dxdx + 2 * (bb – aa) * (Math.sin(angle)) * (Math.cos(angle)) * (dx * dy) + ((a * a) * (Math.pow(Math.cos(angle), 2)) + (bb) * (Math.pow(Math.sin(angle), 2)) ) * (dydy) <= aab*b );

which is not working. Thanks for the help.