diff --git a/src/cgmath/intersect.rs b/src/cgmath/intersect.rs new file mode 100644 index 0000000..51ce852 --- /dev/null +++ b/src/cgmath/intersect.rs @@ -0,0 +1,18 @@ +// Copyright 2013 The CGMath Developers. For a full listing of the authors, +// refer to the AUTHORS file at the top-level directory of this distribution. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +pub trait Intersect { + fn intersection(&self) -> Result; +} diff --git a/src/cgmath/lib.rs b/src/cgmath/lib.rs index 59f3cff..037bbf5 100644 --- a/src/cgmath/lib.rs +++ b/src/cgmath/lib.rs @@ -33,11 +33,12 @@ pub mod point; pub mod ray; pub mod rotation; -pub mod frustum; pub mod projection; pub mod aabb; pub mod cylinder; +pub mod frustum; +pub mod intersect; pub mod obb; pub mod sphere; diff --git a/src/cgmath/plane.rs b/src/cgmath/plane.rs index 4b2aace..3eaf638 100644 --- a/src/cgmath/plane.rs +++ b/src/cgmath/plane.rs @@ -13,6 +13,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +use intersect::Intersect; +use point::Point3; +use ray::Ray3; use vector::Vec3; use std::fmt; @@ -32,6 +35,24 @@ pub struct Plane { distance: S, } +impl Intersect>> for (Plane, Ray3) { + fn intersection(&self) -> Option> { + fail!("Not yet implemented"); + } +} + +impl Intersect>> for (Plane, Plane) { + fn intersection(&self) -> Option> { + fail!("Not yet implemented"); + } +} + +impl Intersect>> for (Plane, Plane, Plane) { + fn intersection(&self) -> Option> { + fail!("Not yet implemented"); + } +} + impl ToStr for Plane { fn to_str(&self) -> ~str { format!("{:f}x + {:f}y + {:f}z + {:f} = 0",