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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:27:10+00:00 2026-06-09T00:27:10+00:00

Assume a 2D grid with the top left cell as (0, 0). Pick any

  • 0

Assume a 2D grid with the top left cell as (0, 0). Pick any two points/coordinates and draw a diagonal and anti-diagonal on each. They may intersect inside or outside the grid.

In the picture attached, the red lines are diagonals to the two points (300, 200) and (700, 800).

How can I find out the coordinates for the diagonal intersections? Also, how would the formula differ if the slope of the line were negative?

I will use this in an algorithm that needs to be highly optimized so the right answer would be the fastest possible way to compute. I’m not sure if this can be done without trignometry.

NOTE:
Please keep in mind that the red lines are a true diagonal/anti-diagonal pair. In other words they are at 45 degree angles to the rectangle. This may or may not help select a more optimized formula than vector calculation.

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-06-09T00:27:12+00:00Added an answer on June 9, 2026 at 12:27 am

    Let D be the difference between the two side lengths. In your figure, D=200. This is the length of the hypotenuse of the two white triangles (the ones between your exterior intersection points and the rectangle). So the side lengths of those triangles are D/sqrt(2), and so the coordinates of the exterior intersections differ from the rectangle corners by D/2.

    Then for your diagram,

    (x1,y1) = 300-D/2, 200+D/2 = 200,300
    (x2,y2) = 700+D/2, 800-D/2 = 800,700
    

    You’ll have to handle all the possible orientations (x1<x2, x1>x2, …) but they are all symmetric to this one.

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

Sidebar

Related Questions

assume there is a grid with some points in it just like in the
Let's assume that I have defined two Grid s and few TextBox es in
Assume I have two tables, Student Test Id Name TestId Type StudentId -- ----
Assume this code works: left '*' left '+' expr: expr '+' expr | expr
Assume that we have two sets: A=(a_1,a_2,...,a_m) and B=(b_1,b_2,...,a_n) (Not necessarily of same size).
I have a grid with two rows plus a grid splitter. I want the
let's assume I've got a UserControl like this: <UserControl x:Class=SomeNamespace.SomeClass> <Grid> <TextBlock Name=SampleTextBlock />
Say you have a 2D grid with each spot on the grid having x
I've got an UIScrollView with a grid of images. Currently they're only 6, but
Are there in general any known performance issues in WPF related to grid column

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.