摘要: 题目描述:Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive in... 阅读全文
posted @ 2015-06-23 09:32 Sawyer Ford 阅读(232) 评论(0) 推荐(0) 编辑
摘要: 题目描述:Divide two integers without using multiplication, division and mod operator.If it is overflow, return INT_MAX. 提示中谈到Binary Search,由此可想到解决方案。solu... 阅读全文
posted @ 2015-06-16 21:19 Sawyer Ford 阅读(164) 评论(0) 推荐(0) 编辑
摘要: 更新回调(Update Callback)涉及到一个类:osg::NodeCallback。这个类重载了函数调用操作符。当回调动作发生时,将会执行这一操作符的内容。 如果节点绑定了更新回调函数,那么在每一帧系统遍历到此节点时,回调函数都会被调用。 下面给出一个例子:#include #inc... 阅读全文
posted @ 2015-06-09 11:06 Sawyer Ford 阅读(599) 评论(0) 推荐(0) 编辑
摘要: 本文所有内容来自《OpenSceneGraph三维渲染引擎设计与实践》一书。 本文主要讨论的是OSG中节点的访问。 对于节点的访问是从节点接收一个访问器开始的,用户执行某个节点的accept()函数,将一个具体的访问器对象传递给节点。 第二步,节点反过来执行访问器的apply()函数,并将... 阅读全文
posted @ 2015-06-09 10:13 Sawyer Ford 阅读(2800) 评论(1) 推荐(0) 编辑
摘要: 《Effective C++》在资源管理一节提到了智能指针,智能指针中最著名的当属auto_ptr和shared_ptr。本文主要研究两者的实现。auto_ptr的实现:template class auto_ptr{private: T *ptr;public: explicit ... 阅读全文
posted @ 2015-06-03 16:37 Sawyer Ford 阅读(348) 评论(0) 推荐(0) 编辑
摘要: 罗列一些QT学习资料1. http://www.qter.org/ 包含很多教程,包括著名的《学习之路》系列。2.http://www.qtcn.org/bbs/index-htm-m-bbs.html 非常好的qt论坛,里面的人很热心。3.http://www.devbean.net/ca... 阅读全文
posted @ 2015-06-02 16:19 Sawyer Ford 阅读(210) 评论(0) 推荐(0) 编辑
摘要: 类中3个重要的成员函数,标准形式如下:class A{public: A(); A(const A&); A& operator=(const A&); ~A();}; 以后会补充 阅读全文
posted @ 2015-06-01 09:51 Sawyer Ford 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 以下是一个简单的模型读取程序:#include #include #include void main(){ osgViewer::Viewer viewer; osg::Group *root = new osg::Group(); root->addChild(osgDB:... 阅读全文
posted @ 2015-05-25 17:35 Sawyer Ford 阅读(963) 评论(0) 推荐(0) 编辑
摘要: 代码如下: //需要添加两个库:osgUtild.lib、osgTextd.lib#include #include #include #include #include #include #include #include #include #include #include #include ... 阅读全文
posted @ 2015-05-25 16:33 Sawyer Ford 阅读(823) 评论(0) 推荐(0) 编辑
摘要: 直接上代码:#include #include #include #include #include #include #include #include #include #include void main(){ osgViewer::Viewer viewer; viewer.... 阅读全文
posted @ 2015-05-25 11:01 Sawyer Ford 阅读(850) 评论(0) 推荐(0) 编辑