# Intersecting a line with a plane in 3D

On 28/12/2015 at 04:28, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   R17
Platform:    Mac  ;
Language(s) :     C++  ;

---------
Greetings to all.

I'm trying to figure out some matrix math, and I'm having a few troubles.

I need to intersect a line with a plane parallel to the X and Z axis of a matrix in 3D space. What I'm trying to do is to figure out the 2D coordinates of that intersection point on the plane, taking into account any translation/rotation/scaling the matrix might have.

How can I go about doing this?

-CMPX

On 28/12/2015 at 06:30, xxxxxxxx wrote:

Geometry problems have been solved and documented so often... please use Google.

On 28/12/2015 at 17:59, xxxxxxxx wrote:

Yes, I realize this, and I've tried searching. Most of the solutions out there don't take into consideration any rotation around the third axis or the scaling of the two axis the plane is parallel to, and especially not in the way C4D stores this information in a matrix.

Hence my original question.

-CMPX

On 28/12/2015 at 18:38, xxxxxxxx wrote:

You can simply put both the line and the plane into global space, do the intersection calculation, and then transform the result into the space of importance.  If you are trying to find the 2D coordinates of the intersection point with respect to the plane, you are basically transforming the global result into the local space with respect to the plane.  You should arrive at two valid coordinate elements on the plane and one that is homogeneous (unchanging) due to the fact that it is on the planar axis that is unchanging over the surface (for instance, a plane on the X/Z axis is invariant on the Y-axis: all Y values are 0.0 or constant C).  This is still not relevant to C4D.  It is simply 3D geometry with respect to vectors and matrix transforms within that Euclidean system.