Mathematics and Physics for Computer Graphics(Geomery 学习笔记)

Point:点是三维空间中的一个位置。
Vector:矢量通常表示三维空间中的一个方向(以及相应的大小)。
向量归一化:向量归一化的过程包括改变向量,使其长度变为1,但方向不变。
法线:用于描述几何对象在该表面上一点的表面方向。从技术上讲,在点P上垂直于表面的法线,可以看作是垂直于点P上与表面相切的平面的向量。
线性变换:如果在变换时保留了直线,那么我们说线性变换(与矩阵相乘是线性变换)。
在这里插入图片描述
Transformation(转换):
The translation operator is nothing more than a linear transformation of the original point (which can be viewed as an input position point). Applied to a vector (which, remember, is a direction), translation has no meaning. This is because where the vector begins (that is, where it is centered) is not important; regardless of position, all “arrows” of the same length, pointing in the same direction, are equivalent. Instead, we very commonly use another linear transformation on vectors: rotation.
在这里插入图片描述
The subscripted letter T stands fortransformed”.

在我们的c++代码中,我们不会区分点、向量和法线;我们用一个Vec3类来表示这三个类(一个类模板,这样我们可以根据需要创建浮点型、整型或双型版本)。一些开发人员喜欢将它们区分开来。这显然限制了犯错的可能性。我们仍然需要小心地调用一些特定的函数,这取决于我们处理的Vec3是表示点、向量还是法向量

template<typename T> 
class Vec3 
{ 
public: 
    // 3 most basic ways of initializing a vector
    Vec3() : x(T(0)), y(T(0)), z(T(0)) {} 
    Vec3(const T &xx) : x(xx), y(xx), z(xx) {} 
    Vec3(T xx, T yy, T zz) : x(xx), y(yy), z(zz) {} 
    T x, y, z; 
}; 
 
typedef Vec3<float> Vec3f; 
 
Vec3<float> a; 
Vec3f b; 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值