find intersection of line and a plane - math

How can I find the intersection of the following line and plane using only their following parametric representation?:
line: (3,2,0) + (-1,1,5)t
plane: (0,-1,4) + (1,1,0)t + (5,1,-2)s

Related

How to calculate the point lying on the outer circle following the tagent line of the inner circle

My question is about calculating points coordinates in 2D space.
I have two circles - outer and inner, that are centered between them (the inner is in the middle of the outer).
What I know:
-the two circles' radiuses (R1,R2)
-the 2D coordinates of a random point (x) in space always outside of the inner circle
What I want to find out:
-The 2D coordinates of the two points (y,z) that are lying on the outer circle following the two tangent lines from the random point (x)
Here is an illustration of what I need
Let's circles' center is coordinate origin (0,0) (shift other coordinates by true center ones), random point is P, point at big circle is Q, small radius is r, larger one is R.
We could build a system of equations for distance from center to tangent point and for intersection point, but it requires solving of quartic equation with rather long coefficients.
So at first find equation of tangent from point P to small circle with trigonometry:
Dist = Sqrt(px^2+py^2)
tan_angle = ArcSin(r / Dist)
rot_angle = ArcTan2(py, px)
ta1 = rot_angle - tan_angle
ta2 = rot_angle + tan_angle
and tangent points are
t1x = r * sin(ta1)
t1y = - r * cos(ta1)
t2x = - r * sin(ta2)
t2y = r * cos(ta2)
Now for both tangent points solve quadratic equation like
(px + s * (t1x - px))^2 + (py + s * (t1y - py))^2 = R^2
for unknown parameter s, get two solutions s1,s2 and find points of intersections
q11x = px + s1 * (t1x - px)
and so on
Note that solution consists of four points - two tangents, two intersection points for every tangent.

From line in cartesian coordinates to polar coordinates with youth style

I have line like in 2D defined by ax+by+c = 0 so (a,b,c).
I need to compute a polar representation of this line like Hough approach with rho an theta.
How to do this?
A line in cartesian coordinates is not as easily represented in polar coordinates.
You can simply substitute x,y with their respective polar equivalents, r*cos(theta), r*sin(theta), giving you
a*r*cos(theta) + b*r*sin(theta) + c = 0
This implicit equation is not as easy to figure out, however. But, if you first convert your implicit line equation to a parametric vector equation of the form (x,y) = R(t) = R0 + t*V, where R0,V are cartesian vectors which you can derive from a,b,c, you can then write
(r*cos(theta), r*sin(theta)) = R0 + t*V
and solve this system of equations for r and theta in terms of t.
However, polar coordinates are not the same as the Hough transform.
In the Hough system, the line is defined by the length rho of a perpendicular line that crosses (0,0) , which is theta = atan(b/a). Figuring out rho seems more difficult at first, but this tutorial explains it.

Get plane from 3D polygon and normal

I have a polygon defined by n points and a polygon normal.
Now I want to get the plane of the polygon defined by
a plane normal=(nx,ny,nz)
and a constant d (distance from the origin to the plane).
The plane normal is equal to the polygon normal, but how can I calculate d?
desired plane equation nx*x+ny*y+nz*z+d=0.0
Take any point p=(px, py, pz) on the plane and plug it into the equation to obtain d.
So if your equation is
nx·x + ny·y + nz·z + d = 0
then you get
d = − (nx·px + ny·py + nz·pz).
Another common formulation is using d as the right hand side of the equation, in which case you get the reverse sign. I.e. for the equation
nx·x + ny·y + nz·z = d
you get
d = nx·px + ny·py + nz·pz.

3d orthogonal projection on a plane

I have a point in 3d P(x,y,z) and a plane of view Ax+By+Cz+d=0 . A point in plane is E.Now i want to project that 3d point to that plane and get 2d coordinates of the projected point relative to the point E.
P(x,y,z) = 3d point which i want to project on the plane.
Plane Ax + By + Cz + d = 0 , so normal n = (A,B,C)
E(ex,ey,ez) = A point in plane ( eye pos of camera )
What i am doing right now is to get nearest point in plane from point P.then i subtract that point to E.I suspect that this is right ???
please help me.Thanks.
The closest point is along the normal to the plane. So define a point Q that is offset from P along that normal.
Q = P - n*t
Then solve for t that puts Q in the plane:
dot(Q,n) + d = 0
dot(P-n*t,n) + d = 0
dot(P,n) - t*dot(n,n) = -d
t = (dot(P,n)+d)/dot(n,n)
Where dot((x1,y1,z1),(x2,y2,z2)) = x1*x2 + y1*y2 + z1*z2
You get a point on the plane as p0 = (0, 0, -d/C). I assume the normal has unit length.
The part of p in the same direction as n is dot(p-n0, n) * n + p0, so the projection is p - dot(p-p0,n)*n.
If you want some coordinates on the plane, you have to provide a basis/coordinate system. Eg two linear independent vectors which span the plane. The coordinates depend on these basis vectors.

3D Line - Plane intersection?

I am having two Vectors (X,Y,Z), one above Y=0 and one below Y=0.
I want to find the Vector (X,Y,Z) where the line between the two original vectors intersects with the Y=0 level.
How do I do that?
Example Point A:
X = -43.54235
Y = 95.2679138
Z = -98.2120361
Example Point B:
X = -43.54235
Y = 97.23531
Z = -96.24464
These points read from two UnProjections from a users click and I'm trying to target the unprojection to Y=0.
(I found 3D line plane intersection, with simple plane but didn't understand the accepted answer as it's for 2D)
I suspect that by two vectors, you really mean two points, and want to intersect the line connecting those two points with the plane defined by Y=0.
If that's the case, then you could use the definition of a line between two points:
<A + (D - A)*u, B + (E - B)*u, C + (F - C)*u>
Where <A,B,C> is one of your points and <D,E,F> is the other point. u is an undefined scalar that is used to calculate the points along this line.
Since you're intersecting this line with the plane Y=0, you simply need to find the point on the line where the "Y" segment is 0.
Specifically, solve for u in B + (E - B)*u = 0, and then feed that back into the original line equation to find the X and Z components.
The equation for the line is
(x–x1)/(x2–x1) = (y–y1)/(y2–y1) = (z–z1)/(z2–z1)
So making y=0 yields your coordinates for the intersection.
x = -y1 * (x2-x1)/(y2-y1) + x1
and
z = -y1 * (z2-z1) /(y2-y1) + z1

Resources