I have planes defined using normal(point is allways zero (0,0,0)). Plane normal is actually a up vector for few vectors which need to be translated to another plane.
I was trying to find a way how to translate these few vectors from first plane to second plane.
Related
I am trying to calculate an aim constraint in Maya using just math nodes.
I basically have two objects in 3d space, A & B. 'two transform matrices'
And I need to calculate the Euler angle with which I can rotate object A, so that it aims at object B always.
The third vector would be (0,1,0) world space up.
What would be the right formula to use to get the Euler angle?
I have tried different things, but I am not getting the right result.
I have a plane (Point, normal) and a circle(point, radius).
The circle moves around and hits the plane.
The position of the circle is reset to the touchPoint with the plane.
So far, so good.
But how can i modify the velocity of the circle, so it only moves
tangential to the plane?
So if it bumbs in the plane, the part of the velocity-vector which is
responsible for bumbing in the plane is consumed.
So, in the next step, it doesnt collide with the plane but can move on.
It "slides" on the plane.
Any ideas?
Since you give no code, I'll just state a few ideas without code.
The plane's definition of (Point, normal) is simpler if the normal vector is a unit vector (of length one). If it isn't, divide that vector by its length and it becomes a unit vector.
If the velocity of the circle is is given by a 3D Cartesian velocity vector, you can find the component of that velocity vector along the plane's unit normal vector by taking the dot product of those two vectors. The result is the directed size of the vector along the normal. You can then remove that component by multiplying the unit normal vector by that dot product, then subtracting that from the circle's velocity vector. The result of that subtraction is the circle's velocity along the plane. That apparently is what you wanted to find.
If you answer my questions in my comment under your question, I could show you some code in my current preferred language, Python 3.
I have an object in 3D space where all I have is a euler position and rotation. How can I calculate forward and up vectors from the information I have?
I know that I can calculate the forward vector in this way:
Vector3 forward = (target.getPosition() - object.getPosition()).normalize();
.. where target is any point along the axis which the object is looking. Using the information I have, how can I pick an arbitrary point in this way to normalize?
I'm not sure how to go about solving the "up" vector at all.
First create a transform matrix from your euler angles (with the same method as you are using while rendering). Then extract the axises vectors for forward and up from it directly. For example my view matrices uses Z axis for forward/backward and X axis for left/right so I would just use those two. You will find the location of the vectors here:
Understanding 4x4 homogenous transform matrices
Is it possible to define the normal of an oriented plane from 2 3D points-p1,p2?
If so, is it n=cross(p2,p1)~matlab~.Or can it be n=p2-p1?? I found the second way and i want to know if just the deduction is the normal of a plane(unknown plane).
For example i have the p1,p2 points.I want to find the normal from p2->p1 for a plane fixed at p2.
Given A: a point, B: A point known to exist on a plane P, C: the normal of plane P. Can I determine if A lies on P by the result of a dot product between (A - B) and C being zero? (or within a certain level of precision, I'll probably use 0.0001f)
I might just be missing some obvious mathematical flaw but this seems to be much simpler and faster than transforming the point to a triangle's coordinate space a.la the answer to Check if a point is inside a plane segment
So secondly I guess; if this is a valid check, would it be computationally faster than using matrix transformations if all I want is to see if the point is on the plane? (and not whether it lies within a polygon on said plane, I'll probably keep using matrix transforms for that)
You are correct that B lies on the plane through A and with normal P if and only if dotProduct(A-B,P) = 0.
To estimate speed for this sort of thing, you can pretty much just count the multiplications. This formula just has three multiplications, so its going to be faster than pretty much anything to do with matrices.
The above answers are closer to the proof, but not sufficient. It should be intuitive that using just two vectors is insufficient because for one, point P can be above the plane and a vertical line drawn from it to the plane would still generate a zero dot product with any single vector lying on the plane, just as it would for a point P on the plane. The necessary and sufficient condition is that if two vectors can be found on the plane then the actual plane is represented unambiguously by the cross product of the two vectors i.e.
w=uxv. By definition, w is the area vector, which is always perpendicular to the plane.
Then, for the point P in question, constructing a third vector s from either u or v should be tested against w by the dot product, s.t.
w.s=|w||s|cos(90)=0 implies that the point P lies on the plane described by w, which is in turn described by vectors u and v.