当前位置:网站首页>3D相关的简单数学知识
3D相关的简单数学知识
2022-07-27 14:15:00 【傻子是小傲娇】
三维坐标系:
向量的模:向量起点到终点的距离
FLOAT D3DXVec3Length( // Returns the magnitude.
CONST D3DXVECTOR3* pV // The vector to compute the length of.
);
向量标准化(规范化)将向量的长度缩放至1
D3DXVECTOR3 *D3DXVec3Normalize(
D3DXVECTOR3* pOut, // Result.
CONST D3DXVECTOR3* pV // The vector to normalize.
);
向量加减:
D3DXVECTOR3 u(2.0f, 0.0f, 1.0f);
D3DXVECTOR3 v(0.0f, -1.0f, 5.0f);
D3DXVECTOR3 sum = u + (-) v; // = (2.0f, -1.0f, 6.0f)
D3标量与向量的乘积:
D3DXVECTOR3 u(1.0f, 1.0f, -1.0f);
D3DXVECTOR3 scaledVec = u * 10.0f;
点积(结果为标量):
u · v =|u||v|cosθ
通过u*v的结果判断两向量的夹角,0垂直,<0大于90度,>0小于90度
float dot = D3DXVec3Dot( &u, &v );
叉积(结果是另一个向量):
长度为两向量的模乘以夹角的正弦值,在什么坐标系就用什么坐标系的定则去判断叉积的方向。
方向:按照第一个向量指向第二个向量
D3DXVec3Cross
矩阵乘法:
逆矩阵:
方阵才有逆矩阵,且不一定有
p’= pR 并且假设我们知道p’和R可以求p
D3DMatrixIverse
转置:
D3DMatrixTranspose
几何变换:
齐次坐标(用n+1维坐标去表示n维坐标):
3*3的变换矩阵具有一定的局限性,无法完成平移透视投影等基本的集合变换,因此需要将三维的点和向量的坐标扩展为4维的齐次坐标
点的齐次坐标:(x,y,z,1)
向量的齐次坐标:(x,y,z,0)w值为0可以保证向量不受平移变换的影响,这样对于同一个图形中的点和向量,无需对其进行区分,只需使用一个变换矩阵对其进行几何变换
平移变换矩阵:
D3DXMATRIX *D3DXMatrixTranslation(
D3DXMATRIX* pOut, // 返回平移后的矩阵.
FLOAT x, // x轴移动的单位
FLOAT y, // y轴移动的单位
FLOAT z // z轴移动的单位
);
缩放:
D3DXMATRIX *D3DXMatrixScaling(
D3DXMATRIX* pOut, // 返回缩放后的矩阵
FLOAT sx, // x轴缩放的比例
FLOAT sy, // y轴缩放的比例
FLOAT sz // z轴缩放的比例.
);
旋转:
D3DXMATRIX *D3DXMatrixRotationX(
D3DXMATRIX* pOut, // 返回旋转后的矩阵
FLOAT Angle // Angle是旋转的弧度
);
边栏推荐
- The database uses PSQL and JDBC to connect remotely and disconnect automatically from time to time
- Is it safe for Guosen Securities to open a mobile account? Is Zhongshan securities reliable
- web上构建3d效果 基于three.js的实例
- 修改frameworks资源文件如何单编
- DXGI acquisition process
- STM32 can -- can ID filter analysis
- MOS管防止电源反接的原理
- 网络设备硬核技术内幕 路由器篇 11 CISCO ASR9900拆解 (五)
- 网络设备硬核技术内幕 路由器篇 15 从鹿由器到路由器 (下)
- adb命令 (安装apk包格式:adb install 电脑上apk地址包名)
猜你喜欢

What is the breakthrough point of digital transformation in the electronic manufacturing industry? Lean manufacturing is the key

Understand the evolution of redis architecture in one article

Visual system design example (Halcon WinForm) -9. text display

RS485接口的EMC设计方案

The interviewer asked: how to judge whether an element is in the visible area?

Zhou Hongyi: if the digital security ability is backward, it will also be beaten

adb命令 (安装apk包格式:adb install 电脑上apk地址包名)

Unity性能优化------渲染优化(GPU)之Occlusion culling(遮挡剔除)

Graphical SQL is too vivid

Getting started with DirectX
随机推荐
Kubernetes CNI classification / operation mechanism
How to help enterprises optimize office management
adb命令 (安装apk包格式:adb install 电脑上apk地址包名)
The interviewer asked: how to judge whether an element is in the visible area?
数据仓库项目从来不是技术项目
USB接口电磁兼容(EMC)解决方案
网络设备硬核技术内幕 路由器篇 (10) CISCO ASR9900拆解 (四)
Unity性能优化------DrawCall
OBS advanced DXGI acquisition screen process, and how to modify it to its own cursor
[Yunxiang book club issue 13] multimedia processing tool ffmpeg tool set
Timestamp of AAC, h264, etc
魔塔项目中的问题解决
IJCAI 2022杰出论文公布,大陆作者中稿298篇拿下两项第一
如果我们是那晚负责修复 B 站崩了的开发人员
STM32 can -- can ID filter analysis
【ManageEngine】什么是SIEM
网络设备硬核技术内幕 路由器篇 14 从鹿由器到路由器 (中)
同花顺开户在手机开户安全吗?
网络设备硬核技术内幕 路由器篇 11 CISCO ASR9900拆解 (五)
What is the breakthrough point of digital transformation in the electronic manufacturing industry? Lean manufacturing is the key