public void GenBlock() { ClearBlock(); Document a = canvas1.GetCurrent(); a.GetLinesOfRoom(); foreach (Line line in a.lines) { UCWall temp = new UCWall(); canvas1.Controls.Add(temp); Size tSize = new Size(PointUtil.Minus(line.pB, line.pA)); if (tSize.Width == 0) { temp.isVertical = true; temp.Location = PointUtil.Plus(line.pA, new Point(-2, 2)); tSize.Width = 5; tSize.Height -= 2; } else { temp.isVertical = false; temp.Location = PointUtil.Plus(line.pA, new Point(2, -2)); tSize.Height = 5; tSize.Width -= 2; } temp.Size = tSize; canvas1.Controls.SetChildIndex(temp, 0); //Console.WriteLine("draw loc :" + temp.Location + "size : " + temp.Size); } }
public static Point ProjectPointOnLine(Point linePoint, Point lineVec, Point point) { //get vector from point on line to point in space Point linePointToPoint = PointUtil.Minus(point, linePoint); int t = PointUtil.Dot(linePointToPoint, lineVec); return(PointUtil.Plus(linePoint, new Point(lineVec.X * t, lineVec.Y * t))); }
public Door(Point a, int idx, bool _isDoor) { pA = a; kind = idx; if (kind % 2 == 0) { pB = PointUtil.Plus(pA, new Point(0, 50)); } else { pB = PointUtil.Plus(pA, new Point(50, 0)); } isDoor = _isDoor; }