+ Reply to Thread
Results 1 to 2 of 2

Angle between two 3D Vectors

  1. #1
    Registered User
    Join Date
    07-15-2020
    Location
    florida
    MS-Off Ver
    Microsoft 365
    Posts
    1

    Angle between two 3D Vectors

    Hi,

    I'm trying to create a worksheet that will take two 3D vectors and calculate the angle between them.

    I have a vector m =<a,b,c> and vector n =<x,y,z>

    there seems to be no easy way to calculate the cross product or magnitude without having a bunch of scrap numbers in between.

    formula for the angle would be arctan(magnitude of (m cross n)/(m dot n))

    Any help or insight would be appreciated.

    Or if anyone knows of any open source VBA code that can calculate the angle between two vectors that would be great.

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,812

    Re: Angle between two 3D Vectors

    there seems to be no easy way to calculate the cross product or magnitude without having a bunch of scrap numbers in between.
    Can you clarify what your concern is here? I agree that I don't see an easy way to perform the calculation without also calculating the intermediate numbers. Whether in VBA or Python or spreadsheet formula or pencil and paper and slide rule, I don't see any way to perform the overall calculation without calculating the various intermediate values that go into the calculation.

    Perhaps your concern is not so much about the need to calculate the intermediate values, but that you don't want to have to look at them in the spreadsheet. You want to nest all of the intermediate calculations into one big formula that performs all of the intermediate calculations and the final calculation in one cell? It's a bit of work and you have to be real careful with parentheses and such when you nest that much into a single cell formula, but it seems like it should not be too difficult:

    1) cross product i term b*z-c*y, cross product j term a*z-c*x, cross product k term a*y-b*x
    2) magnitude of a vector is SQRT(SUMSQ(vector elements)) so SQRT(SUMSQ(b*z-c*y,a*z-c*x,a*y-b*x))
    3) dot product is a simple SUMPRODUCT(vector elements a, vector elements b) SUMPRODUCT({a,b,c},{x,y,z}) or references to the ranges with those values.
    4) finally, take the arctan of the ratio =ATAN(SQRT(SUMSQ(...))/SUMPRODUCT(...))
    5) test and debug to make sure I got all the parentheses and such in the right place.

    Is that the main concern -- about nesting everything into a single cell formula?
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Excel 2007 : Calculate an angle between 2 3D vectors?
    By gannon_w in forum Excel General
    Replies: 16
    Last Post: 06-15-2016, 02:22 AM
  2. Vectors
    By scientist in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-14-2014, 10:38 AM
  3. A little help with vectors?
    By bbbbates in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 02-22-2012, 04:41 PM
  4. Vectors and matrices
    By mdevaan in forum Excel General
    Replies: 1
    Last Post: 01-23-2011, 05:15 PM
  5. Arrays to Column Vectors
    By Petro in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-29-2008, 02:01 AM
  6. Visually add (graph) vectors
    By Banaticus in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 06-30-2006, 12:55 AM
  7. Vectors on Charts
    By Wyvern in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 11-21-2005, 08:45 PM
  8. adding vectors.. help on how
    By Ralph2 in forum Excel General
    Replies: 1
    Last Post: 11-01-2005, 10:05 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1