-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1492e82
commit 6e1fb78
Showing
2 changed files
with
18 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,13 @@ | ||
struct Pt { | ||
ld x, y, z; | ||
Pt(ld _x = 0, ld _y = 0, ld _z = 0) : x(_x), y(_y), z(_z) {} | ||
Pt operator+(const Pt &a) const { | ||
return Pt(x + a.x, y + a.y, z + a.z); | ||
} | ||
Pt operator-(const Pt &a) const { | ||
return Pt(x - a.x, y - a.y, z - a.z); | ||
} | ||
Pt operator*(const ld &a) const { | ||
return Pt(x * a, y * a, z * a); | ||
} | ||
Pt operator/(const ld &a) const { | ||
return Pt(x / a, y / a, z / a); | ||
} | ||
ld operator*(const Pt &a) const { | ||
return x * a.x + y * a.y + z * a.z; | ||
} | ||
Pt operator^(const Pt &a) const { | ||
return Pt(y * a.z - z * a.y, z * a.x - x * a.z, x * a.y - y * a.x); | ||
} | ||
bool operator<(const Pt &a) const { | ||
return x < a.x || (x == a.x && (y < a.y || (y == a.y && z < a.z))); | ||
} | ||
bool operator==(const Pt &a) const { | ||
return dcmp(x - a.x) == 0 && dcmp(y - a.y) == 0 && dcmp(z - a.z) == 0; | ||
} | ||
Pt operator+(const Pt &a) const {return Pt(x + a.x, y + a.y, z + a.z);} | ||
Pt operator-(const Pt &a) const {return Pt(x - a.x, y - a.y, z - a.z);} | ||
Pt operator*(const ld &a) const {return Pt(x * a, y * a, z * a);} | ||
Pt operator/(const ld &a) const {return Pt(x / a, y / a, z / a);} | ||
ld operator*(const Pt &a) const {return x * a.x + y * a.y + z * a.z;} | ||
Pt operator^(const Pt &a) const {return Pt(y * a.z - z * a.y, z * a.x - x * a.z, x * a.y - y * a.x);} | ||
bool operator<(const Pt &a) const {return x < a.x || (x == a.x && (y < a.y || (y == a.y && z < a.z)));} | ||
bool operator==(const Pt &a) const {return dcmp(x - a.x) == 0 && dcmp(y - a.y) == 0 && dcmp(z - a.z) == 0;} | ||
}; | ||
ld norm2(const Pt &a,const Pt &b) {return (a-b)*(a-b);} |