Register to reply 
The reverse operation for the dot product? 
Share this thread: 
#1
Jan3013, 03:56 PM

P: 7

Okay. First off. This isn't homework. I have been working on a personal project and if I could get an equation for this it would really help me out. I'll try and explain the problem the best I can.
What I need: An equation/method where I can specify an angle theta and a 3D line and it returns the 3D coordinates of the points on the line which make the angle theta with the origin and the point (1, 0, 0). The problem: You have a 3D graph with origin O. The positional vector A with coordinates (1, 0, 0) and another position vector B. You could use the dot product function to work out the angle AOB, if you had B. But you don't. Dot Product function: cos(theta) = A.B/(A*B) You also know that B is somewhere on the 3D line r = (x, y, z) + lambda(a, b, c), where lambda is proportional to the displacement from (x, y, z) and (a, b, c) is the 3D gradient. This line can also be represented as a Cartesian line equation in the form x=y=z (but some other coefficients etc.) e.g it could be 2x=5y=(3z2)/4. I want to specify an angle theta between BOA and work out position vector of A and the position vector of equation of the line B rests on. O will always have coordinates (0, 0, 0), but that doesn't mater as it's just a point of relevance. Also, it i worth mentioning that there may well be two solutions for B for a given angle theta if the line cuts through the angle twice, or one or no solutions. Actually come to think of it it could have infinite solutions if theta was 90 degrees (Point 90 degrees from the vector (1, 0, 0) are on the plane x = 0, because this is a flat plane, as a pose to a cone shape (the one value of theta where this happens), if the x coordinate of every point line r is also always equal to 0, then there will be infinite solutions). I like to think about the angle as a cone with the tip at the origin, (where every point on the surface of the cone is theta degrees away from the origin). Ramblings of a mad man: I have defined the function dotProduct (3DVector), which returns the angle AOB, when B is the parameter. The only things that I could work out are that for very large values of lambda in the line r the coordinate tends towards being a multiple of (a, b, c) (3D gradient), as the (x, y, z part gets infinitely small by comparison). And so the coordnate (a, b, c) can be treated as B if lambda is infinitely large. So we can do dotProduct((a, b, c)), which returns the same angle as though B where (a, b, c). Also I was thinking this: If you take the line r2 = (0, 0, 0) + lambda*(a, b, c). As in a line with the same gradient as r, but goes through the origin. Then the point on the line r, which is perpendicular to the line r2 through the origin point, is the closet to the origin the line r will get and if we treat that point as B then theta will be within 90 degrees + the acute angle a point on the line r2 makes with A and O. And since r2 goes through the origin, there are only two angles any point on the line r2 can make with A and O (on acute one when the point is less than 90 degrees and one obtuse one it is over 90 degrees). The reason why I need this is because I have made a 3D engine, which takes into account perspective and that distortion effect you get when you take a panoramic photo with a large angle of view. To do the distortion effect I am just sampling the 3D line in 3D space very often and joining them with straight lines, but movement 3D space is only proportional to movement in the 2D rendering in very specific directions/positions relative to the camera. I have made it o it only samples as often as it need to (less when it is less distorted, more when it is more distorted etc.), but it would be a big help if I can figure out how to do this reverse dot product, because it will mean I can start rendering at the edge of a certain field of view, which will get rid of a lot of redundant computations. Thanks for any help guys. I'd really appreciate. Reagrds, Greg. P.S.  If this is the wrong section, please say. << Mentor Note  Use the Report button to ask the Mentors to move it >> 


#2
Jan3013, 04:53 PM

Mentor
P: 12,028

For each lambda, you have a known point r. You can calculate the angle α you get with that value of lambda, and solve the resulting equation (with the fixed angle) for lambda.
You will get some special cases during the solution process, which correspond to "all lambdas are a solution" and similar things. 


#3
Jan3013, 06:00 PM

P: 7

where x, y, z, a, b, c are know and lambda is known. let's say we want r when alpha = 80 degrees Okay so we have the equation alpha = acos(((x+ lambda*a, y + lambda*b, z + lambda*c).(1, 0, 0))/(((x+ lambda*a)^2 + (y+ lambda*b)^2 + (z + lambda*c)^2)^(0.5))*(1^2 + 0^2 + 0^2)^0.5)) (1^2 + 0^2 + 0^2)^0.5) = 1, so alpha = acos(((x+ lambda*a, y + lambda*b, z + lambda*c).(1, 0, 0))/(((x+ lambda*a)^2 + (y+ lambda*b)^2 + (z + lambda*c)^2)^(0.5))) since wee're using (1, 0 , 0), we only need to consider the x component of r for the dot product, so alpha = acos((x+ lambda*a)/(((x+ lambda*a)^2 + (y+ lambda*b)^2 + (z + lambda*c)^2)^(0.5))) Then I try to rearrange and get stuck cos^2(alpha) = (x^2 + 2*lambda*x*a + (lambda*a)^2)/((x+ lambda*a)^2 + (y+ lambda*b)^2 + (z + lambda*c)^2) If you can rearrange that for lambda I would be very grateful! My maths skills don't seem to be up to it :). 


#4
Jan3013, 08:46 PM

P: 688

The reverse operation for the dot product?
Hi, cawthorne,
you are doing fine so far. You expanded the square in the numerator of the fraction, and eventually you will have to expand also the three squares in the denominator. This could be done now, or a bit later. The important next step is to notice that cos^2(alpha) is just a constant, because alpha is given. You can pass the whole denominator multiplying to the left side. Then distribute the constant cos^2(alpha), and then expand the squares as you did before. Finally you will be able to group the terms in lambda^2, in lambda and with no lambda, to find a solution of a quadratic equation. (You will see when you get there.) 


#5
Jan3113, 03:09 AM

P: 7

Ahhh silly me :P. I did think it might have been a quadratic thing, but I got lost in all the extra terms (which I knew already!) :P.
Thanks! 


#6
May1113, 06:29 AM

P: 7




Register to reply 
Related Discussions  
Why is the Vector Product Operation Considered Multiplication?  Linear & Abstract Algebra  12  
Show the product of convergent sequences converge to the product of their limits  Calculus & Beyond Homework  2  
Why some functional integral(in QTF theo)of a product equal product of two the integr  Quantum Physics  2  
Cross product and dot product of forces expressed as complex numbers  Introductory Physics Homework  4  
Reverse product rule?  Calculus & Beyond Homework  1 