# A problem with Dot Product

1. Aug 8, 2014

### aosome23

So, is there anyway to make the dot product change linearly? What I mean by this is when the angle is 45 degrees, I want it to be 0.5 instead of 0.7071 as you can see in this image:

Instead I want 45 degrees to be 0.5, 60 degrees to be 0.33 and 30 degrees to be 0.66. Same would apply for the other side(135 should be -0.5)

Thank you

2. Aug 8, 2014

### HallsofIvy

Staff Emeritus
You can redefine it to be anything you like but it wouldn't be the dot product anymore. What is your purpose in wanting to do such a thing?

3. Aug 8, 2014

### jbunniii

The dot product between two unit vectors is $\cos(\theta)$. It seems that you just want $\theta$. So you can compute $\cos^{-1}(u \cdot v)$ if $u$ and $v$ are unit vectors, or $\cos^{-1}((u/\|u\|) \cdot (v / \|v\|))$ in general. The result will be an angle between $-\pi/2$ and $\pi/2$, which you can then scale as you like. If you want the range to be from $-1$ to $1$, then multiply by $2/\pi$.

4. Aug 8, 2014

### aosome23

I'm trying to make a game and for some reason I thought that the dot product changed consistently with the angle.

5. Aug 8, 2014

### aosome23

Thank You! I did not know that the dot product is cos!
:D

6. Aug 9, 2014

### Student100

This is an incorrect way to interpret what was said, you missed the unit vector qualifier that would make A dot B = cos(theta) true. Generally the dot product is defined as A dot B = ||A|| ||B||cos(theta). I think if you just defined a switch statement or better yet, a class, to do what you want you could avoid the whole reinventing the dot product here.

Last edited: Aug 9, 2014