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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:30:41+00:00 2026-05-14T02:30:41+00:00

I am trying to write some code that that will draw the line which

  • 0

I am trying to write some code that that will draw the line which is a tangent between 2 circles. so far i have been able to draw multiple circles, and lines between the centers.
i have a class which stores the values used in drawing the circles (radius, position).
what i need is a method in this class to find all posible tangents between 2 circles.
any help would be great.
this is what i have so far (it could very well be a load of rubbish)

public static Vector2[] Tangents(circle c1, circle c2)
{
            if (c2.radius > c1.radius)
            {
                circle temp = c1;
                c1 = c2;
                c2 = temp;
            }
            circle c0 = new circle(c1.radius - c2.radius, c1.center);
            Vector2[] tans = new Vector2[2];
            Vector2 dir = _point - _center;
            float len = (float)Math.Sqrt((dir.X * dir.X) + (dir.Y * dir.Y));
            float angle = (float)Math.Atan2(dir.X, dir.Y);
            float tan_length = (float)Math.Sqrt((len * len) - (_radius * _radius));
            float tan_angle = (float)Math.Asin(_radius / len);
            tans[0] = new Vector2((float)Math.Cos(angle + tan_angle), (float)Math.Sin(angle + tan_angle));
            tans[1] = new Vector2((float)Math.Cos(angle - tan_angle), (float)Math.Sin(angle - tan_angle));
            Vector2 dir0 = c0.center - tans[0];
            Vector2 dir1 = c0.center - tans[1];

            Vector2 tan00 = Vector2.Add(Vector2.Multiply(tans[0], (float)c2.radius), c1.center);
            Vector2 tan01 = c2.center;
            Vector2 tan10 = Vector2.Add(Vector2.Multiply(tans[1], (float)c2.radius), c1.center);
            Vector2 tan11 = c2.center;
}
  • 1 1 Answer
  • 1 View
  • 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-14T02:30:42+00:00Added an answer on May 14, 2026 at 2:30 am

    IMHO you should first try to solve the problem with pencil and paper before you start coding. This link at Mathworld seems to be a good starting point.

    EDIT: The article on this page looks promising.

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

Sidebar

Related Questions

I'm trying to write some Python code that will establish an invisible relay between
I am trying to write some code that will allow the user to draw
I am currently trying to write some code that will accept some FTP details,
I am trying to write some code that will generate accurate .proto files from
I have been trying to write some code in Scala to read a file
I'm trying to write some code that will take any object and convert it
I am trying to write some code that will function like google calendars quick
I'm trying to write some code that various sites will embed, calling a script
I am trying to write some code that will open a file, read its
I'm trying to write some jQuery code that will highlight the element the cursor

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.