Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. vector math/cross product

vector math/cross product

Scheduled Pinned Locked Moved The Lounge
questiongraphicscareerlearning
51 Posts 20 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Michael A Barnhart

    Jeremy Falcon wrote:

    but is there some things useful for this

    Many, depending on what you goals are. A) you know know the normal vector to the surface you are working with. Take that with one of the existing vector to produce a third vector and you have the local coordinate system that plane is in. B) with the normal vector of the plan you can calculate the distance an abritrary point in space is from the plane. and on and on. "Yes I know the voices are not real. But they have some pretty good ideas."

    J Offline
    J Offline
    Jeremy Falcon
    wrote on last edited by
    #13

    Michael A. Barnhart wrote:

    you know know the normal vector to the surface you are working with. Take that with one of the existing vector to produce a third vector and you have the local coordinate system that plane is in.

    Hot damn! I'm not finished with this book yet (page 77 of 449), so I'm mainly curious. But that is extremely useful! Thanks! Jeremy Falcon

    V 1 Reply Last reply
    0
    • T Todd Smith

      http://mathworld.wolfram.com/CrossProduct.html[^] Todd Smith

      J Offline
      J Offline
      Jeremy Falcon
      wrote on last edited by
      #14

      I found that site a while back on a Google frenzy. The concept is nice but their "answers" are no less confusing than hieroglyphics. The only people that understand what they say are the people that don't need to ask the question in the first place. Thanks for the reply. Jeremy Falcon

      J J 2 Replies Last reply
      0
      • M Marc Clifton

        Jeremy Falcon wrote:

        Now I wish I had graph paper.

        Huh. All this technology, and I've never seen virtual graph paper. An ideal, simple, yet powerful application. Extensible. Hmmm.... Marc Pensieve Some people believe what the bible says. Literally. At least [with Wikipedia] you have the chance to correct the wiki -- Jörgen Sigvardsson

        C Offline
        C Offline
        code frog 0
        wrote on last edited by
        #15

        Visio.


        "You have an arrow in your butt!" - Fiona:cool:
        Welcome to CP in your language. Post the unicode version in My CP Blog [ ^ ] now.

        People who don't understand how awesome Firefox is have never used CPhog[^]CPhog. The act of using CPhog (Firefox)[^] alone doesn't make Firefox cool. It opens your eyes to the possibilities and then you start looking for other things like CPhog (Firefox)[^] and your eyes are suddenly open to all sorts of useful things all through Firefox. - (Self Quote)

        1 Reply Last reply
        0
        • J Jeremy Falcon

          I found that site a while back on a Google frenzy. The concept is nice but their "answers" are no less confusing than hieroglyphics. The only people that understand what they say are the people that don't need to ask the question in the first place. Thanks for the reply. Jeremy Falcon

          J Offline
          J Offline
          J Dunlap
          wrote on last edited by
          #16

          Jeremy Falcon wrote:

          The only people that understand what they say are the people that don't need to ask the question in the first place.

          I know how that goes... :sigh:

          J 1 Reply Last reply
          0
          • J J Dunlap

            Jeremy Falcon wrote:

            The only people that understand what they say are the people that don't need to ask the question in the first place.

            I know how that goes... :sigh:

            J Offline
            J Offline
            Jeremy Falcon
            wrote on last edited by
            #17

            J. Dunlap wrote:

            I know how that goes...

            It's sad really. Some people like to get off by acting smarter than they really are by trying to sound difficult to understand. I've seen that a LOT by some people with studying 3D math. It drives me crazy(er). Of course, I don't think that site is really geared towards those who are learning. It's really more of a reference for those who have IMO. Jeremy Falcon

            1 Reply Last reply
            0
            • M Marc Clifton

              Jeremy Falcon wrote:

              Now I wish I had graph paper.

              Huh. All this technology, and I've never seen virtual graph paper. An ideal, simple, yet powerful application. Extensible. Hmmm.... Marc Pensieve Some people believe what the bible says. Literally. At least [with Wikipedia] you have the chance to correct the wiki -- Jörgen Sigvardsson

              J Offline
              J Offline
              Jim Crafton
              wrote on last edited by
              #18

              Hey, a project that would be cool to use the VCF for! :) ¡El diablo está en mis pantalones! ¡Mire, mire! Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF!

              1 Reply Last reply
              0
              • M Marc Clifton

                Jeremy Falcon wrote:

                Now I wish I had graph paper.

                Huh. All this technology, and I've never seen virtual graph paper. An ideal, simple, yet powerful application. Extensible. Hmmm.... Marc Pensieve Some people believe what the bible says. Literally. At least [with Wikipedia] you have the chance to correct the wiki -- Jörgen Sigvardsson

                E Offline
                E Offline
                Ed Poore
                wrote on last edited by
                #19

                Marc Clifton wrote:

                All this technology, and I've never seen virtual graph paper.

                AutoCAD?

                Marc Clifton wrote:

                An ideal

                Yes

                Marc Clifton wrote:

                simple

                No

                Marc Clifton wrote:

                powerful

                Certainly

                Marc Clifton wrote:

                Extensible

                Yes (but if only you could use C#...)

                1 Reply Last reply
                0
                • J Jeremy Falcon

                  Andy Brummer wrote:

                  The traditional cross product produces the vector perpendicular to the plane through the two vectors that you are multipling

                  Yeah I just got to that. It's amazing what graph paper can do. :-D Ok, you sound like you know this stuff, so what is the cross product used for in practical terms? The dot product I can envision being used when transforming objects easy enough, but is there some things useful for this for the direction I'm headed in (OGL programming)? Thanks for the reply! Jeremy Falcon

                  A Offline
                  A Offline
                  Andy Brummer
                  wrote on last edited by
                  #20

                  Finding the normal direction for a plane is the most common use. In addition to what Josh and others have said, not only can you use it for culling, but you can use it for lighting calculations and reflection angle. Also it is used for Snell's law for translucent objects. In basic physics it is used for all sorts of electromagneic, fluid flow and other calculations of that sort. It can also be used to find vectors in the same plane as your original vectors using (a x b) * x = 0 since this implies x = x0 a + x1 b where x is the vector you are checking. It can be really useful in 3 dimensions, but doesn't extend to higher dimensions and is harder to remember the formula for. It's too bad there isn't more info on bivectors out there.


                  I can imagine the sinking feeling one would have after ordering my book, only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon

                  J 1 Reply Last reply
                  0
                  • A Andy Brummer

                    Finding the normal direction for a plane is the most common use. In addition to what Josh and others have said, not only can you use it for culling, but you can use it for lighting calculations and reflection angle. Also it is used for Snell's law for translucent objects. In basic physics it is used for all sorts of electromagneic, fluid flow and other calculations of that sort. It can also be used to find vectors in the same plane as your original vectors using (a x b) * x = 0 since this implies x = x0 a + x1 b where x is the vector you are checking. It can be really useful in 3 dimensions, but doesn't extend to higher dimensions and is harder to remember the formula for. It's too bad there isn't more info on bivectors out there.


                    I can imagine the sinking feeling one would have after ordering my book, only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon

                    J Offline
                    J Offline
                    Jeremy Falcon
                    wrote on last edited by
                    #21

                    Andy Brummer wrote:

                    Also it is used for Snell's law for translucent objects.

                    That's cool to know.

                    Andy Brummer wrote:

                    It's too bad there isn't more info on bivectors out there.

                    Well for me, I'm staying within the realm of 3d for now until the concepts are easy as pie. Perhaps then I'll move on to the harder stuff. Thanks for the reply... again. Jeremy Falcon

                    1 Reply Last reply
                    0
                    • J Jeremy Falcon

                      I found that site a while back on a Google frenzy. The concept is nice but their "answers" are no less confusing than hieroglyphics. The only people that understand what they say are the people that don't need to ask the question in the first place. Thanks for the reply. Jeremy Falcon

                      J Offline
                      J Offline
                      Jorgen Sigvardsson
                      wrote on last edited by
                      #22

                      I wish I saved my old algebra notes from the university courses I took 11 years ago. I distinctly remember that the cross product really isn't that hard to grasp. Perhaps you know someone who's in college, taking algebra classes?

                      -- 100% natural. No superstitious additives.

                      J 1 Reply Last reply
                      0
                      • J Jeremy Falcon

                        Andy Brummer wrote:

                        The traditional cross product produces the vector perpendicular to the plane through the two vectors that you are multipling

                        Yeah I just got to that. It's amazing what graph paper can do. :-D Ok, you sound like you know this stuff, so what is the cross product used for in practical terms? The dot product I can envision being used when transforming objects easy enough, but is there some things useful for this for the direction I'm headed in (OGL programming)? Thanks for the reply! Jeremy Falcon

                        M Offline
                        M Offline
                        Michael A Barnhart
                        wrote on last edited by
                        #23

                        Jeremy Falcon wrote:

                        for the direction I'm headed in (OGL programming)?

                        Actually Jeremy, you need to answer most of this question for yourself. I believe you will when you are ready. My point here is: Ok, you are going to visually display something. What is to be displayed and why is it important or entertaining to bother displaying what ever it is. When you answer that/those questions, you will start saying, now if I new this, I can answer that. Just one word of advise, do not start using a left handed coordinate system, just because you got tired one night. "Yes I know the voices are not real. But they have some pretty good ideas."

                        S J 2 Replies Last reply
                        0
                        • J Jorgen Sigvardsson

                          I wish I saved my old algebra notes from the university courses I took 11 years ago. I distinctly remember that the cross product really isn't that hard to grasp. Perhaps you know someone who's in college, taking algebra classes?

                          -- 100% natural. No superstitious additives.

                          J Offline
                          J Offline
                          Jeremy Falcon
                          wrote on last edited by
                          #24

                          Jörgen Sigvardsson wrote:

                          Perhaps you know someone who's in college, taking algebra classes?

                          No need. I got it now. I think main problem for me was I wasn't graphing it. Sometimes it helps to see it before it clicks. Jeremy Falcon

                          1 Reply Last reply
                          0
                          • M Marc Clifton

                            Jeremy Falcon wrote:

                            Now I wish I had graph paper.

                            Huh. All this technology, and I've never seen virtual graph paper. An ideal, simple, yet powerful application. Extensible. Hmmm.... Marc Pensieve Some people believe what the bible says. Literally. At least [with Wikipedia] you have the chance to correct the wiki -- Jörgen Sigvardsson

                            B Offline
                            B Offline
                            Bassam Abdul Baki
                            wrote on last edited by
                            #25

                            Try this[^].


                            "Religion is assurance in numbers." - Bassam Abdul-Baki Web - Blog - RSS - Math

                            R 1 Reply Last reply
                            0
                            • M Michael A Barnhart

                              Jeremy Falcon wrote:

                              for the direction I'm headed in (OGL programming)?

                              Actually Jeremy, you need to answer most of this question for yourself. I believe you will when you are ready. My point here is: Ok, you are going to visually display something. What is to be displayed and why is it important or entertaining to bother displaying what ever it is. When you answer that/those questions, you will start saying, now if I new this, I can answer that. Just one word of advise, do not start using a left handed coordinate system, just because you got tired one night. "Yes I know the voices are not real. But they have some pretty good ideas."

                              S Offline
                              S Offline
                              Shog9 0
                              wrote on last edited by
                              #26

                              Michael A. Barnhart wrote:

                              Just one word of advise, do not start using a left handed coordinate system, just because you got tired one night.

                              Sage advice. I once spent nearly six months suffering from a particularly stupid bug, which arose from one late-night coding session... (actually i may have been drinking too, but let's blame it on lack of sleep for now)

                              ---- Scripts i’ve known... CPhog 1.0.0.0 - make CP better. Forum Bookmark 0.2.5 - bookmark forum posts on Pensieve Print forum 0.1.2 - printer-friendly forums Expand all 1.0 - Expand all messages In-place Delete 1.0 - AJAX-style post delete Syntax 0.1 - Syntax highlighting for code blocks in the forums

                              1 Reply Last reply
                              0
                              • J Jeremy Falcon

                                I really don't want to ask this question here, but since there's no math forum I haven't much of a choice. Anyway, I have a math question for the gurus again. I'm trying to understand just how a cross product works rather than just do as I'm told kinda thing. So, given this...

                                | x1 | | x2 | | y1z2 - z1y2 |
                                | y1 | x | y2 | = | z1x2 - x1z2 |
                                | z1 | | z2 | | x1y2 - y1x2 |

                                My question is, why is that so? I realize (using the dot product as a reference) that the elements are independent or so I thought. I would've thought that multiplying the two would mean somethign of this nature...

                                x1 * x2 + y1 * y2, etc.

                                But I realize that would just be the dot product again. Also, why do I need to subtract at all when multiplying? Can anyone please explain this to me? The book I'm reading did a great job at explaining the dot product, but not the cross product. TIA Jeremy Falcon

                                E Offline
                                E Offline
                                Ennis Ray Lynch Jr
                                wrote on last edited by
                                #27

                                Was simply passing linear algebra. Sorry I am no help too l8 on friday to do math (only trig this late) "Until the day of his death, no man can be sure of his courage" -- Jean Anouilh

                                J 1 Reply Last reply
                                0
                                • B Bassam Abdul Baki

                                  Try this[^].


                                  "Religion is assurance in numbers." - Bassam Abdul-Baki Web - Blog - RSS - Math

                                  R Offline
                                  R Offline
                                  Ryan Binns
                                  wrote on last edited by
                                  #28

                                  I think he was actually after software that acts like graph paper and lets you plot on it...

                                  Ryan

                                  "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

                                  1 Reply Last reply
                                  0
                                  • J Jeremy Falcon

                                    Michael A. Barnhart wrote:

                                    you know know the normal vector to the surface you are working with. Take that with one of the existing vector to produce a third vector and you have the local coordinate system that plane is in.

                                    Hot damn! I'm not finished with this book yet (page 77 of 449), so I'm mainly curious. But that is extremely useful! Thanks! Jeremy Falcon

                                    V Offline
                                    V Offline
                                    Vikram A Punathambekar
                                    wrote on last edited by
                                    #29

                                    Which book are you reading? š Cheers, Vikram.


                                    "I am not Jesus and will never be. The fact is I was a piece of cr*p till I found Him." - Paul Selormey.

                                    1 Reply Last reply
                                    0
                                    • J Jeremy Falcon

                                      I really don't want to ask this question here, but since there's no math forum I haven't much of a choice. Anyway, I have a math question for the gurus again. I'm trying to understand just how a cross product works rather than just do as I'm told kinda thing. So, given this...

                                      | x1 | | x2 | | y1z2 - z1y2 |
                                      | y1 | x | y2 | = | z1x2 - x1z2 |
                                      | z1 | | z2 | | x1y2 - y1x2 |

                                      My question is, why is that so? I realize (using the dot product as a reference) that the elements are independent or so I thought. I would've thought that multiplying the two would mean somethign of this nature...

                                      x1 * x2 + y1 * y2, etc.

                                      But I realize that would just be the dot product again. Also, why do I need to subtract at all when multiplying? Can anyone please explain this to me? The book I'm reading did a great job at explaining the dot product, but not the cross product. TIA Jeremy Falcon

                                      I Offline
                                      I Offline
                                      Iain Clarke Warrior Programmer
                                      wrote on last edited by
                                      #30

                                      Jeremy, 1/ I'm on a work trip in the far east at the mo., so don't expect me to reply quickly. 2/ I wrote an article demonstrating using cross products etc to transform points from one coord system to another. Which is handy for an awful lot of reasons. Warping Coordinates with Matrices[^] Debugging through that should help. You can even use my matrix library if you wish. Its not templated etc, but its half decent! Iain.

                                      J 1 Reply Last reply
                                      0
                                      • J Jeremy Falcon

                                        I really don't want to ask this question here, but since there's no math forum I haven't much of a choice. Anyway, I have a math question for the gurus again. I'm trying to understand just how a cross product works rather than just do as I'm told kinda thing. So, given this...

                                        | x1 | | x2 | | y1z2 - z1y2 |
                                        | y1 | x | y2 | = | z1x2 - x1z2 |
                                        | z1 | | z2 | | x1y2 - y1x2 |

                                        My question is, why is that so? I realize (using the dot product as a reference) that the elements are independent or so I thought. I would've thought that multiplying the two would mean somethign of this nature...

                                        x1 * x2 + y1 * y2, etc.

                                        But I realize that would just be the dot product again. Also, why do I need to subtract at all when multiplying? Can anyone please explain this to me? The book I'm reading did a great job at explaining the dot product, but not the cross product. TIA Jeremy Falcon

                                        C Offline
                                        C Offline
                                        Chris Maunder
                                        wrote on last edited by
                                        #31

                                        This[^] may help.OR it just may really confuse you. cheers, Chris Maunder

                                        CodeProject.com : C++ MVP

                                        J 1 Reply Last reply
                                        0
                                        • J Jeremy Falcon

                                          I really don't want to ask this question here, but since there's no math forum I haven't much of a choice. Anyway, I have a math question for the gurus again. I'm trying to understand just how a cross product works rather than just do as I'm told kinda thing. So, given this...

                                          | x1 | | x2 | | y1z2 - z1y2 |
                                          | y1 | x | y2 | = | z1x2 - x1z2 |
                                          | z1 | | z2 | | x1y2 - y1x2 |

                                          My question is, why is that so? I realize (using the dot product as a reference) that the elements are independent or so I thought. I would've thought that multiplying the two would mean somethign of this nature...

                                          x1 * x2 + y1 * y2, etc.

                                          But I realize that would just be the dot product again. Also, why do I need to subtract at all when multiplying? Can anyone please explain this to me? The book I'm reading did a great job at explaining the dot product, but not the cross product. TIA Jeremy Falcon

                                          M Offline
                                          M Offline
                                          Mattman206
                                          wrote on last edited by
                                          #32

                                          Hey Jeremy, Hopefully I can shed some light on your question. Here's a brief tutorial in vector manipulation -- you should be able to find some more detailed discussions elsewhere. Vectors can be written as 3 coordinates -- x, y, and z coordinates. For example, a vector starting at the origin (0,0,0) going to the point (2,3,4) would be writen as <2,3,4> = 2ax + 3ay + 4az ax, ay and az are unit vectors (have a length of 1) and point in the x-, y- and z-directions, respectively. That is, they are defined to be ax = <1,0,0> ay = <0,1,0> az = <0,0,1> Here I'm using the notation that (x,y,z) is a point (in parentheses) and is a vector that has an x-component of x, y-component of y, and z-component of z. Looking at the example above, and using the fact that a constant (scalar) multipled by a vector would behave as you'd expect: 2ax = 2<1,0,0> = <2,0,0> Also, adding vectors behaves as you'd expect, just add up each of the 3 components individually: <1,2,3> + <4,5,6> = <5,7,9> You can see that 2ax + 3ay + 4az = 2<1,0,0> + 3<0,1,0> + 4<0,0,1> = <2,0,0> + <0,3,0> + <0,0,4> = <2,3,4> In linear algebra lingo, the 3 vectos ax, ay, and az for a "basis" for the 3D space you are describing. Any 3 vectors can be used as a basis, provided that 1) their magnitude is 1 and 2) they are not parallel. That's a bit advanced, and we usually just choose the obvious ones of <1,0,0>, <0,1,0>, and <0,0,1> as above. It makes the math easier since each component represents one single direction, which is good. Now that we've gotten that out of the way, let's take a look at multiplication with vectors. You already seem to have a good understanding of the dot product. For the dot product, you take 2 vectors, take the dot product, and get a scalar result (just a single number). On the other hand, when you take a cross product, you take two vectors, take the cross product, and get a vector result. The physical interpretation of this is that you want to find a vector result that is perpendicular to the first 2 vectors. Think of it this way: If you take <1,0,0> x <0,1,0> = ? Basically this is ax x ay. What vector is perpendicular to both the x-direction and the y-direction? az. Try it out with your formula above. Why does this work? We need to look at how the cross p

                                          J 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups