⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 finite.cxx

📁 [Game.Programming].Academic - Graphics Gems (6 books source code)
💻 CXX
字号:
#include <iostream.h>#include <math.h>#include "global.h"ostream& operator<<(ostream& o, sphere& s) {s.out(o); return o;}list<intersect*> *sphere::shape(ray& r) {        list<intersect*> *l=new list<intersect*>;        double b=r.d%(r.o-this->c);        double C=(r.o-this->c)%(r.o-this->c)-this->r*this->r;        double d=b*b-C;        if(d<0.) return l;        d=sqrt(d); double t1=(-b-d); double t2=(-b+d);        if(t1>EPS) {                intersect* i=new intersect; i->t=t1; i->p=r.o+r.d*t1;                i->n=norm(i->p-this->c); i->o=this;                 *l+=i;        }        if(t2>EPS) {                intersect* i=new intersect; i->t=t2; i->p=r.o+r.d*t2;                i->n=norm(i->p-this->c); i->o=this;                 *l+=i;        }        return l;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -