sqrt

earetgwetserta
Last edited on
deleted
Last edited on
Suppose v and u are vectors.
The dot product
uv = |u| |v| cos(theta)
where theta is the angle between the vectors.
So if the vectors are normalised then
uv = cos(theta)
Last edited on
thanks, but how can i assign that the line between p1 and p2 is line v?
I don't know what is a your class Line. You don't need it.
Just use the points: a vector is the difference between two points.
1
2
3
4
5
6
7
8
Point p[3];
math::vector v[3]; 
for(int K=0; K<3; K++){
  v[K] = p[K] - p[ (K+1)%3 ]; //circular list
  v[K].normalize();
}
for(int K=0; K<3; K++)
  cout << v[K]*v[ (K+1)%3 ] << ' '; //show the cosines (again with circular list) 


PS: the class math::vector doesn't exists, but I think you get the idea
Topic archived. No new replies allowed.