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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:46:10+00:00 2026-05-28T04:46:10+00:00

Suppose you have the following three points A , B , and C as

  • 0

Suppose you have the following three points A, B, and C as shown in the following picture:

enter image description here

The points are always sorted according to their vertical offset, so the top most point is always A. Sometimes B and C could have the same y coordinate.

I’m trying to find the x coordinate for point D. I can find the Y coordinate for D by interpolating points A.y and C.y at (B.y / (C.y - A.y)). I’m doing my interpolation using the following formula (in C++)

float linearInterpolation(float a, float b, float t)
{
    return a + (t * (b - a));
}

So in other words, D.y = linearInterpolation(A.y, C.y, (B.y - A.y) / (C.y - A.y))

So to summarize, my question is: how do I find D.x?

Thanks

—

Answer:

Just to clarify, here’s the solution that was suggested and worked:

D.x = A.x + (B.y - A.y) * (C.x - A.x) / (C.y - A.y);
D.y = B.y;

As illustrated in the image below:

enter image description here

  • 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-28T04:46:11+00:00Added an answer on May 28, 2026 at 4:46 am

    It it is the x coordinate that requires interpolation. The y coordinates of B and D are equal on your diagram.

    D.x = A.x + (B.y - A.y) * (C.x - A.x) / (C.y - A.y);
    D.y = B.y;
    

    You should also make a provision for the case of C.y == A.y, where D.x could be anywhere between A.x and C.x. One way to do this is to not draw triangles, for which abs(C.y - A.y) < delta, with the delta being on the order of magnitude of 1 pixel.

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

Sidebar

Related Questions

Propose to consider the following problem. Suppose we have some composite object. Are there
Suppose I have following code package memoryleak; public class MemoryLeak { public static int
Suppose we have the following table data: ID parent stage submitted 1 1 1
Suppose I have the following HTML: <form id=myform> <input type='checkbox' name='foo[]'/> Check 1<br/> <input
Suppose I have the following: A region defined by minimum and maximum latitude and
Suppose I have the following: using(var ctx = DataContextFactory.Create(0)) { ... Some code ...
Suppose you have the following situation #include <iostream> class Animal { public: virtual void
Suppose I have the following types of data: class Customer { String id; //
Suppose I have the following models: class User(models.Model): pass class A(models.Model): user = models.ForeignKey(User)
Suppose I have the following (desired) folder structure: *CommonProject *Project#1 ----> CommonProject(link) *Project#2 ---->

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.