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

  • Home
  • SEARCH
  • 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 9021355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:14:12+00:00 2026-06-16T05:14:12+00:00

I am practicing working with vectors. In this sketch I draw a line connecting

  • 0

I am practicing working with vectors. In this sketch I draw a line connecting centers of two ellipses. How can I shorten the line so that it touches the perimeter of each ellipse (not the center)?

PVector v1, v2;

void setup(){
  noLoop();
  v1 = new PVector(40, 20);
  v2 = new PVector(25, 50);
}

void draw(){
  ellipse(v1.x, v1.y, 12, 12);
  ellipse(v2.x, v2.y, 12, 12);

  line(v1.x, v1.y, v2.x, v2.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-06-16T05:14:13+00:00Added an answer on June 16, 2026 at 5:14 am

    First you’d need to calculate the points where the line would cross the edges of the circles. Fortunately, this is quite easy: (Note that I don’t know Processing, so treat this as psuedocode)

    direction = atan2(v2.y-v1.y,v2.x-v1.x)
    x1 = v1.x+cos(direction)*radius
    y1 = v1.y+sin(direction)*radius
    x2 = v2.x-cos(direction)*radius
    y2 = v2.y-sin(direction)*radius
    

    Then just draw the line (x1,y1,x2,y2)

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

Sidebar

Related Questions

I am practicing inheritance. I have two similar classes that I'd like to assimilate
I am practicing recursion and I can't see why this method does not seem
I'm trying to get CALayer working so I can start practicing some animations tricks
I'm practicing Haskell, and writing a summation function that takes in two numbers (upper
I am currently working on Project Euler for fun, and use Haskell for practicing.
I am practicing this https://developer.mozilla.org/en/Canvas_tutorial/Basic_animations Clock tutorial. Everything in the code is clear to
I'm practicing writing MVC applications. I have a Mastermind game, that I would like
All, I have been practicing coding problems online. Currently I am working on a
Been practicing with those system calls, but I stucked into this code: #include <stdio.h>
I have an array of images (can be up to 25) that need to

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.