try
{
TurnCurve arc = CurveUtils.createCurve(alphaCoord,turns[0].getCoord(),alphaAngle,normalize(turns[0].getAngle()));
len = len + calcLength(arc,step);
}
catch(CurveException exc)
{
System.out.println("CurveException");
int dx = alphaCoord.x - turns[0].getCoord().x;
int dy = alphaCoord.y - turns[0].getCoord().y;
len = len + (Math.sqrt(dx*dx+dy*dy) / step);
}
for(int t = 0; t < turns.length - 1; t++)
{
double ta1 = CurveUtils.normalize(turns[t].getAngle());
double ta2 = CurveUtils.normalize(turns[t+1].getAngle() + Math.PI);
Point tp1 = turns[t].getCoord();
Point tp2 = turns[t+1].getCoord();
try
{
TurnCurve arc = createCurve(tp1,tp2,ta1,ta2);
len = len + calcLength(arc,step);
}
catch(CurveException exc)
{
System.out.println("CurveException");
int dx = tp1.x - tp2.x;
int dy = tp1.y - tp2.y;
len = len + (Math.sqrt(dx*dx+dy*dy) / step);
}
}
try
{
TurnCurve arc = CurveUtils.createCurve(turns[turns.length-1].getCoord(),betaCoord,turns[turns.length-1].getAngle(),betaAngle);
len = len + calcLength(arc,step);
}
catch(CurveException exc)
{
System.out.println("CurveException");