diff --git a/src/lib.rs b/src/lib.rs
index 51983f0..1880634 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -15,7 +15,7 @@
#![crate_type = "rlib"]
#![crate_type = "dylib"]
-#![feature(old_impl_check, plugin, core, std_misc, custom_derive)]
+#![feature(plugin, core, std_misc, custom_derive)]
//! Computer graphics-centric math.
//!
diff --git a/src/line.rs b/src/line.rs
index 595faf6..3156cbb 100644
--- a/src/line.rs
+++ b/src/line.rs
@@ -15,28 +15,35 @@
//! Line segments
+use std::marker::PhantomData;
use num::{BaseNum, BaseFloat, Zero, zero, One, one};
use point::{Point, Point2, Point3};
-use vector::{Vector, Vector2};
+use vector::{Vector, Vector2, Vector3};
use ray::{Ray2};
use intersect::Intersect;
/// A generic directed line segment from `origin` to `dest`.
#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable)]
-pub struct Line
{
+pub struct Line {
pub origin: P,
pub dest: P,
+ phantom_s: PhantomData,
+ phantom_v: PhantomData
}
-#[old_impl_check]
-impl, P: Point> Line {
- pub fn new(origin: P, dest: P) -> Line
{
- Line { origin:origin, dest:dest }
+impl, P: Point> Line {
+ pub fn new(origin: P, dest: P) -> Line {
+ Line {
+ origin: origin,
+ dest: dest,
+ phantom_v: PhantomData,
+ phantom_s: PhantomData
+ }
}
}
-pub type Line2 = Line>;
-pub type Line3 = Line>;
+pub type Line2 = Line, Point2>;
+pub type Line3 = Line, Point3>;
/// Determines if an intersection between a ray and a line segment is found.
impl Intersect>> for (Ray2, Line2) {
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 origin: P,
pub direction: V,
+ phantom_s: PhantomData
}
-#[old_impl_check]
-impl, P: Point> Ray {
- pub fn new(origin: P, direction: V) -> Ray
{
- Ray { origin: origin, direction: direction }
+impl, P: Point> Ray {
+ pub fn new(origin: P, direction: V) -> Ray {
+ Ray {
+ origin: origin,
+ direction: direction,
+ phantom_s: PhantomData
+ }
}
}
-pub type Ray2 = Ray, Vector2>;
-pub type Ray3 = Ray, Vector3>;
+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, P: Point>: PartialEq + Approx
/// Rotate a ray using this rotation.
#[inline]
- fn rotate_ray(&self, ray: &Ray ) -> Ray
{
+ 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, P: Point>: Sized + PhantomFn
/// Transform a ray using this transform.
#[inline]
- fn transform_ray(&self, ray: &Ray ) -> Ray
{
+ fn transform_ray(&self, ray: &Ray) -> Ray {
Ray::new(self.transform_point(&ray.origin), self.transform_vector(&ray.direction))
}