Browse Source

Merge pull request #1119 from 01-edu/review-the-project-c-578

Review the project c 578
borrow_box-c-571
David Mata 2 years ago committed by GitHub
parent
commit
10e93ebfa5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      subjects/rt/README.md
  2. 2
      subjects/rt/audit/README.md
  3. 38
      subjects/smart-road/README.md
  4. 10
      subjects/smart-road/audit/README.md

18
subjects/rt/README.md

@ -1,6 +1,6 @@
## rt
There are two ways to render a 3d scene into a 2d image: `rasterization` which basically converts the shapes and geometric figures to pixels and applies calculations to obtain the color, the shadows, the refraction, etc... of those pixels. The other method is called `ray tracing` and consist in drawing each pixel with its color, shadows, refraction, reflection, etc.... already present from the start.
There are two ways to render a 3d scene into a 2d image: `rasterization`, which converts the shapes and geometric figures to pixels and applies calculations to obtain the color, the shadows, the refraction, etc... of those pixels. The other method is called `ray tracing` and consists in drawing each pixel with its color, shadows, refraction, reflection, etc.... already present from the start.
Imagine a camera pointing at a scene, and from that camera, a bunch of rays are coming, which bounce from object to object until they reach the light source (lamp, sun, etc...). This is basically how a ray tracer works.
@ -16,10 +16,10 @@ Below is an example of an image which your ray tracer should be able to produce:
In this project, you have to implement the ray tracer method in order to be able to render a computer generated image containing a few objects.
When building your ray tracer you have to take some points into consideration:
When building your ray tracer, you have to take some points into consideration:
- you need to be able to create at least 4 simple objects: a sphere, a cube, a flat plane and a cylinder.
- your program must be able to change an object location before creating the image. (Example: render a sphere with its center on the point (1,1,1)).
- your program must be able to change an object's location before creating the image. (Example: render a sphere with its center on the point (1,1,1)).
- you have to be able to look at the same scene from different angles by moving the camera/point of view.
- you also have to implement simple light management, which includes: different brightness and shadows.
@ -30,13 +30,13 @@ As your ray tracer will probably be a bit slow to render high resolution scenes,
- a scene with one of each of all the objects (one cube, one sphere, one cylinder and one flat plane);
- a scene like the previous one, but with the camera in another position (thus generating the same image from a different perspective).
All of the images should be in the format of 800x600. However, while testing you should use smaller resolution images in order to reduce your rendering time (a 1200x1000 can take up to 40 mins to create).
All of the images should be in the format of 800x600. However, while testing, you should use smaller resolution images in order to reduce your rendering time (a 1200x1000 can take up to 40 mins to create). It would be best to consider the possibility of changing the output image's resolution easily.
Another aspect you should consider is that the auditor will have to use your ray tracer, so make it as usable and optimized as possible. You should provide the auditor clear documentation.
#### Documentation
By documentation we mean, the explaining of how does the ray tracer work and how to work with it, for example: how to create an object, how to change brightness in a scene, etc... A new user of your ray tracer, after reading the documentation has to be able to use it without much guessing work.
By documentation we mean the explaining of how the ray tracer work and how to work with it, for example: how to create an object, how to change brightness in a scene, etc... After reading the documentation, a new user of your ray tracer has to be able to use it without much guessing work.
You will have to create a [markdown](https://www.markdownguide.org/getting-started/) file, which will have to contain:
@ -74,15 +74,15 @@ P3 \
The image header consists of three lines:
- the first one is the image format: what type of PPM (full color, ASCII enconding) image it is. P3 stands for the Portable PixMap type so you will be using this one.
- the next stands for how many columns and rows of pixels the image will contain.
- the first one is the image format: what type of PPM (full color, ASCII encoding) image it is. P3 stands for the Portable PixMap type, so you will be using this one.
- the following stands for how many columns and rows of pixels the image will contain.
- and the third line is the maximum color value, 255 is the most common value since the rgb color code is very well known.
All the other lines below, are the rgb values for each pixel, for example the first line of the image body represents a black pixel (rgb(0,0,0) -> black). Each line represents one pixel, starting on the top left corner transitioning to the right and, in this case, the fifth line is the pixel in the first row on the second column.
So with this in mind, you will have to make an algorithm that fills a file by printing each line. You can use the cargo command this way: `cargo run > output.ppm`. This will print the standard output to the file `output.ppm`.
In order to create the previous mentioned objects you will need to search online for documentation about the geometrics of each.
In order to create the previously mentioned objects, you will need to search online for documentation about the geometrics of each.
### Bonus
@ -93,6 +93,8 @@ As bonus for this project you can implement:
- Add particles
- Add fluids
Consider putting your bonuses behind command-line flags to achieve a reasonable performance standard defined above. For example, to render textures on your image, you can use a flag -t. Otherwise, textures will be ignored.
This project will help you learn about:
- [Ray Tracing](<https://en.wikipedia.org/wiki/Ray_tracing_(graphics)>)

2
subjects/rt/audit/README.md

@ -4,6 +4,8 @@
###### Does the image correspond to the scene you created?
###### Is it possible for you to reduce the resolution of the output image?
##### Move the camera and render the same scene.
###### Does the image correspond to the same scene, but from a different perspective?

38
subjects/smart-road/README.md

@ -1,18 +1,15 @@
#### Smart Road
## Smart Road
### Objectives
Do you remember the [`road_intersection`](https://public.01-edu.org/subjects/road_intersection/) raid done in the Rust Piscine? Well, you
will have to create another traffic control strategy and its simulation. However, this time it will have to be done without traffic lights and with a smart intersection management strategy.
Do you remember the [`road_intersection`](https://public.01-edu.org/subjects/road_intersection/) raid done in the Rust Piscine? Well, you will have to create another traffic control strategy and its simulation. However, it will have to be done without traffic lights and with a smart intersection management strategy this time.
Most of the time, overused intersections might lead to serious traffic jams on multiple roads, which wastes drivers'time and money, and also causes unnecessary air pollution. Additionally, according to a study from the National Highway Traffic Safety administration in the U.S., it is reported that about 96% of the intersection-related crashes had critical reasons to be the drivers fault, such as inadequate surveillance, false assumption of other actions, and turns with obstructed view.
Overused intersections might lead to severe traffic jams on multiple roads, which wastes drivers' time and money and causes unnecessary air pollution. Additionally, according to a study from the National Highway Traffic Safety Administration in the U.S., it is reported that about 96% of the intersection-related crashes had critical reasons to be the driver's fault, such as inadequate surveillance, false assumption of other actions, and turns with an obstructed view.
[Autonomous vehicles](https://en.wikipedia.org/wiki/Self-driving_car) (AVs) are a promising solution to traffic accidents. An optimistic prediction is that AVs will be publicly available in the next decade, and thus traffic issues related to autonomous vehicles are also being extensively investigated.
Current intersection management strategies, such as the traditional traffic lights and other more advanced methods are designed exclusively
for human drivers. With the rapid development of AVs, new traffic strategies must be taken into account.\
This is where you come in. You will have to create this new traffic strategy algorithm, so that AVs can pass an intersection without any
collisions and with a minimum of traffic congestion.
Current intersection management strategies, such as the traditional traffic lights and other more advanced methods, are designed exclusively for human drivers. With the rapid development of AVs, new traffic strategies must be taken into account.
This is where you come in. You will have to create this new traffic strategy algorithm so that AVs can pass an intersection without any collisions and with a minimum of traffic congestion.
### Instructions
@ -66,37 +63,35 @@ intersection area can only be represented by the corresponding lane.
As stated above you will be considering that all vehicles are autonomous (AVs), also known as self-driving cars.
You will have to implement the physics for this type of vehicles by taking into account the following rules :
1. AVs driving on a lane with a **given route** must follow the direction of
that route, it is not possible for the AVs to change lanes or route.
1. AVs driving on a lane with a **given route** must follow the direction of that route; the AVs can't change lanes or routes.
2. AVs must have at least 3 different velocities, therefore the **smart intersection system** can control the velocity of the vehicle.\
2. AVs must have at least 3 different velocities. Therefore the **smart intersection system** can control the velocity of the vehicle.\
This will be the way of controlling the current velocity/time/distance (depending on the algorithm you implement) of the AVs.
3. Each AV must respect a safety distance from other AVs.\
If a vehicle is driving with a high velocity and encounters another vehicle, it must detect that vehicle and keep a safe distance from it. It should not collide!
You are free to decide what is the safety distance but it must a strictly positive value.
If a vehicle is driving at a high velocity and encounters another vehicle, it must detect that vehicle and keep a safe distance from it. It should not collide!
You are free to decide the safety distance, but it must be a strictly positive value.
4. Other vehicles such as emergency vehicles are not considered in this project.
4. Other vehicles, such as emergency vehicles, are not considered in this project.
5. You must implement physics for the vehicle, such as `velocity = distance / time`. Each vehicle must have a :
- `time`: the time that the AV takes to leave the intersection
- `distance`: the distance that the AV takes to leave the intersection
- `velocity`: the speed of the AV at current time
- `velocity`: the speed of the AV at the current time
---
#### **Animation**
Animation is required for this project, you will have to find some assets for the vehicles and roads. Here are some assets for this:
Animation is required for this project. You will have to find some assets for the vehicles and roads. Here are some assets for this:
- [limezu](https://limezu.itch.io/)
- [finalbossblue](http://finalbossblues.com/timefantasy/free-graphics/).
- [mobilegamegraphics](https://mobilegamegraphics.com/product-category/all_products/freestuff/).
- [spriters-resource](https://www.spriters-resource.com/).
Animation is not just rendering an image into the canvas. By using assets you get to decide your "world coordinate system"
for the rendered image and therefore you create your own animation. But this is not enough.Basically you must animate while moving.
Animation is not just rendering an image into the canvas. By using assets, you get to decide your "world coordinate system" for the rendered image and therefore you create your own animation. But this is not enough. Basically, you must animate while moving.
A simple example of movement animation is imagining a vehicle with a route of `r`. This means that the vehicle arrives at the
intersection and turns right. If we render just an image of the vehicle facing down and it arrives to the point of turning, the rendered image
@ -119,9 +114,9 @@ You will have to implement several commands so that the simulation can be well t
2. It must also be possible to use the key `R` to continually generate random vehicles (using the game loop).
3. The `Esc` key must finish the simulation and generate a window with all statistics (you can see more about the statistics on its section).
3. The `Esc` key must finish the simulation and generate a window with all statistics (you can see more about the statistics in the below section).
4. When spamming the same key the vehicles should not be generated all at the same time, in other words, the vehicles should not be created on top of each other.
4. When spamming the same key, the vehicles should not be generated all at the same time. In other words, the vehicles should not be created on top of each other.
---
@ -133,7 +128,7 @@ The statistics must include:
- Max number of vehicles that passed the intersection
- Max velocity of all vehicles (Display the fastest speed achieved)
- Min velocity of all vehicles (Dislay the slowest speed reached)
- Min velocity of all vehicles (Display the slowest speed reached)
- Max time that the vehicles took to pass the intersection (for all vehicles, display the one that took more time)
- Min time that the vehicles took to pass the intersection (for all vehicles, display the one that took less time)
- The time starts to count whenever the vehicle is detected by the **smart intersection algorithm** until the end of the intersection, which is when the vehicle is removed from the canvas.
@ -153,6 +148,7 @@ You can implement the following optional features:
- Create your own assets for the animation of the vehicles
- Add more statistics
- Consider acceleration and deceleration on the physics of your game. That means that the cars don't change automatically of speed (e.g. different cars can take different times to change from 50 to 10 depending on how good the brakes are)
This project will help you learn about:

10
subjects/smart-road/audit/README.md

@ -6,14 +6,6 @@
###### If so, is there any image/asset that represents this intersection?
##### Try and run the application, then generate a vehicle of your choice.
###### Is there any animation for the vehicle?
##### Try and run the application, then generate a vehicle that turns right.
###### Did the vehicle animated accordingly when turning right?
##### Try and run the application, then generate a vehicle by pressing the `"Arrow Up"` key.
###### Was a vehicle generated from the cardinal South?
@ -112,4 +104,6 @@
###### +Did the student create their own assets?
###### +Do cars have the component of acceleration, or do they change velocity automatically?
###### +In your opinion, is this algorithm implementable for real life situations?

Loading…
Cancel
Save