In this note I will explain how to find the intersection point P between two line segments. Note that this method will also calculate intersections on extended line segments.
As a reminder the cross product is the area of the parallelogram enclosed by the two As a reminder, the cross product is the area of the parallelogram enclosed by the two vectors. In 2D graphics, we will calculate only the z-component of the cross-vector, which will be called the cross-product in this note.
It can be calculated using the following formula:
Calculating the actual intersection:
As an example we will calculate the intersection point  of line segments 
 and 
 as shown in image 1.
We will consider the line segments as vectors, this gives us the following vectors.
, 
 
To calculate the intersection point we will first calculate the area of the parallelogram formed by AB and CD as shown in image 2.
The area can be calculated using the cross product of 
Calculating the offset on segment 
We will now calculate the area below vector  as seen in image 3
It can be seen the offset on segment on  will be equal to this area divided by the total area calculated earlier. Fortunately we can easily calculate the area by using the area shown in image 4. 
The areas shown in image 3 and image 4  are the same. Note that image 4 shows the parallelogram formed by  and 
, we will use the cross-product to calculate it. 
We will introduce vector  for this.
Now we are almost done. We have both areas (9 and 36) so we can create the offset
 which can be simplified to 
If we multiply the offset with  we find the point on the vector 
.
Since the line segment  does not start on 
 the actual point needs to be moved by 
  
Let’s check whether it is correct
As a general formula:
The offset on  can be negative or larger then one. In that case the intersection is on the extension of line segment 
. This is an advantage of this method.
Calculating the offset on segment 
For the offset of  on 
 we repeat the steps above.
We know calculate the area as shown at image 5
Which equals the area shown in image 6.
Let’s check whether it is correct
As a general formula: