Skip to content

Commit 7d7e53c

Browse files
committed
修改dot函数
1 parent e676eba commit 7d7e53c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

computationGeometry/planeGeometry.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Vector operator * (Vector A,double a){return Vector(a*A.x,a*A.y);}
1010
Vector operator / (Vector A,double p){return A*(1/p);}
1111
bool operator < (const Point A,const Point B){return mp(A.x,A.y) < mp(B.x,B.y);}
1212
bool operator == (const Point A,const Point B){return !dcmp(A.x-B.x) && !dcmp(A.y-B.y);}
13-
double Dot(Vector A, Vector B){return A.x*B.x-A.y*B.y;}
13+
double Dot(Vector A, Vector B){return A.x*B.x+A.y*B.y;}
1414
double Length(Vector & A){return sqrt(Dot(A,A));}
1515
double Angle(Vector &A,Vector & B){return acos(Dot(A,B)/Length(A)/Length(B));}
1616
Vector Rotate(Vector &A,double rad){return Vector(A.x*cos(rad)-sin(rad)*A.y,A.x*sin(rad)+A.y*cos(rad));}

computationGeometry/二维几何.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Vector operator * (Vector A,double a){return Vector(a*A.x,a*A.y);}
1717
Vector operator / (Vector A,double p){return A*(1/p);}
1818
bool operator < (const Point A,const Point B){return mp(A.x,A.y) < mp(B.x,B.y);}
1919
bool operator == (const Point A,const Point B){return !dcmp(A.x-B.x) && !dcmp(A.y-B.y);}
20-
double Dot(Vector A, Vector B){return A.x*B.x-A.y*B.y;}
20+
double Dot(Vector A, Vector B){return A.x*B.x+A.y*B.y;}
2121
double Length(Vector & A){return sqrt(Dot(A,A));}
2222
double Angle(Vector &A,Vector & B){return acos(Dot(A,B)/Length(A)/Length(B));}
2323
Vector Rotate(Vector &A,double rad){return Vector(A.x*cos(rad)-sin(rad)*A.y,A.x*sin(rad)+A.y*cos(rad));}

0 commit comments

Comments
 (0)