Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- struct Vec3 {
- float x,y,z;
- Vec3(float x,float y,float z):x(x),y(y),z(z) {}
- friend ostream& operator<<(ostream&o,const Vec3& x) {
- o<<"("<<x.x<<", "<<x.y<<", "<<x.z<<")";
- return o;
- }
- };
- float Dot(Vec3 v1, Vec3 v2) {
- return v1.x*v2.x + v1.y*v2.y + v1.z*v2.z;
- }
- Vec3 Cross(Vec3 v1, Vec3 v2) {
- return Vec3(v1.y*v2.z-v2.y*v1.z, v1.z*v2.x-v1.x*v2.z,v1.x*v2.y-v1.y*v2.x);
- }
- int main() {
- std::cout << Dot(Vec3(1,0,0),Vec3(0,1,0)) << std::endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement