当前位置:网站首页>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
边栏推荐
猜你喜欢

Unity realizes first-person roaming (nanny-level tutorial)

One-arm routing experiment and three-layer switch experiment

运维工程师,快来薅羊毛

DevOps-了解学习

监控系统的内卷,有什么讲究?

Problems encountered in installing Yolo3 target detection module in Autoware

spark operator - map vs mapPartitions operator

transport layer protocol

正则表达式小实例--验证邮箱地址

selenium learning
随机推荐
[问题已处理]-jenkins流水线checkout超时
Autoware--Beike Tianhui rfans lidar uses the camera & lidar joint calibration file to verify the fusion effect of point cloud images
sql server 重复值在后面计数
King power volume LinkSLA, realize operations engineer is happy fishing
LeetCode中常用语言的一些基本方法记录
干货!教您使用工业树莓派结合CODESYS配置EtherCAT主站
Mina断线重连
实力卷王LinkSLA,实现运维工程师快乐摸鱼
LinkSLA坚持用户第一,打造可持续的运维服务方案
Disk management and file systems
Switch principle
The Servlet to jump to the JSP page, forwarding and redirection
618, you may be able to wake up a little bit
跨域的十种解决方案详解(总结)
CIPU, what impact does it have on the cloud computing industry?
5分钟完成mysql离线安装
Difference between link and @improt
js dynamically get screen width and height
BIO,NIO,AIO实践学习笔记(便于理解理论)
运维的高光时刻,从智能化开始