ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libgender/util.h
(Generate patch)

Comparing libgender/util.h (file contents):
Revision 1.45 by root, Mon Oct 18 12:01:14 2004 UTC vs.
Revision 1.46 by root, Mon Oct 18 12:06:10 2004 UTC

162} 162}
163 163
164struct cone { 164struct cone {
165 point p; 165 point p;
166 vec3 a; // axis 166 vec3 a; // axis
167 GLfloat f, fs, fc; // angle 167 GLfloat f, fs1, fc; // angle
168 168
169 cone () { }; 169 cone () { };
170 cone (const point &p, const vec3 &a, GLfloat f) 170 cone (const point &p, const vec3 &a, GLfloat f)
171 : p(p), a(a), f(f) 171 : p(p), a(a), f(f)
172 { 172 {
173 fs = sinf (f); 173 fs1 = 1.F / sinf (f);
174 fc = cosf (f); 174 fc = cosf (f);
175 }; 175 };
176}; 176};
177 177
178inline bool overlap (const cone &c, const sphere &s) 178inline bool overlap (const cone &c, const sphere &s)
179{ 179{
180 vec3 u = c.p - c.a * (s.r / c.fs); 180 vec3 d = s.p - c.p + c.a * (s.r * c.fs1);
181 vec3 d = s.p - u;
182 return dot (c.a, d) >= length (d) * c.fc; 181 return dot (c.a, d) >= length (d) * c.fc;
183} 182}
184 183
185void renormalize (sector &s, point &p); 184void renormalize (sector &s, point &p);
186 185

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines