rendered paste bodyprivate void updateimage()
{
Bitmap img = new Bitmap(pictureBox1.Width, pictureBox1.Height);
Graphics g = Graphics.FromImage(img);
Pen bg_col = new Pen(Color.White);
Pen fg_col = new Pen(Color.Black);
Pen PB = new Pen(Color.Green);
g.FillRectangle(bg_col.Brush, 0, 0, pictureBox1.Width, pictureBox1.Height);
pictureBox1.Image = img;
Point PointA = new Point(64, 64);
Point PointB = new Point(64, 412);
Point Intersection = Point.Empty;
Int16 lol;
for (lol = 10; lol < 90; lol++)
{
Double AngA = lol;
Double AngB = -AngA;
Int64 i;
for (i = 0; i < 30000; i++)
{
Point PointA_Temp = GetFinalPos(PointA, AngA, i);
Point PointB_Temp = GetFinalPos(PointB, AngB, i);
if (GetDistance(PointA_Temp, PointB_Temp) < 1)
{
System.Diagnostics.Debug.WriteLine("Points Intersected at: " + PointA_Temp.ToString());
Intersection = PointA_Temp;
break;
}
} //*/
g.DrawLine(fg_col, PointA, GetFinalPos(PointA, AngA, 1000));
g.DrawLine(fg_col, PointB, GetFinalPos(PointB, AngB, 1000));
//DrawCrosshair(g, new Pen(Color.Aqua), Intersection, 32);
pictureBox1.Image = img;
}
}
private Point GetFinalPos(Point Start, Double Ang, Double Distance)
{
Ang = Ang * (Math.PI / 180);
Double x = (Math.Cos(Ang)) * Distance;
Double y = (Math.Sin(Ang)) * Distance;
Int32 ix = Convert.ToInt32(x);
Int32 iy = Convert.ToInt32(y);
ix += Start.X;
iy += Start.Y;
return new Point(ix, iy);
}
private Double GetDistance(Point A, Point B)
{
return Math.Sqrt(Math.Pow(B.X - A.X, 2) + Math.Pow(B.Y - A.Y,2));
}
private void DrawCrosshair(Graphics g, Pen b, Point Pos, Int16 Size)
{
g.DrawRectangle(b, Pos.X - (Size / 2), Pos.Y - (Size / 2), Size, Size);
g.DrawLine(b, Pos.X - (Size ), Pos.Y, Pos.X + Size, Pos.Y);
g.DrawLine(b, Pos.X, Pos.Y - (Size), Pos.X, Pos.Y + Size);
}