Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function TForm1.StraightLine: Tpoint;
- var
- X,Y : integer;
- X2,Y2 : integer;
- Slop : real;
- Rot : real;
- C : real;
- Distance : integer;
- NewPoint : tpoint;
- begin
- /// Y = MX + C
- Distance := 100;
- X := StrToInt64(XcordS);
- Y := StrToInt64(YCordS);
- greenprint(IntToStr(X)+':'+IntToStr(Y));
- Y2 := Y + Distance;
- X2 := X + Distance;
- GreenPrint(IntToStr(X)+':'+IntToStr(Y));
- Facing();
- Rot := StrToFloat(GRot);
- Rot := Rot / 1000;
- Rot := Rot; /// Dont know if this is correct
- //Rot := RadToDeg(Rot);
- greenprint('ROT: '+FloatToStr(Rot));
- Slop := Tan(Rot); /// Converting Degrees to Slop (M)
- greenprint('Slop'+':'+FloatToStr(Slop));
- // C = -M.X + Y
- C := (-Slop*X) + Y;
- GreenPrint('C :'+FloatToStr(C));
- NewPoint.X := Round( (Y2 - C) / Slop );
- NewPoint.Y := Round((slop*X2) + C);
- GreenPrint('NewPoint X: '+IntToStr(NewPoint.X));
- GreenPrint('NewPoint Y: '+IntToStr(NewPoint.Y));
- result := NewPoint;
Advertisement
Add Comment
Please, Sign In to add comment