#include <iostream>
using namespace std;
struct vector
{
float x;
float y;
float z;
};
vector c;
float Get_Length(vector &a)
{
return a.x*a.x+a.y*a.y+a.z*a.z;
}
float Distance(vector &a,vector &b)
{
vector c;
c.x = a.x -b.x;
c.y = a.y -b.y;
c.z = a.z -b.z;
float distance=sqrt(Get_Length(c));
return distance;
}
float Dot_Porduct(vector &a,vector &b)
{
return a.x*b.x+a.y*b.y+a.z*b.z;
}
vector Cross_Product(vector &a,vector &b)
{
vector c;
c.x=a.y*b.z-a.z-b.y;
c.y=a.z*b.x-a.x*b.z;
c.z=a.x*b.y-a.y*b.x;
return c;
}
vector Normal(vector &a)
{
float length=sqrt(Get_Length(a));
vector normal;
normal.x=a.x/length;
normal.y=a.y/length;
normal.z=a.z/length;
return normal;
}
void main()
{
vector a;
vector b;
vector normal;
cout<<"Enter 3 numbers :"<<endl;
cin>&g
三维向量的标准化,两点距离,点乘,叉乘
最新推荐文章于 2023-08-19 23:02:58 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)