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 8736337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:16:58+00:00 2026-06-13T10:16:58+00:00

Given a list of circles with its coordinates (x and y) that are moving

  • 0

Given a list of circles with its coordinates (x and y) that are moving every second in different direction (South-East, South-West, North-East and North-West), and the circle will change direction if it hits the wall sort of like bouncing, so how do we detect if any of them collide or overlap with each other ? I am not sure if we can use some data structures like a Binary Search Tree because since all the coordinates vary every seconds, so the tree will have to re-build accordingly. Or can we use Vertical Sweep Line Algorithm each time ? Any ideas on how to do this in a efficient way ?

  • 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-06-13T10:16:59+00:00Added an answer on June 13, 2026 at 10:16 am

    Your shapes are only circles, so:

    • A circle will touch a border of your rectangle if its distance to the border is inferior to its radius.
    • Two circles will touch each other if the distance between their center is inferior to the sum of their radius.

    Suppose your rectangle’s boundaries are X1 and X2 on the horizontal axis and Y1 and Y2 on the vertical axis (with X1 < X2 and Y1 < Y2). In the first case, if the center of your circle is (x, y) and its radius is r you have to check if :

    • x-r < X1 ?
    • x+r > X2 ?
    • y-r < Y1 ?
    • y+r > Y2 ?

    If any of these is true, your circle touches the boundary of the rectangle.

    In the second case, suppose your circles are defined by (x1, y1, r1) and (x2, y2, r2) respectively. You have to check if (x1 - x2)^2 + (y1 - y2)^2 < (r1 + r2)^2. If this is true, your circles touch each other.

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

Sidebar

Related Questions

Given a list of numbers, how does one find differences between every ( i
I'm trying to implement the following in Java. Given a list of circles of
say your given an instance of List[Class[_ <: Base]] , and say that many
How to define a rotates function that generates all rotations of the given list?
Given an R list, I wish to find the index of a given list
The original code was somehow complex, i simplify it as: Given: list of class
Given a list a containing vectors of unequal length and a vector b containing
Given a List such as List(1, 2, 3, 4, 5, 6, 7) what is
Given a list like this: num = [1, 2, 3, 4, 5] There are
Given a list of potential ID's is there a quick way using a single

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.