diff --git a/src/main.rs b/src/main.rs index d451e1c..872489a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -105,4 +105,20 @@ struct Sphere { radius: f64, } -fn main() {} +impl Sphere { + fn new(point: Point3, radius: f64) -> Sphere { + Sphere { point, radius } + } +} + +fn main() { + let sphere1 = Sphere::new(Point3::new(0.0, 0.0, 0.0), 25.0); + let sphere2 = Sphere::new(Point3::new(1.0, -45.4, 3.55), 2.0); + let sphere3 = Sphere::new(Point3::new(3.0, 2.0, 1.0), 0.5); + + let mut v = Vec::new(); + + v.push(sphere1); + v.push(sphere2); + v.push(sphere3); +}