# Can I replace the cross product with the wedge product?

This topic is 3646 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

As you know the cross product is only defined for vectors in 3 and 7 dimensions. Now I would like to implement an analog to the cross product in 2 dimensions which produces a scalar as follows: (x0, y0) ^ (x1, y1) = x0.y1 - y0.x1 (where . is multiplication) So I was thinking that since my place of work has opted to use ^ as a cross product, it seems quite elegant to instead redefine the ^ operator as the (Hodge dual of the) wedge product since this happens to be equivalent to the cross product in three dimensions. In other words: *(A^B) = A x B in three dimensions. (where * is the Hodge Dual operator, ^ is the wedge product and x is the cross product) As far as I can tell this also does what I want it to in two dimensions (using this reference): *(A^B) = A0.B1 - A1.B0 in two dimensions QUESTION: 1. So I had been thinking, is it permissible to replace our ^ operator with the Hodge Dual of a wedge product for vectors of all dimensions? 2. In other words could I extend this operation in a useful manner to vectors of higher dimensions? 3. And finally I suppose you could then write all *(A^B) in a matrix form? E.g. as for the 3D cross-product:
        [  0  -A2   A1 ]   [ B0 ]
A x B = [  A2  0   -A0 ] * [ B1 ]
[ -A1  A0   0  ]   [ B2 ]

Unfortunately I have some pressing deadlines so I can't spend too much time studying the math. Any commentary will be much appreciated and I apologize for any ignorance on my part! ;)

##### Share on other sites
The dual of a 2-blade in 3 dimenions results in a 1-blade (vector) perpendicular to this 2-blade (where the 2-blade represents a plane in euclidian space).

n = (a ^ b)*

This can easily be used in the same way for higher dimensions, but will not have the geometrical significance of a normal vector. Instead, the dual of a plane in 4D will result in another (dual)plane.

In short, only the dual of a pseudoscalar results in a scalar. A pseudoscalar is a k-blade in a k-dimensional space (plane in 2D, sphere in 3D, hypersphere in 4D).

The crossproduct only works for 3D (and for converted 2D).

About the matrices, I'm not sure it's that easy. I've never looked into it.

##### Share on other sites
I'm afraid most of that went over my head (I'm sorry I have no experience with Clifford algebra), but I think I get what you're saying anyway, since I suspected as much. From here the 4d dual of a bi-vector is this:
Dual(e31) = e1234 . e31 = e42which is still a bi-vector. (I hope I'm making sense since I don't really know what I'm talking about ;) )I guess I was trying to find a nice analog to the cross-product which is general enough to be meaningful for all dimensions but happens to give the determinant in two dimensions and the cross product in three dimensions... It seems inelegant to limit an operator to a finite number of dimensions. (Damn you Nature! :) ) 
 0 
 Share this post Link to post Share on other sites 
 
 
 rozz666    896 rozz666 Member 896 Posted January 24, 2009 The cross product is defined for n-dimensional space and you need n-1 vectors to calculate it. For 3D it's: [ i j k ]u (x) v = [ ux uy uz ] [ vx vy vz ]I'm not sure it makes sense for 2D (I used the concept sometimes):(x)(u) = [ i j ] = [ uy, -ux ] [ ux uy ]For 4D it's: [ i j k l ](x)(u, v, w) = [ ux uy uz uw ] [ vx vy vz vw ] [ wx wy wz ww ]And so on... 0 Share this post Link to post Share on other sites errantkid    188 errantkid Member 188 Posted January 24, 2009 Hi rozz, ah yes thanks I take your meaning! To give some context, I was previously looking at this thread.I'm actually looking for an alternative operator to the cross-product that happens to suit my needs (I.e. an operator that operates on only two operands). The wedge product happens to do what I want for the 2D and the 3D case and looks a lot like the binary ^ operator. On the other hand combining three operands using ^ is not possible, so essentially I want to redefine my old cross-product ^ as a wedge-product ^. I'm thinking if you want to retain the cross product, maybe you should define it as cross(x,y,z,...) to retain consistency across all dimensions.So I guess I'm testing the water to see whether others think that it would be a good idea to redefine my ^ as a dual(wedge product). Unfortunately this dual wedge product doesn't seem to extend nicely past 3 dimensions :_( 0 Share this post Link to post Share on other sites yahastu    154 yahastu Member 154 Posted January 24, 2009 The cross product has a geometric meaning that is useful in 3 dimensions..what good is it for 2 or n-dimensions, whats the point? 0 Share this post Link to post Share on other sites errantkid    188 errantkid Member 188 Posted January 24, 2009 Well, the cross product is definitely useful in 2 dimensions: it gives you an orthogonal vector.The wedge product is also useful in 2 dimensions: it gives you the determinant of | A B | which is what I'm using right now for triangle-triangle intersection.As for higher dimensions, who knows what it's useful for? For example, I used to think that eigen-vectors and eigen-values were useless too, but since then I've discovered a multitude of uses for them. Admittedly I can't imagine a use for the 4d wedge product, but maybe someone will disagree with me? 0 Share this post Link to post Share on other sites Christer Ericson    840 Christer Ericson Member 840 Posted January 24, 2009 Quote:Original post by errantkid2. In other words could I extend this operation in a useful manner to vectors of higher dimensions?You might, but even so I would consider it bad for a number of reasons, including being overengineered and overly complex. (In fact, I consider overloading circumflex to be the cross product to be bad form, but that's a different discussion.)You are better off defining a normal cross product for your 3-vectors and a pseudo-cross product for your 2-vectors. People who will use your code in the future will thank you. 0 Share this post Link to post Share on other sites yahastu    154 yahastu Member 154 Posted January 24, 2009 Found this quote by Dmytry which sums it up nicely:Quote:In 3D only. In other dimensions, cross product is not well defined, but there is well-defined analogs.In any other number of dimensions >=2, there's at least 2 different cross-product "analogs", depending to what properties of 3D cross product we want it to mimic. And 3D is just only special case when both things is the same... and there's many other useful functions possible, that is somewhat like cross product...In 2D,CrossProductAnalog1(U,V)=(U.x*V.y-U.y*V.x)CrossProductAnalog2(U)=(U.y, -U.x)(yes, second analog takes only one argument, and return orthogonal vector :)First analog makes some physical and geometrical sense, second analog comes from "determinant rule", for determinant of 2x2 matrix,|A B||C D| = AD-BCAnd in 4D, there is one analog that takes 2 4D vectors at input and return 6D vector as result. And other analog that takes 3 4D vectors, and have 4D vector as result. (3 vectors is necessary to define volume, and returned result is "normal of that volume" )Also, in 3D we can define another nice operation that takes 3 vectors at inputs, and return scalar, and is eqivalent to first 2D cross product analog.SomeFunction(A,B,C)=(A x B . C)- return volume of paralelepiped(sp?)(note that order of operands does not matter...)in summary,1: 2D cross product is not defined by itself. In general, there's several analogs, and no analogs is completely equivalent.2: you can define whatever function you *really* need and can use, and then use it.3:It is not useful to make cross product routine if you don't know it's properties.Also, "analog" doesn't really have any mathematical sense, just some properties is somewhat similar. 0 Share this post Link to post Share on other sites errantkid    188 errantkid Member 188 Posted January 24, 2009 Quote:You might, but even so I would consider it bad for a number of reasons, including being overengineered and overly complex. (In fact, I consider overloading circumflex to be the cross product to be bad form, but that's a different discussion.)Thanks, I suspected that people might feel this way. It seems I'm not the first person who has thought to do this either: threadMy problem is mainly that I want to write this kind of thing more elegantly:det1 = p1[0]*q[1]-q[0]*p1[1];gama1 = (p1[0]*r[1]-r[0]*p1[1])*det1;alpha1 = (r[0]*q[1] - q[0]*r[1])*det1;alpha1_legal = (alpha1>=0) && (alpha1<=(det1*det1) && (det1!=0));det2 = p2[0]*q[1] - q[0]*p2[1];alpha2 = (r[0]*q[1] - q[0]*r[1]) *det2;gama2 = (p2[0]*r[1] - r[0]*p2[1]) * det2;Which is from Oren Tropp's triangle intersection algo but I guess I'm stuck with it :) Perhaps I should just define a determinant function so thatdet1 = det(p1,q);gama1 = det(p1,r)*det1;alpha1 = det(r,q)*det1;alpha1_legal = (alpha1>=0) && (alpha1<=(det1*det1) && (det1!=0));det2 = det(p2,q);alpha2 = det(r,q) * det2;gama2 = det(p2,r) * det2;Quote:People who will use your code in the future will thank youNo they won't, but at least they won't complain either :). I'm a fan of your blog by the way, kudos for thatQuote:Found this quote by Dmytry which sums it up nicelyThanks :) 0 Share this post Link to post Share on other sites 
 Prev 1 2 Next Page 1 of 2   Sign in to follow this   Followers 0 
 Go To Topic Listing Math and Physics Advertisement 
 Advertisement What is your GameDev Story? In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us. (You must login to your GameDev.net account.) Share My Story Popular Tags 2D 3D Advice Algorithm C# C++ Character Concept Design DX11 DX12 Gameplay General Graphics Learning Mobile Music OpenGL PC Pixel SFX Unity Unreal VR Vulkan Popular Now 10 Managing pointers upon object destruction in C++ By too_many_starsStarted Yesterday at 08:21 AM 11 MMORPG Brilliant Game Idea. By Tara LouiseStarted Thursday at 12:03 AM 13 Unity Updates Terms of Service in Response to Developer Backlash By khawkStarted Wednesday at 04:25 PM 9 2D [DX9] Displaying font loaded by FreeType By datboiStarted Wednesday at 06:41 AM 11 DX11 Weird depth buffer values By jakovoStarted Monday at 04:50 PM Advertisement Forum Statistics Total Topics 634088 Total Posts 3015451 GameDev.net GameDev.net Articles GameDev.net Event Coverage GameDev.net Forums GameDev.net Blogs GameDev.net Gallery GameDev.net News GameDev.net Projects GDNet Chat All Activity Search In Everywhere This Forum This Topic More options... Find results that contain... All of my search term words Any of my search term words Find results in... Content titles and body Content titles only Home Forums Programming Math and Physics Can I replace the cross product with the wedge product? 
 
 
 × Existing user? Sign In Sign Up Browse Back Articles & Tutorials Back All Categories Audio Business Game Design Industry Programming Visual Arts Columns Back GameDev Unboxed Event Coverage Back All Events Game Developers Conference Power Up Digital Games Conference GameDev.Market Links News Podcasts Back All Podcasts Game Dev Loadout Archive Community Back Beginners Back Beginners Group Beginners Forum Beginners Resources Blogs Calendar Chat Forums Back All Forums Audio Business Game Design Programming Visual Arts Community GameDev Challenges Affiliates Topical Workshops Gallery Groups Back For Beginners GameDev Challenges All Groups Projects Back All Projects Games Game Assets Game Mods Developer Tools Store Forums Back All Forums For Beginners Audio Back Music and Sound FX Games Career Development Business Back Games Career Development Production and Management Games Business and Law Game Design Back Game Design and Theory Writing for Games Programming Back Artificial Intelligence Engines and Middleware General and Gameplay Programming Graphics and GPU Programming Math and Physics Networking and Multiplayer Visual Arts Back 2D and 3D Art Critique and Feedback Community Back GameDev Challenges GDNet Lounge GDNet Comments, Suggestions, and Ideas Coding Horrors Your Announcements Hobby Project Classifieds Indie Showcase Affiliates Back NeHe Productions AngelCode Topical Workshops Careers Back Contractors Hobby Projects Game Jobs Back Browse on GameDev.Jobs Post a Job Members Back Subscriptions Chat Guidelines Leaderboard Online Users Awards Search Back All Activity My Activity Streams Back Latest Topics Featured Blogs Search Important Information By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.   I accept GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry. Sign me up! 
 $('body').click(function (e) { var container =$("#pagecontainer"); if (($(e.target).parent().prop('nodeName') == 'BODY') && (container.has(e.target).length === 0) && (e.button == 0) && (!$(e.target).hasClass('ipsDialog'))) { window.open('https://ad.doubleclick.net/ddm/trackclk/N129002.1825GAMEDEV.NET/B11085475.236262913;dc_trk_aid=433791501;dc_trk_cid=90245747;dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;tfua='); ga('send','event','Advertisement','Click','3q_fb_gamedev_skin_2019_1'); } }); $(document).ready(function() { setInterval(function() { window.googletag.pubads().refresh(); }, 30000); });$(document).ready(function() { if (ipsSettings.memberID > 0) { ga('send','event','User','View','Member'); } else { ga('send','event','User','View','Guest'); } });