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

The Archive Base Latest Questions

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

Possible Duplicate: Circle line collision detection I have a problem. I need to find

  • 0

Possible Duplicate:
Circle line collision detection

I have a problem. I need to find point A.
enter image description here

How can I do this best way?

Programming languale is Java.

  • 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-13T07:16:24+00:00Added an answer on June 13, 2026 at 7:16 am

    Given:
    a circle with center C=[x2,y2] and radius R
    a line segment from C to B=[x1,y2]
    calculate their intersection.

    This is easy since one of the endpoints is the center of the circle. You have to walk the distance of R from C towards B. The distance guarantees you will end up on the circle and the direction guarantees you will end up on the ray C->B. You still need to check if the intersection lies on the segment.

    Here is the pseudocode if you have a vector library

    - offset = B-C
    - if length_square(offset) < R^2 output "no intersection"
    - offset_a = normalize(B-C) * R
    - output C + offset_a
    

    Without a library, the code is longer:

    - off_x = x1-x2;
    - off_y = y1-y2;
    
    - ls = off_x*off_x + off_y*off_y
    - if ls < R*R
    -- return an empty array, meaning "no intersections"
    
    - scale = R / sqrt(ls)
    - res_x = off_x * scale + x2
    - res_y = off_y * scale + y2
    - return [[off_x, off_y]]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Circle line collision detection How do I find the intersection of a
Possible Duplicate: Circle line collision detection I'm trying to do collision testing between a
Possible Duplicate: Can main function call itself in C++? I found this problem very
Possible Duplicate: How can I make Turtle recognize a circle? I have a function
Possible Duplicate: Circle-Rectangle collision detection (intersection) How to determine the collision of a circle
Possible Duplicate: intersection of line and circle with different slope I have line which
Possible Duplicate: substring and the indexOf method I have this problem that I'm going
Possible Duplicate: How can I understand nested ?: operators in PHP? Why does this:
Possible Duplicate: How to pack squares into circles? I have a problem where I
Possible Duplicate: Java GUI repaint() problem? I write a Java code, but I have

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.