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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:11:29+00:00 2026-05-15T12:11:29+00:00

I’ve been trying to solve this and I found an equation that gives the

  • 0

I’ve been trying to solve this and I found an equation that gives the possibility of zero division errors. Not the best thing:

v1 = (a,b)
v2 = (c,d)
d1 = (e,f)
d2 = (h,i)

l1: v1 + λd1
l2: v2 + µd2

Equation to find vector intersection of l1 and l2 programatically by re-arranging for lambda.

(a,b) + λ(e,f) = (c,d) + µ(h,i)
a + λe = c + µh
b +λf = d + µi
µh = a + λe - c
µi = b +λf - d
µ = (a + λe - c)/h
µ = (b +λf - d)/i
(a + λe - c)/h = (b +λf - d)/i
a/h + λe/h - c/h = b/i +λf/i - d/i
λe/h - λf/i =  (b/i - d/i) - (a/h - c/h)
λ(e/h - f/i) = (b - d)/i - (a - c)/h
λ = ((b - d)/i - (a - c)/h)/(e/h - f/i)

Intersection vector = (a + λe,b + λf)

Not sure if it would even work in some cases. I haven’t tested it.

I need to know how to do this for values as in that example a-i.

Thank you.

  • 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-15T12:11:29+00:00Added an answer on May 15, 2026 at 12:11 pm

    Here’s the solution with a python function. v1 and v2 are the position vectors. d1 and d2 are the direction vectors.

    def vector_intersection(v1,v2,d1,d2):
        '''
        v1 and v2 - Vector points
        d1 and d2 - Direction vectors
        returns the intersection point for the two vector line equations.
        '''
        if d1[0] == 0 and d2[0] != 0 or d1[1] == 0 and d2[1] != 0:
            if d1[0] == 0 and d2[0] != 0:
                mu = float(v1[0] - v2[0])/d2[0]
            elif d1[1] == 0 and d2[1] != 0:
                mu = float(v1[1] - v2[1])/d2[1]
            return (v2[0] + mu* d2[0],v2[1] + mu * d2[1])
        else:
            if d1[0] != 0 and d1[1] != 0 and d2[0] != 0 and d2[1] != 0:
                if d1[1]*d2[0] - d1[0]*d2[1] == 0:
                    raise ValueError('Direction vectors are invalid. (Parallel)')
                lmbda = float(v1[0]*d2[1] - v1[1]*d2[0] - v2[0]*d2[1] + v2[1]*d2[0])/(d1[1]*d2[0] - d1[0]*d2[1])
            elif d2[0] == 0 and d1[0] != 0:
                lmbda = float(v2[0] - v1[0])/d1[0]
            elif d2[1] == 0 and d1[1] != 0:
                lmbda = float(v2[1] - v1[1])/d1[1]
            else:
                raise ValueError('Direction vectors are invalid.')
            return (v1[0] + lmbda* d1[0],v1[1] + lmbda * d1[1])
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I need a function that will clean a strings' special characters. I do NOT
I'm trying to create an if statement in PHP that prevents a single post
I know there's a lot of other questions out there that deal with this
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is

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.