How to find a point lies inside the plane in 3d - math

I have a plane with 3D coordinates of vertices in world coordinate system and also plane equation.
Coordinates
x y z
19.1320421 72.9177745 0 P1
19.1320426 72.9178202 0 P2
19.1320426 72.9178202 12.04 P3
19.1320421 72.9177745 12.04 P4
Plane eqn:
-0.999945876x+0.010404061y+0z-18.37241258 =0
Point:19.13208745 72.91761882 2.35762E-06
Can anyone describe or provide a link for how to find a point lies within or not in the plane that will help me understand and implement them?

If you plug in the values into the equation, then if the equality holds, the point lies in the plane. This means all you have to do is plug in x, y and z into the equation and check if it is equal to 0.
It's important to consider that you are using decimals here, so to make sure a rounding error does not throw you off you can simply check if its within a threshold.

A plane equation is the equation that will give a 0 for any points inside that plane. You already have the plane equation, so all you need to do is to enter the new x, y, z in the equation. If you get 0 then the point is in that plane.

Substituting the coordinates in the plane equation you should get zero if the point lies within the plane.

Related

Calculating the euler angles of a line relative to three axes

I have asked a question similar to this before but have since got further and also didn't tag the question right and wanted to get a bit of help on the maths around the question if possible.
I have a 3D sphere with points evenly spaced on its surface of which I know the coordinates. From these coordinates I am trying to define the orientation of some spikes that are coming out of the surface of my sphere along the vector between the centre of the sphere and the point at which the coordinates lie.
The idea is these euler angles will be very helpful in later aligning the spikes so they are all in roughly the same orientation if I am am to box out all of the spikes from an image.
Since the coordinates on the sphere are evenly spaced i can just take the average x, y and z coordinates to give me the centre and I can then draw a vector from the centre to each coordinate in turn.
The euler angles I need to calculate in this case are initially around the z axis, then around the new y axis, and finally again around the new z axis.
My centre point is currently being defined as the average coordinate of all my coordinates. This works as the coordinates are evenly spaced around the sphere.
I then use the equation that states
cos(theta) = dot product of the two vectors / magnitude of each vector multiplied together
on the x and y axis. One of my vectors is the x and y of the vector i am interested in whilst the other is the y axis (0,1). This tells me the rotation around the z axis with the y axis being 0. I also calculate the gradient of the line on this 2D plane to calculate whether I am working between 0 and +180 or 0 and -180.
I then rotate the x axis about the angle just calculated to give me x' using a simple 2D rotation matrix.
I then calculate the angle in the same way above but this time around the y axis using x' and z' as my second vector (where z' = z).
Finally I repeat the same as stated above to calculate the new z'' and x'' and do my final calculation.
This gives me three angles but when I display in matlab using the quiver3 command I do not get the correct orientations using this method. I believe I just do not understand how to calculate euler angles correctly and am messing something up along the way.
I was hoping someone more knowledgeable than me could take a glance over my planned method of euler angle calculation and spot any flaws.
Thanks.

Point to the left or right of 3D vector in a specifc plane?

I am not sure if a question like this was asked before but i searched and didn't found what i am looking for.
I know how to determine if a point is to the left or right of a 2D line. but suppose we have a vector in 3D. of course a 3D vector passes through infinite planes, but suppose we chose one plane of them in which we are interested, and we have a specific point on this plane which we want to know if it lies to the left or right or on our vector (with respect to the chosen plane). how to do this ?
You should explicitly define orientation of that plane - for example, define main (forward) normal N - like OZ axis is normal for OXY plane.
If you have A,B,C triangle and claim that it is oriented counterclockwise, you can calculate forward plane normal as N = AB x BC
For points A, B, D in given plane calculate mixed product (vector product of AB and AD, then scalar product of result and N)
mp = (AB x AD) . dot. N
Sign of this value is positive, if vectors AB, AD, N form right-handed triplet and D lies left to AB direction
An intuitive solution is to define a coordinate system for the plane as follows. Let's normalize the 3d vector in your question and call the resulting unit vector v, and let x be a point on your plane, whose unit normal we will denote as n. You can now chose a coordinate system centered at x, that is made by the three 3*1 unit vectors v, n and b=v.crossProduct(n).
The idea is that if you express a point in this coordinate system, then if its b coordinate is negative, you can says that it is, say, on the left. So, if its b coordinate is positive, it will be on the right.
Obviously, if you have a point q expressed in this coordinates system, you can write its expression q_w in world coordinates using
q_w=R*q+x
where the rotation matrix R is the matrix whose columns are the unit axes of the plane coordinate system:
R=[v n b]
So, if you have a point Q in world coordinates, using the inverse of the relation above, you compute transpose(R)*(Q-x), and look at whether the b coordinate is positive or negative.

How to get points coordinates on circle circumference with equal arcs length in unity

Let's highlight some points on this image.
N point coordinates (0, 0)
A point coordinates (3, 0)
The (ANB) angle = 30 degrees
AB distance = BC distance = CD distance
Now, I want to get the coordinates of B, C and D points.
I can get every point coordinates by trigonometry (Sin, Cos ...), But my question is
Is unity engine provide any method to get point coordinates which lies on circle if I know the start point and arc length to the point which i need to get its coordinates ?? i.e. if i know the length of AB arc -in upper image- and A point coordinates, Can unity gives me the B point coordinates !? (of course i meant without trigonometry).
This is exactly the kind of problem trigonometry was invented to solve; trying to do it without trigonometry is just silly. If you are starting at point (x,y) on a circle or radius r, and you want to rotate by an angle of a, then the new point is at
(cos(a + arccos(x/r)), sin(a + arcsin(y/r)))
And if you need to implement these trig functions yourself, read up on their Taylor series expansions.

compute angle of rotation between two orthographic projections

I Have the orthographic projection of a unit cube with one of its vertex at origin as shown above. I have the x,y (no z) co ordinates of the projections. I would like to compute the angle of rotation of the plane to get the second orthographic projection from the first one (maybe euler angles??)
Is there any other easy way to compute this?
UPDATE:
Could I use this rotation matrix to get a system of equations in cos, sin angles and the x,y and x',y' and solve them easily? Or is there any easier way to get the angles back? (Am I on the right direction to solve this? )
First method
Use this idea to generate equations:
a1, a2 and a3 are coordinates in the original system, x y are the coordinates you get from the end-result and z is a coordinate you don’t know. This generates 2 equations for every point of the cube. E.g for point 0 with coordinates (-1, -1, 1) these are:
Do this for the 4 front points of the cube and you get 8 equations. Now add the fact that this is a rotation matrix -> the determinant is 1 and you have 9 equations. Solve these with any of the usual algorithms for solving equation systems and you have the transformation matrix. Getting the axis and angle from that is easy via google: http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/
Second method
Naming your points 0, 1, 2, 3 a, b, c, d respectively, you can get the z coordinates of the vectors between them (e.g. b-a) with this idea:
you will still have to sort out if b3-a3 is positive, though. One way to do that is to use the centermost point as b (calculate distance from the center for all points, use the one with the minimal distance). Then you know for sure that b3-a3 is positive (if z is positive towards you).
Now assume that a is (0,0,0) in your transformed space and you can calculate all the point positions by adding the appropriate vectors to that.
To get the rotation you use the fact that you know where b-a did point in your origin space (e.g. (1,0,0)). You get the rotation angle via dot product of b-a and (1,0,0) and the rotation axis via cross product between those vectors.

Project an axis to a plane

How do I project the X axis to a plane if the plane is defined by three points?
The default local 1-direction is the projection of the global x-axis onto the surface. If the global x-axis is within 0.1° of being normal to the surface, the local 1-direction is the projection of the global z-axis onto the surface.
Let's suppose that these points are:
t1 = [-0.362879991531372, 0.357021987438202, -0.373737007379532]
t2 = [-0.383525013923645, 0.371621012687683, -0.383549988269806]
t3 = [-0.383534014225006, 0.34629300236702, -0.38544899225235]
Is the vector [0.78280971952246, -0.0307519963686645, 0.411184845614438] correct answer in this case? I've calculated the angle between the surf and x (1,0,0) is ~28°.
And can you give the entire procedure for the calculation, because I'm just puzzled.
Your diagram is a little unclear (for instance, it doesn't show t1, t2, t3), but it looks as if you want a vector tangent to the surface and in the XZ plane. If that's correct, then you have to calculate the partial derivative with respect to x (the slope in the x direction, which is easy if the surface really is a plane and you have three non-colinear points) and the y-component of your answer will be zero. If that's not correct, then please explain what "projection" you prefer.

Resources