Qt Model/View architecture:
Model: QModelIndex, internalPainter is used to associate the custom item pointer to the QModelIndex, the custom item class is defined by us and is used to store the custom data.
View: there are mouse press/release/doubleclick/move event, the row and tree branches(grew lines) can be redraw by overriding drawRow/drawBranches function.
Others:
1. 之前假如不是跟geometry/mesh相关的工作,我都有一点点抵触, 觉得不对口。现在发觉不能这样子,想做跟geometry/mesh相关的工作内容是因为想在那方面做深入, 但是有时候做做别的东西也能扩展知识面, 而且东西都不是独立而是相联系的。例如现在在看Qt的model/view architecture, 从pattern从编程方面都是会有益的。例如做paint layer blend mode, paint layer transfer, layer mask就能扩展texture/material这方向的认识。
2. 写代码,接触一个feature甚至是fix 一个bug时候,一定要进行做的完善完美鲁棒, 否则之后的bugs会不断过来,弄得无法开始or专心于下一步的工作。
3. 要到LayerModel/LayerView(custom 的Model/View)中加入新的model item, 而且这些item还是新的类型, 于是觉得:冷静->逻辑清晰->快速的理解能力很重要.
4. 想起了去年面试被问过的一个question: 给出三角形的三个边长, 怎么求出三角形的面积?
假如在初高中时候要是这个问题都不懂的话肯定考不上大学,如今却真的模糊了。后来复习时候发现那个公式原来有个不错的名字Heron’s (or Hero’s) formula. A=sqrt(s*(s-a)*(s-b)*(s-c)), where s = (a+b+c)*0.5, http://en.wikipedia.org/wiki/Heron's_formula, 链接中还给出了利用余弦定理law of cosines的证明(这个更重要). 这些其实都是应该牢记的。最后提到了这个公式的数学稳定性不好numerically unstable, http://en.wikipedia.org/wiki/Numerical_stability, 里面对一个array 求sum的例子不错, 求一百个数, 假如一个是1,另外99个都是0.01,精确解释1.99,但是看上去正确的算法得到的结果不同,有些甚至是错误的(错误的是先加1再加0.01, 较好的做法是先排序, 从小到大来加. 排序?复习)。这可能是2进制计算机中由于round-off error and truncation error而引入的 (ok, 又涉及到了floating point numer了, 怎么表示,跟0的比较,之前看过一个用它生成random number的)。
然后又从truncation提到了Taylor series (这个我在研二暑假找实习时候被问及), 除了能写出这个公式之外,还得想想它有什么实际用处. (1). F(x) = F(a) + F’(a)x +…当 a=0时候就变为Maclaurin series, 然后就可以求例如the exponential function e^x的近似值了, sin(x)的近似值等。
5. 有这么一个Camera model, 有意思的是我想在初始化时候都是给出position, target等参数parameters, 但是这个camera model中确实根据给出的scene center and scene radius来计算那些参数.
for example, max-heap is a complete binary tree, which used to build the priority-queue;
the RB-tree is binary search tree, which is used to build the set and map container.
there are many other examples of course. scene tree...
没有评论:
发表评论