From 818d954b383f472ccc0e0d19b7f8e42416f5797a Mon Sep 17 00:00:00 2001 From: davhojt Date: Wed, 25 May 2022 11:42:07 +0300 Subject: [PATCH 1/3] docs(drawing): correct grammar --- subjects/drawing/README.md | 38 +++++++++++++++----------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/subjects/drawing/README.md b/subjects/drawing/README.md index a7efabae..a9e37e92 100644 --- a/subjects/drawing/README.md +++ b/subjects/drawing/README.md @@ -6,13 +6,13 @@ The purpose of this exercise is to create an image like the example bellow: ![example](image.png) -For this exercise you will need to do the following: +You will need to do the following: - Copy the code in [usage](#usage) to your `main.rs`. - Create a module called `geometrical_shapes` in another file. -This module will keep all the logic for creating and operating with the different geometrical shapes. You need to define two traits, `Displayable` and `Drawable`. +You'll define the logic for creating and working with shapes in `geometrical_shapes`. Create the following traits: - `Drawable` which contains the methods `draw` and `color`. @@ -20,32 +20,24 @@ This module will keep all the logic for creating and operating with the differen Define them according to the way they are called in the `main.rs` function. -In order to make the code in the `main.rs` compile and run, you have to define the following structures: - -- `Point` -- `Circle` -- `Line` -- `Rectangle` -- `Triangle` - -You are free to implement all the shapes with whatever internal structure you see fit, but you must provide an associated function `new` for all the shapes, which will be described below: +In order to compile and run `main.rs`, you'll need to define some structures. You are free to implement all the shapes with whatever internal structure you see fit, but you must provide an associated function `new` for all the shapes, which will be described below: - `Point`: a new point should be created from two `i32` values. -- `Line`: a new line should be created from references to two different points. Also it will define an associated function called `random`: - - `random`: receives two arguments, the first is the `maximum x` value a point can have and the second is the `maximum y` value that a point can have. +- `Line`: a new line should be created from references to two different points. It will also contain the associated function: + - `random`: receives two arguments, representing the maximum `x` and maximum `y` values that a point can have. - `Triangle`: a new triangle should be created from references to three different points. -- `Rectangle`: a new rectangle should be created from two references to different points. -- `Circle`: a new circle should be created from a point representing the center and an `i32` value representing the radius for the circle. - -- The main function also requires a definition of an associated function called `random` for the types `Line`, `Point` and `Circle`. You should derive their signature from the usage. +- `Rectangle`: a new rectangle should be created from references to two different points. +- `Circle`: a new circle should be created from a point representing the center and an `i32` value representing the circle's radius. -**Note**: Don't forget to add the dependencies in your Cargo.toml. +You'll also need to create the associated function `random` for `Line`, `Point` and `Circle`. You should derive their signature from the usage. -#### Bonus +> Don't forget to add the dependencies in your Cargo.toml. -- Implement the possibility of drawing a pentagon (implement the structure Pentagon, and the trait needed to draw in the image) +### Bonus -- Implement the possibility of drawing a cube (implement the structure Cube, and the trait needed to draw in the image) +Implement the following shapes, including their structure and traits needed to draw them: +- `Pentagon` +- `Cube` ### Usage @@ -89,10 +81,10 @@ impl Displayable for Image { } ``` -**Note**: The expected output is a png file: `image.png` +> The expected output is a png file: `image.png` ### Notions - [Image processing library](https://docs.rs/raster/0.2.0/raster/) -- [Traits](https://doc.rust-lang.org/stable/book/ch10-02-traits.html) \ No newline at end of file +- [Traits](https://doc.rust-lang.org/stable/book/ch10-02-traits.html) From cde559ec3a13483c8b932156aa87237559464b77 Mon Sep 17 00:00:00 2001 From: davhojt Date: Wed, 25 May 2022 12:11:32 +0300 Subject: [PATCH 2/3] docs(drawing): remove duplicate --- subjects/drawing/README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/subjects/drawing/README.md b/subjects/drawing/README.md index a9e37e92..b4180b96 100644 --- a/subjects/drawing/README.md +++ b/subjects/drawing/README.md @@ -8,7 +8,7 @@ The purpose of this exercise is to create an image like the example bellow: You will need to do the following: -- Copy the code in [usage](#usage) to your `main.rs`. +- Copy the code in the [usage](#usage) to your `main.rs`. - Create a module called `geometrical_shapes` in another file. @@ -23,8 +23,7 @@ Define them according to the way they are called in the `main.rs` function. In order to compile and run `main.rs`, you'll need to define some structures. You are free to implement all the shapes with whatever internal structure you see fit, but you must provide an associated function `new` for all the shapes, which will be described below: - `Point`: a new point should be created from two `i32` values. -- `Line`: a new line should be created from references to two different points. It will also contain the associated function: - - `random`: receives two arguments, representing the maximum `x` and maximum `y` values that a point can have. +- `Line`: a new line should be created from references to two different points. - `Triangle`: a new triangle should be created from references to three different points. - `Rectangle`: a new rectangle should be created from references to two different points. - `Circle`: a new circle should be created from a point representing the center and an `i32` value representing the circle's radius. From 0bd2c8ffaed0af221111057068205e2a177ad6e0 Mon Sep 17 00:00:00 2001 From: davhojt Date: Wed, 25 May 2022 12:16:02 +0300 Subject: [PATCH 3/3] docs(drawing): correct grammar --- subjects/drawing/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/subjects/drawing/README.md b/subjects/drawing/README.md index b4180b96..a463ded6 100644 --- a/subjects/drawing/README.md +++ b/subjects/drawing/README.md @@ -26,15 +26,15 @@ In order to compile and run `main.rs`, you'll need to define some structures. Yo - `Line`: a new line should be created from references to two different points. - `Triangle`: a new triangle should be created from references to three different points. - `Rectangle`: a new rectangle should be created from references to two different points. -- `Circle`: a new circle should be created from a point representing the center and an `i32` value representing the circle's radius. +- `Circle`: a new circle should be created from a reference to a point representing the center, and an `i32` value representing the circle's radius. -You'll also need to create the associated function `random` for `Line`, `Point` and `Circle`. You should derive their signature from the usage. +You'll also need to create the associated function `random` for `Line`, `Point` and `Circle`. You should derive their signatures from the usage. > Don't forget to add the dependencies in your Cargo.toml. ### Bonus -Implement the following shapes, including their structure and traits needed to draw them: +You may optionally implement the following shapes, including the structures and traits needed to draw them: - `Pentagon` - `Cube`