# Algorithm for extending a line toward the end of cell/map

## Recommended Posts

Hello, I'd like to ask about the algorithm for extending a line (along the edge of the object) to the end of a cell or a node (what you call it) till there is an intersection. This is used for building a navmesh for pathfinding. How can I achieve that? for example


_____________ <-Extending this line
|     |
|     |
|_____|


Hope this makes sense! Thanks Jack

##### Share on other sites
Quote:
 Hope this makes sense

Is the edge you want to extend a vector? coordinates? What are the structures for the object and the cell/node?

If you use vectors, for instance:
vector lineBegin = vector(object.topLeft.x, object.topLeft.y);
vector lineEnd = vector(node.rightSide.x, object.topLeft.y);

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account

• ### Forum Statistics

• Total Topics
627737
• Total Posts
2978873

• 10
• 10
• 21
• 14
• 12