diff --git a/src/ray.rs b/src/ray.rs index 6490e20..be43aaa 100644 --- a/src/ray.rs +++ b/src/ray.rs @@ -13,6 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +use std::marker::PhantomData; use num::BaseNum; use point::{Point, Point2, Point3}; use vector::{Vector, Vector2, Vector3}; @@ -20,17 +21,21 @@ use vector::{Vector, Vector2, Vector3}; /// A generic ray starting at `origin` and extending infinitely in /// `direction`. #[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable)] -pub struct Ray
{
+pub struct Ray {
- pub fn new(origin: P, direction: V) -> Ray {
- Ray { origin: origin, direction: direction }
+impl ) -> Ray {
+ fn rotate_ray(&self, ray: &Ray ) -> Ray {
+ fn transform_ray(&self, ray: &Ray {
pub origin: P,
pub direction: V,
+ phantom_s: PhantomData
}
-#[old_impl_check]
-impl> Ray> Ray {
+ pub fn new(origin: P, direction: V) -> Ray {
+ Ray {
+ origin: origin,
+ direction: direction,
+ phantom_s: PhantomData
+ }
}
}
-pub type Ray2 = Ray>;
-pub type Ray3 = Ray>;
+pub type Ray2 = Ray, Vector2>;
+pub type Ray3 = Ray, Vector3>;
diff --git a/src/rotation.rs b/src/rotation.rs
index 8e92d31..d2335dc 100644
--- a/src/rotation.rs
+++ b/src/rotation.rs
@@ -49,7 +49,7 @@ pub trait Rotation>: PartialEq + Approx
/// Rotate a ray using this rotation.
#[inline]
- fn rotate_ray(&self, ray: &Ray) -> Ray {
Ray::new(ray.origin.clone(), self.rotate_vector(&ray.direction))
}
diff --git a/src/transform.rs b/src/transform.rs
index 936b3af..0382839 100644
--- a/src/transform.rs
+++ b/src/transform.rs
@@ -44,7 +44,7 @@ pub trait Transform>: Sized + PhantomFn
/// Transform a ray using this transform.
#[inline]
- fn transform_ray(&self, ray: &Ray) -> Ray {
Ray::new(self.transform_point(&ray.origin), self.transform_vector(&ray.direction))
}