Mar 25, 2013 at 6:16pm UTC
Two points define a line.
In order to find other points in the line you could simply interpolate them
C_J = \alpha A_J + (1-\alpha) B_j
So varying \alpha you can obtain all the points in the line.
The formula that you linked will give you the \alpha of the intersection point of the line with the plane
Mar 25, 2013 at 6:52pm UTC
... and finally this \alpha they call u .
Mar 26, 2013 at 1:04am UTC
I would suggest you to overload the operations in vertex3.
Like with `std::valarray'
1 2 3 4 5 6 7 8
template <class T>
T dot(const std::valarray<T> &u, const std::valarray<T> &w){
return (u*w).sum();
}
//...
double u = dot(pln.n, p3-p2) / dot(pln.n, p1-p2);
*intersect = u*p1 + (1-u)*p2;
Edit: as you are using normal vector and delta to define the plane, I think that the formula is
u = (pln.d-dot(pln.n, p2)) / dot(pln.n, p1-p2); (maybe confused p1 with p2)
Last edited on Mar 26, 2013 at 1:16am UTC