Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 What is dotProduct
Index -> General Programming
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
metachief




PostPosted: Wed Dec 10, 2008 12:52 pm   Post subject: What is dotProduct

I'm very desperate to learn how to do polygon collision detection, but I don't know dotProduct which is an essential part of it. Could someone explan it thoroughly. By the way, I am using Turing to program it.
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Wed Dec 10, 2008 1:04 pm   Post subject: RE:What is dotProduct

It's not programming, it's Math

http://en.wikipedia.org/wiki/Dot_product
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
metachief




PostPosted: Wed Dec 10, 2008 1:17 pm   Post subject: RE:What is dotProduct

But, it's still part of programming, isn't it? Programming collision detection between two polygons requires math and knowledge of programming language. The difficult part is understanding how to put the math in the program.
Euphoracle




PostPosted: Wed Dec 10, 2008 3:32 pm   Post subject: RE:What is dotProduct

It has nothing to do with programming. For the same reason that addition isn't programming, neither is a dot product. It's math that you employ to do something. Your programming is putting it to use.
metachief




PostPosted: Wed Dec 10, 2008 3:56 pm   Post subject: RE:What is dotProduct

Well most programs can not be made withought knowing math, so how is it not part of programing? If youre putting it to use with programming, then it is part of it.
gitoxa




PostPosted: Wed Dec 10, 2008 4:00 pm   Post subject: RE:What is dotProduct

It's like how a square is a rectangle, but a rectangle isn't a square.

It doesn't go both ways
Zeroth




PostPosted: Wed Dec 10, 2008 4:11 pm   Post subject: Re: What is dotProduct

Now we're getting into semantics. Theres several different views.

First view: Programming as math.
Turing machines came out of math and a study of computability. Most modern languages are turing complete. Turing machines are equivalent to lambda calculus(another form of math). Therefore, programming is really just deriving the correct answer.(Thanks to Djikstra for that insight.)

Second view: Programming uses math.
Boolean logic is both Computer Science and Math, and programming is essentially an extension of the application of boolean logic. It uses math. It is not math.

Now, really, no one needs to point out that a dot product is not programming, but math. You can implement it in programming. Depending on your view, that makes programming math. So then does that make all turing-complete languages just glorified turing machines? Difficult question to answer, that just comes down to belief, preference, and semantics.

Now, onto the topic at hand.

Take two vectors(they must have the same number of values), like say [1, 2, 3] and [4, 5, 6]. Then, multiply each value in the vector by its twin in the other vector, and sum that up. 1*4+2*5+3*6=32. The dot product is equal to |a||b|cos(angle between a and b). This means you can find the angle between two vectors, by rearranging the values, or finding the length of one vector if you know the other information.
metachief




PostPosted: Wed Dec 10, 2008 6:42 pm   Post subject: RE:What is dotProduct

Thank you very much Zeroth.
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> General Programming
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 8 Posts ]
Jump to:   


Style:  
Search: