As says:
Math.sqrt (Math.pow (p1._x-p2._x), 2) +math.pow ((p1._y-p2._y), 2)
From this formula you can deduce the formula of distance from a point to the origin:
Because the origin coordinates are (0,0), the formula is deformed as follows
MATH.SQRT (p1._x * p1._x + p1._y * p1._y)
Here we'll use these two formulas to make some effects.
Instance one: Rotate the pointer
Ideas:
A number of theta methods for an angle are as follows:
sine function sinθ=y/r
cosine function cosθ=x/r
Tangent function tanθ=y/x
cotangent function cotθ=x/y
secant function secθ=r/x
Residual cut function cscθ=r/y
These trigonometric functions can be used to find the same angle θ.
In this instance, only Atan and ACOs are used instead of other trigonometric functions because their return value is an arbitrary number, while the return value of the other function is a qualified number.