Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static double cosBetweenTwoVector(Point vec1,Point vec2){
- float divider = sqrt(pow(abs(vec1.x), 2)+ pow(abs(vec1.y),2)) * sqrt(pow(abs(vec2.x), 2) + pow(abs(vec2.y), 2));
- float cosin = (vec1.x*vec2.x)+(vec1.y*vec2.y)/ divider;
- return cosin;
- }
- Point vec1 = Point(p1.x-p2.x,p1.y-p2.y);
- Point vec2 = Point(0,vec1.y);
- cout<< "Cosin= " << cosBetweenTwoVector(Point(0,3),Point(0,3));
- float rotationRadius = acos(cosBetweenTwoVector(vec1, vec2));
- float RAD2DEG = 180 / M_PI;
- float rotationDeg = rotationRadius * RAD2DEG;
- if (rotationDeg < 80 || rotationDeg > 100) {
- rotateImage(src, 90-rotationDeg, src);
- }
- cout<< "Rotatation: " << rotationDeg << endl;
Advertisement
Add Comment
Please, Sign In to add comment