|
-
October 30th, 2002, 05:59 AM
#1
Line Algorithm
Hi,
I'm developing an application where you can configure circuits. the problem is after placing the components on the User Interface I've to make connections. these connections are to be represented by lines.
How do we caluclate the path of a line that does not pass through a certain Area . The lines can be only horizontal or vertical. The line has to pass around a certain specified area.
can anybody help me out with this thanks, in advance
-
October 31st, 2002, 11:23 AM
#2
I think it would be a design and the algol..
My suggestion would be to keep a method of
List of Nearest Components = FindNearestComponet(Newly added component)
Now for each Nearest Component
CPoint ConnectionPoint = GetConnectionPoints(component)
You now need to find out the breaking of straight line into
horizontal and vertical line.
(x1, y1) to (x2, y2)
which I think you need to do lot if and else calc. Taking for e.g.
x1 < x2 and y1<y2 and x1<=y1 <x2<=y2
find the mid-point (y1+y2)/2
Draw x2, midpoint to x2, y2
Draw x1, midpoint to x2, midpoint
Draw x1, y1 to x1, midpoint
We are trying to draw a diagnol line to a set of straight lines.
Please make sure the the slopes of line that you drawing..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|