CGRF
CGRF
Title: FIRECRACKER
1
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION CERTIFIACTE
Seal of Institution
2
INDEX
Academic year: 2023-2024 Name of the faculty: Mrs. Jayashree
Kamble
3
Annexure – I
Micro-Project Proposal
Title: FIRECRACKER
4
3.0 Proposed Methodology
● Objectives
Planning
1. Team Formation: The teacher formed teams based on roll numbers and assigned the
topic. This encouraged collaboration and balanced skillsets within the group.
2. Materials Needed:
Computer System: With Turbo C++ or any compatible C compiler.
Graphics Libraries: <graphics.h>, <math.h>, and <dos.h>.
Design Tools: Flowchart or sketches to outline the graphical sequence.
Mathematical Models: Sine and parabolic functions to create the firecracker’s
curved path
3. Structure
Code Execution Steps:
o Firecracker base is drawn at the starting position.
o The firecracker moves along a curved path using mathematical functions.
o Explosion simulation is displayed with expanding circles.
o A celebratory message "HAPPY DIWALI!" is shown to complete the simulation.
Setup:
Graphics Window: Initialized using initgraph().
Firecracker Path: Designed using interpolation and sine-based calculations for realistic
motion.
Explosion Effect: Simulated by drawing expanding circles at the apex of the path.
Message Display: Created using outtextxy() to display the final message.
4. Execution
Preparation: Initial testing of graphical elements like pixel placement and movement
along curves.
Main Execution:
The simulation starts with the firecracker being drawn on the screen.
Then it ask to press enter key to proceed
A man comes and ignites the cracker
Upon user input, the firecracker follows its path, leading to the explosion.
The explosion effect is generated using PIXELS
.
Team Communictaion:
Discussed code flow and mathematical modeling to ensure smooth animation.
Regularly tested and debugged the simulation in a collaborative manner.
5
4.0 0Action Plan
6
Annexure – II
Micro-Project Report
Title :To make a Firecracker
1.0 Rationale
The rationale behind this project was to apply graphics programming in a creative and festive context.
Fireworks are synonymous with celebrations like Diwali, and simulating them in a program offers a
way to make programming both fun and visually captivating. This project serves as a bridge between
learning algorithms and creating real-world animations, making it a perfect blend of technical and
artistic skills.
7
5.0 Actual Procedure Followed.
1. Initial Discussion: The project started with a group discussion to break down the task,
assign responsibilities, and understand the core requirements.
2. Coding: The programmer wrote the code for the firecracker launch, explosion, and
message display. Mathematical functions for the trajectory were implemented.
3. Testing and Debugging: Multiple test runs were conducted to identify bugs, and
improvements were made to ensure smooth animation.
4. Final Submission: The final version of the project was reviewed and submitted after
incorporating feedback from peers and the teacher.
8
1. Algorithm
1. Initialize Graphics Mode:
o Detect the graphics driver and mode using DETECT.
o Initialize graphics using initgraph() with the detected settings.
2. Draw Initial Scene (Ground and Firecracker):
o Set the color to white.
o Draw a horizontal line to represent the ground.
o Draw the firecracker using rectangle() to represent its base and top.
3. Prompt for User Input:
o Display a message "PRESS ANY KEY TO IGNITE THE ROCKET"
using outtextxy().
o Wait for user input using getch().
4. Clear Screen and Redraw Ground and Firecracker:
o Use cleardevice() to clear the screen.
o Redraw the ground line and firecracker to maintain the scene.
5. Animate the Man Walking Towards the Firecracker:
o Use a loop to move the man from a starting position to the firecracker.
o For each frame of movement:
Clear the screen using cleardevice().
Redraw the ground and firecracker.
Call drawMan() to draw the man at the current position.
Alternate leg positions using the step count (even/odd) to
simulate walking.
Delay for a short duration to control animation speed
(delay(150)).
6. Ignite the Firecracker:
o After the man reaches the firecracker, continue the loop to show the
man lighting the firecracker and moving away.
o For each frame:
Clear the screen.
Redraw the ground and firecracker.
Draw the man moving away from the firecracker.
Delay to control the animation speed.
7. Animate the Rocket's Ignition and Ascent:
o Start a loop to simulate the firecracker rising.
o For each frame:
Clear the screen.
Redraw the rocket at an updated position as it moves upward.
9
8. Simulate the Explosion:
o After the rocket ascends, simulate the explosion using a series of pixel
patterns arranged in expanding circular shapes.
o For each part of the explosion:
Use putpixel() to place pixels at specific locations, creating a burst
effect.
Delay to control the speed of the explosion effect.
9. Display Final Burst and Exit:
o After completing the explosion effect, display the final frame for a short
duration.
o Clear the screen and wait for the user to exit using getch().
10
2. Coding
#include<conio.h>
#include<graphics.h>
#include<stdio.h>
#include<math.h>
#include<dos.h>
void drawMan(int x, int y, int step) {
setcolor(WHITE); // Set the man color to white
// Head
circle(x, y, 10);
// Body
line(x, y + 10, x, y + 30);
// Arms
line(x, y + 15, x - 10, y + 20);
line(x, y + 15, x + 10, y + 20);
line(x + 10, y + 20,x+20,y+5);
setcolor(14);
line(x + 13, y + 17,x+20,y+5);
setcolor(15);
// Legs with alternating steps
if (step % 2 == 0) {
// Left leg forward, right leg backward
line(x, y + 30, x - 10, y + 45); // Left leg
line(x, y + 30, x + 10, y + 35); // Right leg
} else {
// Right leg forward, left leg backward
line(x, y + 30, x - 10, y + 35); // Left leg
line(x, y + 30, x + 10, y + 45); // Right leg
}
}
void main() {
int gd = DETECT, gm;
int x, y;
int i, j, kk, l;
11
initgraph(&gd, &gm, "c:\\turboc3\\bgi");
setcolor(WHITE);
line(0, 400, 640, 400); // Ground line
rectangle(300, 330, 340, 400); // Firecracker's base
rectangle(310, 320, 330, 330); // Firecracker's top
12
}
// Rocket ignition sequence (no changes made to the cracker part as requested)
for (j = 400; j < 640; j++) {
cleardevice();
setcolor(WHITE);
line(0, j, 640, j);
rectangle(300, j - 70, 340, j);
rectangle(310, j - 80, 330, j - 70);
}
13
putpixel(330 + i, 300 + i - j, 14);
putpixel(330 - i, 300 - i - j, 14);
putpixel(330 + i, 300 - i - j, 14);
putpixel(330 - i, 300 + i - j, 14);
delay(1);
}
delay(15);
}
setcolor(YELLOW);
circle(325, 300, 2);
delay(5);
cleardevice();
14
putpixel(130 - i, 200 - i - j, 12);
putpixel(130 + i, 200 - i - j, 12);
putpixel(130 - i, 200 + i - j, 12);
delay(5);
}
for (i = 0; i < 20; i += 3) {
j = 0;
putpixel(230 + i, 100 - j, 14);
putpixel(230, 100 + i - j, 14);
putpixel(230 - i, 100 - j, 14);
putpixel(230, 100 - i - j, 14);
putpixel(230 + i, 100 + i - j, 14);
putpixel(230 - i, 100 - i - j, 14);
putpixel(230 + i, 100 - i - j, 14);
putpixel(230 - i, 100 + i - j, 14);
delay(5);
}
getch();
}
15
6.0 Actual Resources Used
16
17
8.0 Skill Developed / learning out of this Micro-Project.
18
Annexure – III
19
Annexure – IV
20
Sr.
Characteristic to be
No Poor Average Good Excellent
assessed ( Marks1-3 )
Sub Total
. (Marks 4-5 ) (Marks 6-8) ( Marks9-10)
(A) Process and Product Assessment (Convert Above Total marks out of 15 Marks)
5 Quality of Prototype/Model
6 Report Preparation
(B) Individual Presentation / Viva (Convert above total marks out of 10 marks)
7 Presentation
8 Viva
Roll No. Process and Product Assessment Individual Presentation / Viva Total Marks 25
(15 Marks) (10 Marks)
19
20
21
Dated Signature:
21
Computer Graphics - 313001
Index Page
1 19
FIRECRACKER 23/10/2024
2
20
3
21
22