0 Members and 1 Guest are viewing this topic.
function angle( v1x, v1y, v2x, v2y: single ): single;var cosangle: single; dist: single;begin dist := ( distance( 0, 0, v1x, v1y ) * distance( 0, 0, v2x, v2y ) ); if dist = 0 then begin Result := -1; exit; end cosangle := ( v1x * v2x + v1y * v2y ) / dist; Result := 90 - 720 * ( arctan( cosangle / ( 1 + sqrt( 1 - cosangle * cosangle ) ) ) ) / (2 * pi); if FloatToStr(Result) = 'NAN' then Result := 0.0;end;
function SlopeCalc(const X1, X2, Y1, Y2: single):single;begin Result:=RoundTo(((Y2-Y1)/(X2-X1)),2);end;
function angle( v1x, v1y, v2x, v2y: single ): single;begin Result := 180 / pi * acos( (v1x*v2x + v1y*v2y) / sqrt( (v1x*v1x + v1y*v1y) * (v2x*v2x + v2y*v2y) ) );end;