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

Comparing libgender/util.h (file contents):
Revision 1.46 by root, Mon Oct 18 12:06:10 2004 UTC vs.
Revision 1.47 by root, Mon Oct 18 12:24:29 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, fs1, fc; // angle 167 GLfloat f, fs1, fc2; // 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 fs1 = 1.F / sinf (f); 173 fs1 = 1.F / sinf (f);
174 fc = cosf (f); 174 fc2 = cosf (f); fc2 *= fc2;
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 d = s.p - c.p + c.a * (s.r * c.fs1); 180 vec3 d = s.p - c.p + c.a * (s.r * c.fs1);
181 return dot (c.a, d) >= length (d) * c.fc; 181 GLfloat dd = dot (c.a, d);
182 return dd > 0.F && dd * dd >= length2 (d) * c.fc2;
182} 183}
183 184
184void renormalize (sector &s, point &p); 185void renormalize (sector &s, point &p);
185 186
186struct colour 187struct colour

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines