当前位置:网站首页>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
边栏推荐
- Teach you simple steps to achieve industrial raspberries pie properly installed RS232 USB drive
- disabledDate 日期选择器 datePicker
- 云计算基础-学习笔记
- From "dual card dual standby" to "dual communication", vivo took the lead in promoting the implementation of the DSDA architecture
- Collection of error records (write down when you encounter them)
- spark operator-textFile operator
- LinkSLA坚持用户第一,打造可持续的运维服务方案
- LeetCode Interview Questions
- LeetCode中常用语言的一些基本方法记录
- selenium模块的操作之拉钩
猜你喜欢
随机推荐
Vim tutorial: vimtutor
markdown editor template
Mina disconnects and reconnects
系统基础-学习笔记(一些命令记录)
selenium learning
transport layer protocol
多线程之传递参数
网络不通?服务丢包?看这篇就够了
CIPU, what impact does it have on the cloud computing industry?
input detailed file upload
User and user group management, file permission management
Next-Generation Parsing Technology - Cloud Parsing
大小屏适配
link 和@improt的区别
LinkSLA坚持用户第一,打造可持续的运维服务方案
VRRP overview and experiment
ALC实验
spark operator-textFile operator
Quick question and quick answer - FAQ of Tencent Cloud Server
vim教程:vimtutor









