当前位置:网站首页>D39_Vector
D39_Vector
2022-08-05 06:32:00 【Not so simple GG】
目录
1.Simple operations on vectors
6.Addition and subtraction of vectors
1.Simple operations on vectors
1.向量简介
向量:具有大小和方向的量 标量(矢量):只有大小没有方向的量
transform.position代表坐标 transform.forward代表向量
2.vector between two points
从起点A指向终点B的向量----用BThe coordinates of the point are subtractedA点的坐标
3.零向量
The zero vector is the only one of size 0的向量 Vector3.zero
4.负向量
If two vectors are equal in magnitude and opposite in direction, they are negative vectors of each other (x,y,z)的负向量为(-x,-y,-z)
-transform.forwardMeaning is directly behind the object -Vector3.forwardIt means right behind the world
5.向量的大小
|A|=(x²+y²+z²)½ 向量的模长 几何意义:The distance between two endpoints
定义A为向量 Unity中使用 A.magnitude Find the modulo length of a vector 平方模 A.sqrMagnitude
Using the square mode is more efficient than the mode length,Because it is easier for a computer to calculate a square than to take a square root
6.Addition and subtraction of vectors
A(x1,y1,z1)向量加B(x2,y2,z2)向量 |A|+|B|=(x1+x2,y1+y2,z1+z2)
A(x1,y1,z1)向量减B(x2,y2,z2)向量 |A|-|B|=(x1-x2,y1-y2,z1-z2)
7.Vector3 +- Vector3的几何意义
Vector3意义为 坐标 或者 向量
坐标+坐标 : 无意义
坐标+向量 : 得到新的位置----将一个点,in the direction of the vector,Modulo length of the motion vector,得到新的坐标点
向量+向量 : 得到一个新的向量----将BThe start point of the vector is translated toAThe end point of the vector,就会得到 从AThe starting point of the vector points toBThe end point of the vector of this new vector
坐标-坐标 : A-B 得到一个向量----得到一个从B指向A的向量
向量-向量 : 得到一个新的向量----Connect the origins of two vectors by translation,Connect the endpoints of two vectors,The direction points to the subtracted vector A-B相当于A+(-B)
位置-向量 : 得到新的位置----位置+(-向量) Place a point against the direction of the vector,The modulo length in the direction of movement,Get the coordinates of the new point
向量-位置 : 无意义
8.向量*标量
A(x,y,z)*M 得到 B(x*M,y*M,z*M)
得到一个新的向量 : Increase the modulo length of the vector by a multiple of the scalar,Scalar is a positive number,方向不变,Scalar is negative,方向相反
2.向量的乘法
1.向量的点乘
A(x1,y1,z1) B(x2,y2,z2) AB=x1*x2+y1*y2+z1*z2 What is obtained is a new value
几何意义:AB=|A|*|B|*cosθ
θ是A BThe vector is less than180°的夹角
cosθ=AB/|A|*|B|
θ=ArcCos(AB/|A|*|B|)
If the two vectors are unit vectors--------AB=cosθ -------- θ=ArcCos(AB)
By vector dot product,The angle between the two vectors can be obtained
It only makes sense to dot-multiply a vector,Position dot-multiply vector,Position multiplication by position is meaningless
2.向量的叉乘
A(x1,y1,z1) B(x2,y2,z2) A×B=(y1z2-z1y2,z1x2-x1z2,x1y2-y1x2)
几何意义:A叉乘BThe resulting new vector is also perpendicular to A B向量
A叉乘BThe resulting new vector is perpendicular to A Bformed plane
A叉乘B得到的就是A B face normal
Use the left-hand rule to determine direction,Four-finger wrapping direction from left multiplier to right multiplier,The thumb points in the direction of the cross
3.API
开根号:Mathf.Sqrt();
指数:Mathf.Pow();
向量的模: 向量.magnitude;
The square modulo of the vector:向量.sqrMagnitude;
反三角:Mathf.Acos(); Mathf.Asin();
绝对值:Mathf.Abs();
向量的归一化:向量.normalized;
向量点乘:Vector3.Dot();
算夹角:Vector3.Angle();
向量叉乘:Vector3.Cross();
弧度转角度:弧度* Mathf.Rad2Deg
角度转弧度:角度* Mathf.Deg2Red
边栏推荐
猜你喜欢
One-arm routing experiment and three-layer switch experiment
云计算基础-学习笔记
解决这三大问题,运维效率将超90%的医院
[问题已处理]-jenkins流水线checkout超时
ALC experiment
In-depth Zabbix user guide - from the green boy
The highlight moment of operation and maintenance starts with intelligence
sql server 重复值在后面计数
DisabledDate date picker datePicker
Hugo搭建个人博客
随机推荐
wc、grep、tar、vi/vim
el-progress implements different colors of the progress bar
Quick question and quick answer - FAQ of Tencent Cloud Server
link 和@improt的区别
跨域的十种解决方案详解(总结)
VRRP overview and experiment
Problems encountered in installing Yolo3 target detection module in Autoware
Proprietary host CDH
解决这三大问题,运维效率将超90%的医院
Introduction to Network Layer Protocols
Does flink cdc currently support Gauss database sources?
flink cdc 目前支持Gauss数据库源吗
Wechat applet page jump to pass parameters
Browser Storage WebStorage
[ingress]-ingress使用tcp端口暴露服务
LeetCode中常用语言的一些基本方法记录
In-depth Zabbix user guide - from the green boy
I/O performance and reliability
Hugo搭建个人博客
[问题已处理]-jenkins流水线checkout超时