当前位置:网站首页>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是旋转的弧度
);
边栏推荐
- 反射
- Idea makes jar packages and introduces jar packages
- MySQL save data prompt: out of range value for column error
- STM32F103C8T6在Arduino框架下驱动ssd1306 0.96“ IIC OLED显示
- Nefu117 number of prime numbers [prime number theorem]
- 关于 CMS 垃圾回收器,你真的懂了吗?
- Jmeter录制接口自动化
- NEFU119 组合素数【算术基本定理】
- Unity最简洁的对象池实现
- DXGI acquisition process
猜你喜欢

USB2.0接口的EMC设计方案

视觉系统设计实例(halcon-winform)-9.文字显示

RS485接口的EMC设计方案

Do you really understand CMS garbage collector?

Finally, someone finished all the dynamic planning, linked list, binary tree and string required for the interview

Why is there no unified quotation for third-party testing fees of software products?

How to do well in enterprise system vulnerability assessment

一文搞懂 Redis 架构演化之路
![[work] about technical architecture](/img/24/f3402c04157ce9a8846580f017f472.png)
[work] about technical architecture

idea打jar包与引入jar包
随机推荐
Nokia's patent business was hit for the first time, and Chinese enterprises are not so easy to knead
网络设备硬核技术内幕 路由器篇 20 DPDK (五)
图解 SQL,这也太形象了吧
cap理论和base理论
[Yunxiang book club issue 13] multimedia processing tool ffmpeg tool set
【ManageEngine】什么是SIEM
网络设备硬核技术内幕 路由器篇 21 可重构的路由器
An example of building 3D effects on the web based on three.js
SkyWalking分布式系统应用程序性能监控工具-中
多表查询_子查询概述和多表查询_子查询情况1&情况2&情况3
网络设备硬核技术内幕 路由器篇 9 CISCO ASR9900拆解 (二)
What is the breakthrough point of digital transformation in the electronic manufacturing industry? Lean manufacturing is the key
网络设备硬核技术内幕 路由器篇 13 从鹿由器到路由器(上)
internship:其他配置类的编写
If we were the developer responsible for repairing the collapse of station B that night
一些二进制位操作
两阶段提交与三阶段提交
DIY制作示波器的超详细教程:(一)我不是为了做一个示波器
Visual system design example (Halcon WinForm) -10. PLC communication
多表查询_练习1&练习2&练习3