@ Michael's suggestion is good. Following your code, I would use the Pythagorean theorem as follows:
side1 = Math.sqrt( Math.pow((side2x - side1x), 2) + Math.pow((side2y - side1y), 2));
In your code:
side1 = Math.pow( Math.pow((side2x - side1x), 2) + Math.pow((side2y - side1y), 2) * .05 , side1);
side1 0 before calculation, and almost all power 0 is 1. Therefore side1 ends as 1 regardless of the points.
source share