Professional Documents
Culture Documents
On
“ROTATING FAN”
(18CSL67)
Submitted By
AKSHAY KUMAR USN: 3BR20CS009
CERTIFICATE
This is to certify that the MINI PROJECT of COMPUTER
GRAPHICS LABORATORY entitle “ROTATING FAN” has been
successfully presented by AKSHAY KUMAR bearing USN 3BR20CS009
and AMANATH RASOOL bearing USN 3BR20CS010 students of VI
semester B.E for the partial fulfilment of the requirements for the
award of Bachelor Degree in Computer Science and Engineering of
the VISVESVARAYA TECHNOLOGICAL UNIVERSITY, BELGAVI
during the academic year 2022-2023.
Mr. Dadapeer
External viva
date 1.
2.
I
ACKNOWLEDGEMENT
The satisfactions that accompany the successful completion of our mini project on “
ROTATING FAN” would be incomplete without the mention of people who made it possible,
whose noble gesture, affection, guidance, encouragement and support crowned my efforts with
success. It is our privilege to express our gratitude and respect to all those who inspired us
in the completion of our mini-project.
We are extremely grateful to our Guides Dr. Yeresime Suresh and Mr. Dadapeer for their
noble gesture, support co-ordination and valuable suggestions given in completing the mini-
project. We also thank Dr. R. N. Kulkarni, H.O.D. Department of CSE, for his co-ordination
and valuable suggestions given in completing the mini-project. We also thank Principal,
Management and non-teaching staff for their co-ordination and valuable suggestions given to
us in completing the mini-project.
Name USN
Akshay Kumar 3BR20CS009
II
TABLE OF CONTENTS
Acknowledgement II
4 Implementation
4.1 Function/Method description 6
8
4.2 Results (Screen shots of the output)
5 Conclusion 9
III
CHAPTER 1
1. INTRODUTION
In this project, we have created a computer-generated model of a rotating fan using computer
graphics techniques. A rotating fan is a common household appliance that cools the surrounding air
by circulating it. Our goal was to simulate the realistic motion and appearance of a fan in a virtual
environment.
To achieve this, we employed various computer graphics algorithms and concepts. We began by
creating a model of the fan, incorporating the different components such as blades, motor, and base
Next, we focused on animating the fan's motion. By applying transformation and rotation matrices,
we were able to simulate the spinning motion of the fan blades. We took into account factors like
speed, direction, and acceleration to create a convincing and dynamic animation.
Furthermore, we implemented user interaction by allowing the viewer to control the fan's speed and
direction through a graphical interface. This provided an immersive experience where users could
adjust the fan's settings and observe the corresponding changes in the animation.
Throughout the project, we aimed to strike a balance between accuracy and computational
efficiency, ensuring smooth and visually appealing animations even on modest hardware
configurations. By leveraging the principles of computer graphics, we have successfully brought a
rotating fan to life in a virtual environment.
We hope that our rotating fan CG mini project offers an engaging and realistic experience,
showcasing the application of computer graphics techniques in creating visually compelling
simulations.
To design and develop a software system for simulating Rotation of Fan , using OpenGL, where the
speed of rotation of the fan can be controlled by the user.
1
1.3 Objectives
To create a menu that allows users to control the fan's settings, such as speed, direction, and
power on/off.
To Create a model of a rotating fan with relevant components using computer-graphics (CG)
software.
2
CHAPTER 2
2. REQUIREMENTS SPECIFICATION
Please note that the provided code is specific to Windows operating systems due to the inclusion
of `<windows.h>`. If you intend to run the code on a different operating system, you may need to
modify the code accordingly 3
CHAPTER 3
3. DESIGN
1. Header Files: The necessary header files, including `windows.h`, `GL/glut.h`, `stdlib.h`, and
`math.h`, are included.
2. Lighting Properties: The lighting properties, such as light position, ambient, diffuse, and
specular properties, as well as material properties, are defined using `GLfloat` arrays.
3. Global Variables: `spin` is a global variable that keeps track of the rotation angle of the fan.
`isSpinning` is a flag that indicates whether the fan is currently spinning.
4. Display Function: The `display` function is responsible for rendering the scene. It clears the
color buffer and depth buffer. Then it sets up the rotation using `glPushMatrix` and `glRotatef`.
It draws two rectangles and a torus using `glRectf`’ and `glutSolidTorus`, respectively. Finally, it
restores the previous transformation using `glPopMatrix` and flushes the rendering pipeline.
6. Initialization Function: The `init` function is used to initialize the rendering settings. It sets
the clear color, enables lighting and depth testing, sets the lighting properties, and sets the
projection matrix.
7. Keyboard Function: The `my_keyboard` function handles keyboard input. It toggles the fan
rotation on/off, increases or decreases the rotation speed, and exits the program based on the
pressed keys.
8. Menu Function: The `menu` function handles the menu choices. It toggles the fan rotation
on/off, increases or decreases the rotation speed, changes the rotation direction to clockwise or
counterclockwise, and exits the program based on the selected menu options.
4
9. Main Function: The `main` function initializes GLUT, creates a window, sets the display
mode, size, and position. It sets the display and keyboard functions, creates a menu, and attaches
it to the right mouse button. Finally, it enters the main event loop using `glutMainLoop`.
Overall, the code follows a structured design pattern where the different functions handle specific
tasks such as initialization, rendering, user input, and menu handling. The lighting effects are
achieved by enabling lighting, setting up lighting properties, and material properties. The menu
provides an interactive way to control the fan rotation, direction, and speed.
5
CHAPTER 4
4. IMPLEMENTATION
8
CHAPTER 5
5. CONCLUSION
In conclusion, the rotating fan CG mini project successfully achieved its objective of
creating a realistic and visually appealing 2D model of a rotating fan. Through careful
design and animation, the fan blades were brought to life, giving the illusion of movement
and functionality. The project incorporated realistic lighting and shading effects, enhancing
the overall visual experience. Attention to detail and accuracy in modeling contributed to
the project's success. Overall, the rotating fan CG mini project showcased the capabilities
of computer graphics in simulating real-world objects and provided an engaging and
immersive virtual experience.
REFERENCES