# Weird vector distance in linear algebra

I'm trying to understand this document: http://www.flipcode.com/archives/Raytracing_Topics_Techniques-Part_7_Kd-Trees_and_More_Speed.shtml

but I don't understand how this distance is calculated:

vector b = vertex3 – vertex1
vector c = vertex2 – vertex1
vector Normal = cross( c, b )
distance = -dot( O – vertex1, N ) / dot( D, N )


vertex1 is a vector to a triangle's first vertex, vertex2 to its second and vertex3 to its third. Normal is the normal vector to two vertices and it's needed because I'm trying to figure out if a vector intersects a plane or not.

O is a vector's origin point and D is the same vector's destination point.

My question is: how's that "distance" calculated? It should be something like the vector's distance from the plane but I'm unsure how it works

-
$O$ is the origin? And what is $D$? – user7530 Feb 7 '13 at 17:09
The document doesn't say it.. but I suppose O it's a ray's origin vector and D its direction vector. This code should be used to check whether a ray intersects a triangle – Marco A. Feb 7 '13 at 17:11