This document provides code examples for drawing various shapes and performing graphics in C++. It includes functions for drawing lines, rectangles, circles, ellipses, arcs, and more. It also includes examples of animations like a moving car and cycle. Pie charts and changing color are also demonstrated. The document is a reference for the basic graphics programming capabilities in C++.
PROGRAMS ON GRAPHICS BASED ON PROGRAMMING LANGUAGE C & CPP (C++) . DOC CONSIST 8 PRACTICALS .
EACH PRACTICAL CONSIST MIN OF 2 QUESTION ALONG WITH SOLUTION i.e CODES
EG: MOVING FISH , MOVING CAR, STAR, GENERATION OF STARS,HOUSE,FLAG,ICE CREAM CONE,SMILEY FACE GENERATION OF BUBBLES , CONCENTRIC CIRCLES,DDA LINE ALGORITHM ,Bresenham’s line drawing algorithm,MIDPOINT CIRCLE DRAWING ALGORITHM,Bresenham’x circle drawing algorithm,TRANSLATE A POLYGON, REFLECT A POLYGON , TRANSLATE A CIRCLE , To scale a polygon about a reference point,ROTATE A POLYGON, Cohen sutherland line clipping algorithm,TEXT CLIPPING, Character Generation,FLYING KITE
Computer Graphics and Multimedia lab reportBijoy679
According to NU of Bangladesh for BSC Hons in CSE 6th semester, here you can find the solution about this subject according to the board question respectively.
PROGRAMS ON GRAPHICS BASED ON PROGRAMMING LANGUAGE C & CPP (C++) . DOC CONSIST 8 PRACTICALS .
EACH PRACTICAL CONSIST MIN OF 2 QUESTION ALONG WITH SOLUTION i.e CODES
EG: MOVING FISH , MOVING CAR, STAR, GENERATION OF STARS,HOUSE,FLAG,ICE CREAM CONE,SMILEY FACE GENERATION OF BUBBLES , CONCENTRIC CIRCLES,DDA LINE ALGORITHM ,Bresenham’s line drawing algorithm,MIDPOINT CIRCLE DRAWING ALGORITHM,Bresenham’x circle drawing algorithm,TRANSLATE A POLYGON, REFLECT A POLYGON , TRANSLATE A CIRCLE , To scale a polygon about a reference point,ROTATE A POLYGON, Cohen sutherland line clipping algorithm,TEXT CLIPPING, Character Generation,FLYING KITE
Computer Graphics and Multimedia lab reportBijoy679
According to NU of Bangladesh for BSC Hons in CSE 6th semester, here you can find the solution about this subject according to the board question respectively.
This file contains all the practicals with output regarding GTU syllabus. so it will help to IT and Computer engineering students. It is really knowledgeable so refer these for computer graphics practicals.
Ex.1 Write a program to print the following pattern
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
Ex.2 Write a program to find bigger of three integers.
Ex.3 Write a program to calculate GCD between two numbers.
Ex.4 Write a program to find transpose of matrix.
Ex.5 Write a program which deletes an element from an array & display all other elements.
Ex.6 Write a program to calculate XA+YB where A & B are matrix & X=2, Y=3.
Ex.7 Write a program to calculate the total amount of money in the piggy bank, given that coins of Rs.10, Rs.5, Rs.2, RS.1.
& many more.....
- To translate an object by a vector v, each homogeneous vector p (written in homogeneous coordinates) would need to be multiplied by thistranslation matrix
What is greenhouse gasses and how many gasses are there to affect the Earth.moosaasad1975
What are greenhouse gasses how they affect the earth and its environment what is the future of the environment and earth how the weather and the climate effects.
Professional air quality monitoring systems provide immediate, on-site data for analysis, compliance, and decision-making.
Monitor common gases, weather parameters, particulates.
More Related Content
Similar to bfd23fd7-0d89-45c0-8b82-c991b30ed375.pdf
This file contains all the practicals with output regarding GTU syllabus. so it will help to IT and Computer engineering students. It is really knowledgeable so refer these for computer graphics practicals.
Ex.1 Write a program to print the following pattern
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
Ex.2 Write a program to find bigger of three integers.
Ex.3 Write a program to calculate GCD between two numbers.
Ex.4 Write a program to find transpose of matrix.
Ex.5 Write a program which deletes an element from an array & display all other elements.
Ex.6 Write a program to calculate XA+YB where A & B are matrix & X=2, Y=3.
Ex.7 Write a program to calculate the total amount of money in the piggy bank, given that coins of Rs.10, Rs.5, Rs.2, RS.1.
& many more.....
- To translate an object by a vector v, each homogeneous vector p (written in homogeneous coordinates) would need to be multiplied by thistranslation matrix
What is greenhouse gasses and how many gasses are there to affect the Earth.moosaasad1975
What are greenhouse gasses how they affect the earth and its environment what is the future of the environment and earth how the weather and the climate effects.
Professional air quality monitoring systems provide immediate, on-site data for analysis, compliance, and decision-making.
Monitor common gases, weather parameters, particulates.
Observation of Io’s Resurfacing via Plume Deposition Using Ground-based Adapt...Sérgio Sacani
Since volcanic activity was first discovered on Io from Voyager images in 1979, changes
on Io’s surface have been monitored from both spacecraft and ground-based telescopes.
Here, we present the highest spatial resolution images of Io ever obtained from a groundbased telescope. These images, acquired by the SHARK-VIS instrument on the Large
Binocular Telescope, show evidence of a major resurfacing event on Io’s trailing hemisphere. When compared to the most recent spacecraft images, the SHARK-VIS images
show that a plume deposit from a powerful eruption at Pillan Patera has covered part
of the long-lived Pele plume deposit. Although this type of resurfacing event may be common on Io, few have been detected due to the rarity of spacecraft visits and the previously low spatial resolution available from Earth-based telescopes. The SHARK-VIS instrument ushers in a new era of high resolution imaging of Io’s surface using adaptive
optics at visible wavelengths.
THE IMPORTANCE OF MARTIAN ATMOSPHERE SAMPLE RETURN.Sérgio Sacani
The return of a sample of near-surface atmosphere from Mars would facilitate answers to several first-order science questions surrounding the formation and evolution of the planet. One of the important aspects of terrestrial planet formation in general is the role that primary atmospheres played in influencing the chemistry and structure of the planets and their antecedents. Studies of the martian atmosphere can be used to investigate the role of a primary atmosphere in its history. Atmosphere samples would also inform our understanding of the near-surface chemistry of the planet, and ultimately the prospects for life. High-precision isotopic analyses of constituent gases are needed to address these questions, requiring that the analyses are made on returned samples rather than in situ.
The ability to recreate computational results with minimal effort and actionable metrics provides a solid foundation for scientific research and software development. When people can replicate an analysis at the touch of a button using open-source software, open data, and methods to assess and compare proposals, it significantly eases verification of results, engagement with a diverse range of contributors, and progress. However, we have yet to fully achieve this; there are still many sociotechnical frictions.
Inspired by David Donoho's vision, this talk aims to revisit the three crucial pillars of frictionless reproducibility (data sharing, code sharing, and competitive challenges) with the perspective of deep software variability.
Our observation is that multiple layers — hardware, operating systems, third-party libraries, software versions, input data, compile-time options, and parameters — are subject to variability that exacerbates frictions but is also essential for achieving robust, generalizable results and fostering innovation. I will first review the literature, providing evidence of how the complex variability interactions across these layers affect qualitative and quantitative software properties, thereby complicating the reproduction and replication of scientific studies in various fields.
I will then present some software engineering and AI techniques that can support the strategic exploration of variability spaces. These include the use of abstractions and models (e.g., feature models), sampling strategies (e.g., uniform, random), cost-effective measurements (e.g., incremental build of software configurations), and dimensionality reduction methods (e.g., transfer learning, feature selection, software debloating).
I will finally argue that deep variability is both the problem and solution of frictionless reproducibility, calling the software science community to develop new methods and tools to manage variability and foster reproducibility in software systems.
Exposé invité Journées Nationales du GDR GPL 2024
Slide 1: Title Slide
Extrachromosomal Inheritance
Slide 2: Introduction to Extrachromosomal Inheritance
Definition: Extrachromosomal inheritance refers to the transmission of genetic material that is not found within the nucleus.
Key Components: Involves genes located in mitochondria, chloroplasts, and plasmids.
Slide 3: Mitochondrial Inheritance
Mitochondria: Organelles responsible for energy production.
Mitochondrial DNA (mtDNA): Circular DNA molecule found in mitochondria.
Inheritance Pattern: Maternally inherited, meaning it is passed from mothers to all their offspring.
Diseases: Examples include Leber’s hereditary optic neuropathy (LHON) and mitochondrial myopathy.
Slide 4: Chloroplast Inheritance
Chloroplasts: Organelles responsible for photosynthesis in plants.
Chloroplast DNA (cpDNA): Circular DNA molecule found in chloroplasts.
Inheritance Pattern: Often maternally inherited in most plants, but can vary in some species.
Examples: Variegation in plants, where leaf color patterns are determined by chloroplast DNA.
Slide 5: Plasmid Inheritance
Plasmids: Small, circular DNA molecules found in bacteria and some eukaryotes.
Features: Can carry antibiotic resistance genes and can be transferred between cells through processes like conjugation.
Significance: Important in biotechnology for gene cloning and genetic engineering.
Slide 6: Mechanisms of Extrachromosomal Inheritance
Non-Mendelian Patterns: Do not follow Mendel’s laws of inheritance.
Cytoplasmic Segregation: During cell division, organelles like mitochondria and chloroplasts are randomly distributed to daughter cells.
Heteroplasmy: Presence of more than one type of organellar genome within a cell, leading to variation in expression.
Slide 7: Examples of Extrachromosomal Inheritance
Four O’clock Plant (Mirabilis jalapa): Shows variegated leaves due to different cpDNA in leaf cells.
Petite Mutants in Yeast: Result from mutations in mitochondrial DNA affecting respiration.
Slide 8: Importance of Extrachromosomal Inheritance
Evolution: Provides insight into the evolution of eukaryotic cells.
Medicine: Understanding mitochondrial inheritance helps in diagnosing and treating mitochondrial diseases.
Agriculture: Chloroplast inheritance can be used in plant breeding and genetic modification.
Slide 9: Recent Research and Advances
Gene Editing: Techniques like CRISPR-Cas9 are being used to edit mitochondrial and chloroplast DNA.
Therapies: Development of mitochondrial replacement therapy (MRT) for preventing mitochondrial diseases.
Slide 10: Conclusion
Summary: Extrachromosomal inheritance involves the transmission of genetic material outside the nucleus and plays a crucial role in genetics, medicine, and biotechnology.
Future Directions: Continued research and technological advancements hold promise for new treatments and applications.
Slide 11: Questions and Discussion
Invite Audience: Open the floor for any questions or further discussion on the topic.
Richard's aventures in two entangled wonderlandsRichard Gill
Since the loophole-free Bell experiments of 2020 and the Nobel prizes in physics of 2022, critics of Bell's work have retreated to the fortress of super-determinism. Now, super-determinism is a derogatory word - it just means "determinism". Palmer, Hance and Hossenfelder argue that quantum mechanics and determinism are not incompatible, using a sophisticated mathematical construction based on a subtle thinning of allowed states and measurements in quantum mechanics, such that what is left appears to make Bell's argument fail, without altering the empirical predictions of quantum mechanics. I think however that it is a smoke screen, and the slogan "lost in math" comes to my mind. I will discuss some other recent disproofs of Bell's theorem using the language of causality based on causal graphs. Causal thinking is also central to law and justice. I will mention surprising connections to my work on serial killer nurse cases, in particular the Dutch case of Lucia de Berk and the current UK case of Lucy Letby.
Seminar of U.V. Spectroscopy by SAMIR PANDASAMIR PANDA
Spectroscopy is a branch of science dealing the study of interaction of electromagnetic radiation with matter.
Ultraviolet-visible spectroscopy refers to absorption spectroscopy or reflect spectroscopy in the UV-VIS spectral region.
Ultraviolet-visible spectroscopy is an analytical method that can measure the amount of light received by the analyte.
2. How do graphics work in C++
• The functions of C++ are used to implement graphics in a two-dimensional space.
Output can be viewed in a window or on a canvas. In this class, we made use of the
DevC++ IDE since it provides a solid structure upon which to build our drawings.
• To install the graphics library, we can refer to WinBGIm.DevC++ requires graphics.h
and libbgi.a. Next, select project options, then the parameter tab, and paste lbgi -
lgdi32 -lcomdlg32 -luuid -loleaut32 -lole32 in a linker tab.
3. Basic Graphic Programming in C++
Link Dev C++ : https://sourceforge.net/projects/orwelldevcpp/
Link of Graphics header files
https://www.dropbox.com/s/kjk46f5lh5uxn28/Graphics%20in%20Dev%20C++.rar?dl=0
6. A code plot point in C++
#include <stdio.h>
#include <conio.h>
#include <graphics.h>
main()
{
int x=40,y=50,h=10;
int gdriver = DETECT, gmode, errorcode;
initgraph(&gdriver, &gmode, "c:tcbgi");
putpixel(x,y,h);
getch();
}
7.
8. // C++ Implementation for drawing
line
#include <graphics.h>
main()
{
// gm is Graphics mode which is a computer display
// mode that generates images using pixels.
// DETECT is a macro defined in "graphics.h" header file
int gd = DETECT, gm;
// initgraph initializes the graphics system
// by loading a graphics driver from the disk
initgraph(&gd, &gm, "c:tcbgi");
// line for x1, y1, x2, y2
line(150, 150, 450, 150);
getch();
// close graph function closes the graphics
// mode and deallocates all memory allocated
// by graphics system.
closegraph();
}
9. Rectangle Function
The rectangle function is used to draw a rectangle between two points on the screen. Its syntax is:
rectangle (x1, y1, x2, y2);
For example, to draw a rectangle between the upper left comer & bottom right corner of the screen (for VGA
monitor), the statement is written as:
rectangle(0, 0, 639, 479);
or
rectangle (639, 479,0, 0);
Point (0, 0) represents the upper left corner of the screen, and point (639, 479) represents the bottom right comer
of the screen.
10. make a rectangle in c++ using the
rectangle function in graphics mode
#include<graphics.h>
#include<conio.h>
main()
{
int d,m;
d= detect;
initgraph(&d, &m, "c:tcbgi”);
rectangle(100,300,500,200);
getch();
closegraph();
}
11. Change the color of any shape in c++
#include<graphics.h>
using namespace std;
main()
{
initwindow(500,500);// دالة
تهيئة
شاشة
الرسم
setcolor(YELLOW); // اللون تحديد دالة
rectangle(40,70,410,290); // المستطيل رسم دالة
setfillstyle(SOLID_FILL,YELLOW); // ونوع اللون تعبئة نمط دالة
اللون
floodfill(200,200,YELLOW); // المحدد باللون الشكل ملئ دالة
getch();
}
12. make a circle in c++
#include<graphics.h>
using namespace std;
main()
{
initwindow(500,500);
circle(200,200,100);
getch();
}
13. Change the color of the circle
#include<graphics.h>
using namespace std;
main()
{
initwindow(500,500);
setcolor(LIGHTMAGENTA);
circle(200,200,100);
setfillstyle(SOLID_FILL,LIGHTMAGENTA);
floodfill(200,200, LIGHTMAGENTA);
getch();
}
14. Below is the table showing INT VALUES corresponding to Colors :
COLOR INT VALUES
BLACK 0
BLUE 1
GREEN 2
CYAN 3
RED 4
MAGENTA 5
BROWN 6
LIGHTGRAY 7
DARKGRAY 8
LIGHTBLUE 9
LIGHTGREEN 10
LIGHTCYAN 11
LIGHTRED 12
LIGHTMAGENTA 13
YELLOW 14
WHITE 15
23. Code Moving Car Animation.
/* Draw Car */
setcolor(YELLOW);
setfillstyle(SOLID_FILL, RED);
line(i, midy + 23, i, midy);
line(i, midy, 40 + i, midy - 20);
line(40 + i, midy - 20, 80 + i, midy - 20);
line(80 + i, midy - 20, 100 + i, midy);
line(100 + i, midy, 120 + i, midy);
line(120 + i, midy, 120 + i, midy + 23);
line(0 + i, midy + 23, 18 + i, midy + 23);
arc(30 + i, midy + 23, 0, 180, 12);
line(42 + i, midy + 23, 78 + i, midy + 23);
arc(90 + i, midy + 23, 0, 180, 12);
line(102 + i, midy + 23, 120 + i, midy + 23);
line(28 + i, midy, 43 + i, midy - 15);
line(43 + i, midy - 15, 57 + i, midy - 15);
line(57 + i, midy - 15, 57 + i, midy);
line(57 + i, midy, 28 + i, midy);
line(62 + i, midy - 15, 77 + i, midy - 15);
line(77 + i, midy - 15, 92 + i, midy);
line(92 + i, midy, 62 + i, midy);
line(62 + i, midy, 62 + i, midy - 15);
floodfill(5 + i, midy + 22, YELLOW);
setcolor(BLUE);
setfillstyle(SOLID_FILL, DARKGRAY);
24. Code Moving Car Animation.
/* Draw Wheels */
circle(30 + i, midy + 25, 9);
circle(90 + i, midy + 25, 9);
floodfill(30 + i, midy + 25, BLUE);
floodfill(90 + i, midy + 25, BLUE);
delay(100);
}
getch();
closegraph();
}
25. Pie Chart
Pie Chart. (In this program, we'll draw multiple pie slices using pieslice with a
120-pixel radius and different start and end angles. Using setfillstyle, we change
the pie slice fill color.
#include <graphics.h>
#include <conio.h>
int main() {
int gd = DETECT, gm;
initgraph(&gd, &gm, "c:Turboc3BGI");
int x,y;
settextstyle(BOLD_FONT,HORIZ_DIR,2);
outtextxy(220,10,"PIE CHART");
26. Pie Chart
//Setting cordinate of center of circle
x = getmaxx()/2;
y = getmaxy()/2;
settextstyle(SANS_SERIF_FONT,HORIZ_DIR,1);
setfillstyle(SOLID_FILL, RED);
pieslice(x, y, 0, 60, 120);
outtextxy(x + 140, y - 70, "FOOD");
setfillstyle(SOLID_FILL, YELLOW);
pieslice(x, y, 60, 160, 120);
outtextxy(x - 30, y - 170, "RENT");
setfillstyle(SOLID_FILL, GREEN);
pieslice(x, y, 160, 220, 120);
outtextxy(x - 250, y, "ELECTRICITY");
setfillstyle(SOLID_FILL, BROWN);
pieslice(x, y, 220, 360, 120);
outtextxy(x, y + 150, "SAVINGS");
getch();
closegraph();
}
27. C++ program to draw the moving
cycle using computer graphics
28. Code cycle using computer graphics
#include <conio.h>
#include <dos.h>
#include <graphics.h>
// Driver code
int main()
{
int gd = DETECT, gm, i, a;
// Path of the program
initgraph(&gd, &gm, "C:TURBOC3BGI");
29. Code cycle using computer graphics
// Move the cycle
for (i = 0; i < 600; i++) {
// Upper body of cycle
line(50 + i, 405, 100 + i, 405);
line(75 + i, 375, 125 + i, 375);
line(50 + i, 405, 75 + i, 375);
line(100 + i, 405, 100 + i, 345);
line(150 + i, 405, 100 + i, 345);
line(75 + i, 345, 75 + i, 370);
line(70 + i, 370, 80 + i, 370);
line(80 + i, 345, 100 + i, 345);
30. Code cycle using computer graphics
// Wheel
circle(150 + i, 405, 30);
circle(50 + i, 405, 30);
// Road
line(0, 436, getmaxx(), 436);
// Stone
rectangle(getmaxx() - i, 436,
650 - i, 431);
// Stop the screen for 10 secs
delay(10);
// Clear the screen
cleardevice();
}
getch();
// Close the graph
closegraph();
}