]>
Dogcows Code - chaz/yoink/blob - src/moof/ray.hh
2 /*] Copyright (c) 2009-2010, Charles McGarvey [**************************
3 **] All rights reserved.
7 * Distributable under the terms and conditions of the 2-clause BSD license;
8 * see the file COPYING for a complete text of the license.
10 **************************************************************************/
17 * A class for lines that start at one point and go to infinity in some
21 #include <moof/drawable.hh>
22 #include <moof/math.hh>
23 #include <moof/opengl.hh>
24 #include <moof/texture.hh>
31 * A line that goes to infinity.
34 struct ray
: public drawable
36 typedef moof::vector
< scalar
, fixed
<D
> > vector
;
38 // solution = point + t*direction
44 scalar distance
; // distance from the origin to the nearest point
45 vector normal
; // surface normal at contact point
47 bool operator < (const contact
& rhs
)
49 return distance
< rhs
.distance
;
53 void solve(vector
& p
, scalar t
) const
55 p
= point
+ t
*direction
;
58 void draw(scalar alpha
= 0.0) const
60 vector end
= point
+ 1000.0 * direction
;
61 // FIXME: this is kinda cheesy
63 moof::texture::reset_binding();
72 direction
.normalize();
83 #endif // _MOOF_RAY_HH_
This page took 0.037774 seconds and 4 git commands to generate.