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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T05:25:56+00:00 2026-05-18T05:25:56+00:00

ok i am trying to get a pool game going in c#/java. start =

  • 0

ok i am trying to get a pool game going in c#/java.

  • start = back of pool cue(x,y)
  • end = front of pool cue(x,y)
  • circles = list of balls (x,y,r)

So every time you move your mouse I update start, end and then I loop through `circles check if it intersects. Then this is my problem I need to figure out what will happen with ball if I hit it at the intersection point( will it go right up down).

How will I do this. I looked at some examples on google but could only find example where they did it with vector and that way over my head….

my first thought was get the angle of the pool cue and from the circle mid point draw a line the same angle but for some reason that is wrong. It might be my GetEnd function

    public Point GetEnd(Point start, double angle, int len)
    {
        double y = start.Y + (len * Math.Sin(angle));
        double x = start.X + (len * Math.Cos(angle));

        return new Point((int)x, (int)y);
    }
  • 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-18T05:25:57+00:00Added an answer on May 18, 2026 at 5:25 am

    I think the angle between the direction where the cue points and the ball moves is:

    Math.ASin(a/r)
    

    with a the minimal distance between the ray representing the cue and the center of the ball, and r the radius of the ball.

    You obtain a by minimizing a^2 = (Cue.Position+Cue.Direction*Lamda-Ball.Position)^2 for lamda and then calculating the squareroot of that expression.

    But I’m too lazy to reformulate that expressions without vectors.

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

Sidebar

Related Questions

I'm a newbie in Matlab and trying get rid of Java/C++ customs. The question
I am trying to get the items of one list where any of the
I'm trying to get a user-level program to communicate with the kernel via /proc.
I'm trying to get a View in Backbone.js to save when there's a 'change'
I have been trying to get this to work. Basically I have a search
we're trying to get some statistics over our large log tables on MySQL. Some
So I'm trying to get the results from a stored proc (200k rows+) into
I am trying to get a reference to the main boost::thread of execution, so
I'm trying to get the maximum value for an attribute in an Entity in
I've been trying to get mobile_tools for Drupal 7 to work but it appears

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.