Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // stuff.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <Windows.h>
- #include <iostream>
- #include <string>
- #include <cmath>
- struct vector3d
- {
- float x;
- float y;
- float z;
- };
- float distance(vector3d vec1, vector3d vec2)
- {
- float retval;
- float x = vec1.x - vec2.x;
- float y = vec1.y - vec2.y;
- float z = vec1.z - vec2.z;
- x = pow(x, 2);
- y = pow(y, 2);
- z = pow(z, 2);
- retval = sqrt(x + y + z);
- return retval;
- }
- bool trace(vector3d origin, vector3d target, vector3d angle)
- {
- float x = origin.x - target.x;
- float y = origin.y - target.y;
- float anglex = atan2(x,y);
- return false;
- }
- int main()
- {
- vector3d vec1;
- vector3d vec2;
- vec1.x = 5;
- vec1.y = 2;
- vec1.z = 20;
- vec2.x = 10;
- vec2.y = 3;
- vec2.z = -13;
- std::cout << distance(vec1, vec2) << std::endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement