I would like to move some point a in two dimensional search space to another point b with some stepsize (_config.StepSize = 0.03).
Point a = agent.Location;
Point b = agentToMoveToward.Location;
//--- important
double diff = (b.X - a.X) + (b.Y - a.Y);
double euclideanNorm = Math.Sqrt(Math.Pow((b.X - a.X), 2) + Math.Pow((b.Y - a.Y), 2));
double offset = _config.StepSize * ( diff / euclideanNorm );
agent.NextLocation = new Point(a.X + offset, a.Y + offset);
//---
Is it correct?
Assuming you mean you want to move one point towards another point and assuming your step size has distance units, then no, your calculation is not correct.
The correct formula is:
nextLocation = a + UnitVector(a, b) * stepSize
In C#, using just a simple
Point
class and theMath
library, this looks like:Edit: Updated code as per TrevorSeniors suggestion in comments