I may have just thought of something big that would get rid of a lot of lag in some projects. I do not know if people use this method a lot for enemy ai:
float dx = x2 - x1;
float dy = y2 - y1;
double h = Math.sqrt(dx * dx + dy * dy);
float dn = (float) (h / 1.41421);
vector2f.set(dx / dn, dy / dn);
Very random, I know, but basically it gives a vector2f to the next point. The sqrt methods take up a lot of memory(Is that what you call it?). So then I remembered in graphs at school, we use y2-y1/x2-x1 to get the slope. I thought about how this could be geometry. The slope formula could be multiplied by the speed, and added to x, and the reverse slope formula (x2-x1/y2-y1) to add to the y. This would get rid of a lot of sqrt methods. So I will test this:
float dx = x2 - x1;
float dy = y2 - y1;
Vector2f.set(dy/dx, dx/dy);
And they just spazz out. Why does this not work?
P.S. I tried dampening all the variables, and still no die.