Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6475831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:45:07+00:00 2026-05-25T06:45:07+00:00

I have several boxes (x,y,width,height) randomly scattered around, and some of them need to

  • 0

I have several boxes (x,y,width,height) randomly scattered around, and some of them need to be linked from point (x1,y1) in box1 to point (x2,y2) in box2 by drawing a line.

I am trying to figure a way to make such line avoid passing through any other boxes (other than box1 and box2) by drawing several straight interconnected lines to go around any box in the way (if it is not possible to go with one straight line).

The problem is that I don’t know an algorithm for such thing (let alone having a technical/common name for it). Would appreciate any help in the form of algorithm or expressed ideas.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T06:45:08+00:00Added an answer on May 25, 2026 at 6:45 am
    1. Put all (x,y) coords of the corners of the boxes in a set V

    2. Add the start- and end coordinates to V.

    3. Create a set of edges E connecting each corner that does not cross any box-side (except for the diagonals in the boxes).

      How to check if a line crosses a box side can be done with this algorithm

    4. Now use a path-finding algorithm of your choice, to find a path in the graph (V, E).

      If you need a simple algorithm that finds the shortest path, just go with a BFS.

    (This will produce a path that goes along the sides of some boxes. If this is undesirable, you could in step 1 put the points at some distance delta from the actual corners.)


    If the edges may not be diagonal:

    1. Create a large grid of lines that goes between the boxes.

    2. Throw away the grid-edges that cross a box-side.

    3. Find a path in the grid using a path-finding algorithm of your choice.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form with several text boxes on it. I only want to
I have several label boxes on my design form that all share the naming
This seems like such a simple question. I have several Edit boxes on my
Hi I have several text input boxes, and i have a clear button, they
I have... a dynamic populated select box several input boxes a submit button form
I have several Delphi programs that maintain connections to a database (some Oracle, some
I have several select boxes and textboxes with the same class and I have
I have an asp.net page with several list boxes. I would like to include
I need some sort of slideshow, with text (something like moving boxes would be
I have a form with several text boxes. The first input box is Business

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.