This method may help:
// Given two points, and a point on the circle radius, return the multiplier (e.g. TIELineLayer.Curve)
// Result will be negative for inverted curves
function CalculateRadiusMultiplier(Pt1, Pt2, RadiusPt: TPoint; ForceHalfCircle: Boolean = False): Double;
var
midPt: TPoint;
abVect, azVect, ptDelta, rad: Double;
isCW: Boolean;
begin
midPt.x := min( Pt1.x, Pt2.x ) + abs( Pt1.x - Pt2.x ) div 2;
midPt.y := min( Pt1.y, Pt2.y ) + abs( Pt1.y - Pt2.y ) div 2;
abVect := IERadiansToDegrees( IEAngle2( Pt1.X, Pt1.y, Pt2.X, Pt2.Y ));
azVect := IERadiansToDegrees( IEAngle2( Pt1.X, Pt1.y, RadiusPt.X, RadiusPt.Y ));
if abVect >= 180 then
isCW := ( azVect > abVect ) or ( azVect < abVect - 180 )
else
isCW := ( azVect > abVect ) and ( azVect < abVect + 180 );
ptDelta := IEDistPoint2Point( Pt1.X, Pt1.Y, Pt2.X, Pt2.Y );
rad := IEDistPoint2Point( midPt.X, midPt.Y, RadiusPt.X, RadiusPt.Y );
if ForceHalfCircle then
Result := 1
else
Result := 1 / ( rad / ptDelta * 2 );
if isCW then
Result := -Result;
end;
Nigel
Xequte Software
www.imageen.com