当前位置:网站首页>技术美术百人计划学习笔记(2)--向量
技术美术百人计划学习笔记(2)--向量
2022-07-25 22:47:00 【昵称好难写】
1、向量的定义
向量是有方向又有大小的有向线段,向量没有位置,只有大小和方向。
2、向量的相关计算
2.1、标量与向量的计算
可乘除,不可加减
2.2、向量的模长
|V|=根号(x²+y²)
2.3、标准化向量
大小为1的向量
normalV=v/v的模长
2.4、向量与向量的加减计算
计算公式(ax+ay)+(bx+by)=(ax+bx,ay+by)
2.5、计算两点间的距离
a到b点的距离=根号((bx-ax)²+(by-ay)²)
应用于计算一个向量到另外一个向量的距离,a到b的距离=b-a
向量的加减原则,参考链接:https://blog.csdn.net/deepdsp/article/details/19631195
2.6、向量的点积
结果为一个标量
a·b=|a||b|cosθ
计算公式(ax,ay).(bx,by)=(ax.bx+ay.by)
几何意义:点乘的结果描述了两个向量的相似程度,点乘结果越大夹角角度越小,两个向量越接近。
| a.b | θ | a和b |
|---|---|---|
| >0 | 0<=θ<90 | 方向基本相同 |
| =0 | θ=90 | 方向垂直 |
| <0 | 90<θ<=180 | 方向基本相反 |
应用示列:兰伯特关照模型是最简单通用的模拟漫反射的光照模型
我看到一个博主关于兰伯特光照模型的原理写的非常清晰,浅存一下
https://gameinstitute.qq.com/community/detail/125867
自己参考网上的例子做了一个基本版的兰伯特光照模型,参考链接:
https://blog.unity.com/technology/custom-lighting-in-shader-graph-expanding-your-graphs-in-2019
https://docs.unrealengine.com/4.26/zh-CN/RenderingAndGraphics/Materials/ExpressionReference/Math/
2.7、向量的叉乘
几何解释:叉乘得到的向量垂直于原来的两个向量
向量叉乘的大小和方向
关于向量的方向和大小,这个博主写的非常详细和易懂,浅存一下
https://www.laowangomg.com/?p=673
最后附上一个自己写的小应用
public Transform a;
public Transform b;
void Update()
{
if(Input.GetKeyDown(KeyCode.Space))
{
Vector3 posA = a.position;
Vector3 posB = b.position;
float f=Vector3.Dot(a.transform.forward, posB - posA);//点乘判定是在前方还是后方
Vector3 b3 = Vector3.Cross(a.transform.forward, posB - posA);//叉乘判定是在左边还是右边
float f2 = Vector3.Angle(a.transform.forward, posB - posA);//得到两者间的角度
if (f > 0 && b3.y > 0)
{
Debug.Log("B球在A球右前方" + f2 + "度");
}
if (f > 0 && b3.y < 0)
{
Debug.Log("B球在A球左前侧");
}
if (f < 0 && b3.y > 0)
{
Debug.Log("B球在A球右后方");
}
if (f < 0 && b3.y < 0)
{
Debug.Log("B球在A球左后方");
}
}
}
最后鼓励一下自己
无人问津也好,技不如人也罢
你都要试着安静下来,去做自己该做的事
而不是让内心烦躁,焦虑
毁掉你本来就不多的热情和定力
昨日之深渊,今日之浅谈
路虽远,行则将至
事虽难,做则可成
边栏推荐
- 【集训DAY15】油漆道路【最小生成树】
- Two methods of printing strings in reverse order in C language
- Vs2017 compilation encountered the error HResult e returned by the call of COM component_ FAIL
- [PMP learning notes] Chapter 1 Introduction to PMP System
- We media people must have four resource tools, each of which is very practical
- 面试题 17.11. 单词距离 ●●
- Tfrecord write and read
- QVariant的使用
- Node.js operation database
- Box model (2)
猜你喜欢

面试题 17.11. 单词距离 ●●

(1) DDL, DML, DQL, DCL and common data types
![[PMP learning notes] Chapter 1 Introduction to PMP System](/img/80/144124af40f0a015c4deafc3aa7432.png)
[PMP learning notes] Chapter 1 Introduction to PMP System

(1) Integrating two mapping frameworks of Dao

Kibana~后台启动Kibana之后无法找到进程号

invalid syntax

Network security and level protection

关于getchar和scanf的使用示例及注意点

Vodak software: Smart City solution

Tree view model example of QT
随机推荐
Why is Google's internal tools not suitable for you?
[training Day11] Nescafe [greed]
Node.js operation database
Scratch seamless butt bron filter
JD quick navigation box
Mysql数据类型
QVariant的使用
QT Chinese programming encounters c2001 error, prompting "there is a newline character in the constant"
BIO、NIO、AIO的区别?
Severely crack down on illegal we media operators according to law: it is urgent to purify the we media industry
The fourth experiment nat
access-list vs ip access-list
Builder pattern
依法严厉打击违规自媒体运营者:净化自媒体行业迫在眉睫
Vs2017 compilation encountered the error HResult e returned by the call of COM component_ FAIL
[文献阅读] - HRL -[HRL with Universal Policies for Multi-Step Robotic Manipulation]
Platform architecture construction
XSS tool beef XSS installation and use
Domain oriented model programming
Qtreewidget control of QT