The third problem was the big one. I was having trouble figuring out where to place the end points of the lines for the edge following condition. Before I used knowledge gained from having a bunch of special cases since I would know which case I was in and could make assumptions from that about the direction of growth. Since I no longer have special cases for each growth direction I needed a general solution that could handle any case.
The solution I have devised is pretty simple and took a stupidly long time to figure out
Insert into Notebook which was stupidly left at charlotte:
While edge following.
Known: Equation of line you are following, Direction of normal growth, Current Points, Which endpoint is in edge follow mode(both can be now if so you have two of everything related to line following), Endpoint of line we are following.
Algorithm:
1. Pretend like you were doing normal direction growth and generate tempary points there.
2. Use the edge you generated in step one and take the equation of the line you wish to follow. Find the point where they intersect. This point will be within the line generated by normal growth(Or things are convex which is a problem that should already have been caught).
3. Look at the two points that you generated in step 1. Since this line is axis aligned one of the values(X,Y) will be the same in both of them. Replace the unique value of the point that is contour following with the equivalent value from the intersection point generated in step 2.
4. Make sure you haven’t exceeded the line you are trying to follow(return impossible to grow if so).
5. Return new edge.
*If both points are in edge following mode find two intersection points(using both contour tracing lines) and replace a portion of both values from the the correct intersection point.
6. Give thanks to the many pieces of copy paper that gave there lives to figure this out. Also for the house finally getting empty so I could work for more than 10 minutes without an interruption.
Implementation should be easy and it will be a lot less lines so less to go wrong and debug. With a little luck this will be done tonight if not then tomorrow.
Hunter