]>
Dogcows Code - chaz/yoink/blob - src/moof/ray.hh
2 /*] Copyright (c) 2009-2011, Charles McGarvey [*****************************
3 **] All rights reserved.
5 * Distributable under the terms and conditions of the 2-clause BSD license;
6 * see the file COPYING for a complete text of the license.
8 *****************************************************************************/
13 #include <moof/drawable.hh>
14 #include <moof/image.hh>
15 #include <moof/math.hh>
16 #include <moof/opengl.hh>
21 * A class for lines that start at one point and go to infinity in some
29 * A line that goes to infinity.
32 struct ray
: public drawable
34 typedef moof::vector
< scalar
, fixed
<D
> > vector
;
36 // solution = point + t*direction
42 scalar distance
; // distance from the origin to the nearest point
43 vector normal
; // surface normal at contact point
45 bool operator < (const contact
& rhs
)
47 return distance
< rhs
.distance
;
51 void solve(vector
& p
, scalar t
) const
53 p
= point
+ t
*direction
;
56 void draw(scalar alpha
= 0.0) const
58 vector end
= point
+ 1000.0 * direction
;
59 // FIXME: this is kinda cheesy
61 image::reset_binding();
70 direction
.normalize();
80 #endif // _MOOF_RAY_HH_
This page took 0.038099 seconds and 5 git commands to generate.