Real Software Forumshttp://forums.realsoftware.com/ Draw a Path Between Two coordinateshttp://forums.realsoftware.com/viewtopic.php?f=1&t=47899 Page 1 of 1

 Author: DaveS [ Thu May 16, 2013 4:08 pm ] Post subject: Draw a Path Between Two coordinates I have a need to draw a path between X1,Y1 and X2,Y2using ONLY horizontal or vertical lines With ONE other caveat.... each node will have an ID (1,2,3,4).... and that ID will determine the INITIAL or FINAL direction the path line must take.`+---0---+| |3 1| |+---2---+`If X1,Y1 has an ID of0 - path must start VERTICAL UP1 - path must start HORIZONTAL right2 - path must start VERTICAL DOWN3 - path must start HORIZONTAL leftregardless of where X2,Y2 isand for the destination of X2,Y2 they must end similar0 - path must end VERITCAL down1 - path must end HORIZONTAL left2- path must end VERTICAL UP3 - path must end HORIZONTAL right

 Author: ktekinay [ Thu May 16, 2013 4:26 pm ] Post subject: Re: Draw a Path Between Two coordinates So you could, theoretically, have X1,Y1.ID = 1 and X2,Y2.ID = 3? If so, by what criteria would it determine the path?`+-------+| 0----||+----1`Or would it always be logical, so HorizontalLeft would lead to VerticalDown, for example?

 Author: timhare [ Thu May 16, 2013 4:47 pm ] Post subject: Re: Draw a Path Between Two coordinates Sounds a little like routing traces between pins on a pc board. Do you have any additional criteria, such as you cannot touch any other existing features already in the picture?

 Author: DaveS [ Thu May 16, 2013 4:47 pm ] Post subject: Re: Draw a Path Between Two coordinates you are correct ... a path like you showed could very well be created.A horizontal(left/right) always connects to a vertical(up/down) and vice-versa

 Author: ktekinay [ Thu May 16, 2013 4:54 pm ] Post subject: Re: Draw a Path Between Two coordinates So the path I presented would be comprised of 6 nodes (or more), not just the two I illustrated, yes? Are you looking for the Graphics code for this? Are the nodes a custom class?

 Author: DaveS [ Thu May 16, 2013 4:56 pm ] Post subject: Re: Draw a Path Between Two coordinates It is similar to PC routing.... or more precisely VISIO routing Avoiding other shapes would be a perk.... (and I DO have a list of rectangles that could be avoided)

 Author: DaveS [ Thu May 16, 2013 4:59 pm ] Post subject: Re: Draw a Path Between Two coordinates ktekinay wrote:So the path I presented would be comprised of 6 nodes (or more), not just the two I illustrated, yes? Are you looking for the Graphics code for this? Are the nodes a custom class?Given X1,Y1 and X2,Y2 .... return a list of X,Y,D values where D is the Direction (Horizontal or Vertical) and I can merge that with my existing classes... I have all the rest of the drawing, editing, moving, adding, deleteing of shapes, images etc working.... and have been putting off the routing hoping I could come up with a novel approach... which so far I have not

 Author: ktekinay [ Thu May 16, 2013 5:15 pm ] Post subject: Re: Draw a Path Between Two coordinates So given node1 and node2, you would get back two nodes, nodeX and nodeY such that drawing would be:node1->nodeX, nodeY->node2The coordinates of nodeX and nodeY would be identical, only the D would differ, right?`> node1----nodeX/Y> |> |> node2`In that case, if node1.X = 0, node1.Y = 0, node1.ID = 1, and node2.X = 10, node2.Y = 10, node2.ID = 0, then nodeX.X = 0, nodeX.Y = 10, nodeX.ID = 3, and nodeY.X = 0, nodeY.Y = 10, and nodeY.ID = 2. Right so far?

 Author: DaveS [ Thu May 16, 2013 5:38 pm ] Post subject: Re: Draw a Path Between Two coordinates `>Node 1 [0,0]-----[10,0] NodeX> ID=1 |> |> [10,10] Node 2 ID=0`True =Horizontal False=Verticala list of points[0,0], TRUE[10,0],FALSE[10,10] FALSEThis would always start and end with the provided X1,Y1 and X2,Y2 and the direction is leaves that pointDeltas can of course be infered by direction change or subtracting node coordinates Some Exampleshttp://www.rdsisemore.com/nodes.pdfthe "x" is for phase 2

 Author: mikecotrone [ Fri May 17, 2013 12:17 am ] Post subject: Re: Draw a Path Between Two coordinates DaveS wrote:`>Node 1 [0,0]-----[10,0] NodeX> ID=1 |> |> [10,10] Node 2 ID=0`True =Horizontal False=Verticala list of points[0,0], TRUE[10,0],FALSE[10,10] FALSEThis would always start and end with the provided X1,Y1 and X2,Y2 and the direction is leaves that pointDeltas can of course be infered by direction change or subtracting node coordinates Some Exampleshttp://www.rdsisemore.com/nodes.pdfthe "x" is for phase 2 Dave I'm curious if you have implemented zoom capability?

 Author: DaveS [ Fri May 17, 2013 7:03 am ] Post subject: Re: Draw a Path Between Two coordinates mikecotrone wrote:Dave I'm curious if you have implemented zoom capability?Yup.... from 25% to 400% and all increments in between

 Page 1 of 1 All times are UTC - 5 hours Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Grouphttp://www.phpbb.com/