SlideShare a Scribd company logo
1 of 7
Download to read offline
PRINCIPLES OF
  COMPUTER GRAPHICS

         Instructors :


  RAFFAELE DE AMICIS,
    GIUSEPPE CONTI

Final Project : 3-D Arkonoid


          Student :


 ORUC HUSEYIN GURSOY
1. INTRODUCTION OF THE GAME DARKONOID :

     Darkonoid is the 3-d version of the old game Arkonoid.(3-D
Arkonoid=Darkonoid)

     In Arkonoid you had everything as 2-d objects. Your base was a thick line-
shaped object, ball was circle, items to destroy was rectangles and all of the
movements were in 2-d.

       So in Darkonoid everything is in 3-d. In picture-1 you can see the
difference.




      Picture-1 : Difference of Arkonoid and Darkonoid.

       In Darkonoid every object is typically 6-gon prism, but there is a little
difference in your ball. The ball is modified to make it spehere-like shape. You
can see a general picture of these objects in picture-2

      You can control your base with the mouse, and you can move your point
of view with the keyboard.

      Your mission is to destroy the items which are colored red, green and
blue. Red is 5 points, Blue is 3 points, Green is 1 point.

      The scoreboard and other information is displayed in a seperate window.

      When the game starts the ball will start to move and bounce from the
walls and the items. You must not miss the ball towards youerself. If so you will
loose 1 life and you have 3 lives. If you loose all of them the game is over.
Picture 2.The objects in Darkonoid.

2. THE CLASSES:

      A. Class MATRIX :

Members :
    public int satir; // #rows
    public int sutun; // #columns
    public double[][] sayi; // matrix items

Construction :
     public Matrix(int satir, int sutun)
     public Matrix(Point3D p)

      The class matrix is used for matrix related operations. it has three
members : the number of rows, the number of columns and the array which
holds the matrix's items. It can be created by just giving the row and column or
giving a point. If row and column is given, then an identity matrix is created. If
a point is given, then the matrix form ofthe point is created.

Methods .
      public void sifirla() : makes this matrix identity
      public void Esitle(Matrix e) : makes this matrix equal to e
      public void MultiplyWith(Matrix m) : multiplies with m
      public void transMatrix(double a,double b,double c) : makes this matrix a
translation matrix
      public void scaleMatrix(double sx, double sy, double sz) : makes this
matrix a scaling matrix
      public void rotateAroundY(double theta) : makes this matrix a rotation
matrix
public void rotateMatrixAroundPoint(Point3D p, double theta) : makes this
matrix a rotation around a Point
     public void strToConsole() : writes matrix to console


      B. Class Geometry :

      The class Geometry is the base geometry for all of the objects. Every
object can have its own matrix.

      Every geometry has its own display, applyTtansform, range and coloring
(renk) method.

      C. Class Point3D :

Members :
    public double x;
    public double y;          COORDINATES OF THE POINT
    public double z;

      public double r;
      public double g;        COLOR OF THE POINT
      public double b;

Methods :
     public void renkRandom()      // Random coloring of the point.

      Point3D is the primitive class in the project. Every thing is created from
Point3D. It has the coordinates and the color as the members. The renkRandom
is used for coloring the point randomly.

      D. Class N_gon3D :

Members;
    public int n; // n of Ngon
    public Point3D Points[]; // points of Ngon
    public Point3D center; // center point

Construction
     public N_gon3D(Point3D center, double r1,double r2, int n)
     center : center point
     r1 : radius 1
     r2 : radius 2
     n : n of N_gon3D

      N_gon3D, has a ceter point and set of points which forms the Ngon. It is
constructed by giving n, radius 1, radius 2 and the center pont. So the shape of
the Ngon can be elliptical if r1is not equal to r2. If r1==r2 then it is circular.
E. Class Obj3D :

Members;
    public   N_gon3D alt;
    public   N_gon3D ust;
    public   int n;
    public   double r1;
    public   double r2;
    public   double h;

Construction
     public Obj3D(int n, double r1,double r2, double h)
     h : height of object

      Obj3D is formed by two N_gon3D s. One is placed at the bottom and the
other at the top. h is the range between them.


3. HOW IT WORKS :

      A. Creating The Objects :

       All of the objects are created at the initialization phase. The objects are
first created and moved to their locations. The items are located randomly in
the game volume.

     The ball is also Obj3D but it is modified for transforming it into sphere-like
shape. The center ponts of the N_gon3D at the bottom and the top, are moved
towards outside.

      The game volume and the base are displayed by lines in order to make
the game playable.

    At each mouse movement, the base is moved to the location of the
mouse on its plane.

      B. Main Algorithm :

      At each display following actions are done;
            1: get the ball,
            2: apply its own transformation matrix,
            3: if collision with the walls
                    take back the movement,
                    change the transformation matrix properly,
                    apply new transformation,
            4: if inside an item
                    take back the movement,
                    change the transformation matrix properly,
                    apply new transformation,
            5: if life lost
                    do appropriate actions.
C. Info About Code :

             1. Rage from a plane :

            In this project, the range from a point to a plane is needed to be
calculated for understanding the collision between the objects. The form of this
method is as follows :

double rangeFromPlane(Point3D p, Point3D p1,Point3D p2,Point3D p3)

In order to calculate the range the plane has to be calculated in the form :
ax+by+cz+d=0. This is done by solving an equations system. This system is
shown in picture 3.




     Picture 3. Equation system of the plane. x,y,z are the coordinates of
p1,p2 and p3.


Whe you get a,b,c,d the distance becomes to


If you don't take the absolute value, then you can determine the point is in the
normal's side or not.

             2. Reflection from a plane :

            Some can do this by setting the normal of the wall on one of the
axes, then rotating 180 degrees or scaling with -1 according to that axis and
setting the normal back to the original.(Of course you have to negate the
vector.) There are lots of matrix multiplications in this way.

      However my way is a bit different and faster. It is faster because you
don't need to do lots ofmutrix multiplications.

       Here is the algorithm :

   ●   get the normal of the plane
   ●   get the projection of your vector on the normal and negate it
   ●   add the 2 x result to your vector

       In picture 4 Reflection from a plane is demonstrated.
Picture 4 : Reflection from a plane.

            3. Round-like shaped base :

             In order to increase the playabality of the game, a minor control of
the ball is added to the game.

      If the ball hits the center of the base no change at the direction of the
ball occurs. If it hits far from the center, then the reflection is a bit changed
against the center point. This is shown in picture 5.




      Picture 5 : Reflection from the base.

     This is done with a trick : by just adjusting the normal according to the
range between the center of the base and the hitting point.

            4. Information about other parts :

             The collision detection of the ball and the items, requires a lot of
calculations. In order to avoid this a pre-check of the range is done. First the
range between a point on the ball and one of the center points on the item is
checked. If it is below a value then further check is done. This make the game
run faster.

More Related Content

What's hot

Visual realism -HIDDEN REMOVAL METHODS
Visual realism -HIDDEN REMOVAL METHODSVisual realism -HIDDEN REMOVAL METHODS
Visual realism -HIDDEN REMOVAL METHODSviswaaswaran
 
Functional Programming In Mathematica
Functional Programming In MathematicaFunctional Programming In Mathematica
Functional Programming In MathematicaHossam Karim
 
Area of a square
Area of a squareArea of a square
Area of a squareLozanok
 
Area of a square
Area of a squareArea of a square
Area of a squareLozanok
 
Dilations edmodo 2013 14
Dilations edmodo 2013 14Dilations edmodo 2013 14
Dilations edmodo 2013 14shumwayc
 
Hidden Surface Removal using Z-buffer
Hidden Surface Removal using Z-bufferHidden Surface Removal using Z-buffer
Hidden Surface Removal using Z-bufferRaj Sikarwar
 
Computer Graphics - Hidden Line Removal Algorithm
Computer Graphics - Hidden Line Removal AlgorithmComputer Graphics - Hidden Line Removal Algorithm
Computer Graphics - Hidden Line Removal AlgorithmJyotiraman De
 
3D Graphics
3D Graphics3D Graphics
3D GraphicsViTAly
 
Morphological image processing
Morphological image processingMorphological image processing
Morphological image processingRaghu Kumar
 
morphological image processing
morphological image processingmorphological image processing
morphological image processingJohn Williams
 
Saad alsheekh multi view
Saad alsheekh  multi viewSaad alsheekh  multi view
Saad alsheekh multi viewSaadAlSheekh1
 
Artificial Intelligence- TicTacToe game
Artificial Intelligence- TicTacToe gameArtificial Intelligence- TicTacToe game
Artificial Intelligence- TicTacToe gamemanika kumari
 
Module 4 topic 1 part 1 notes
Module 4 topic 1 part 1 notesModule 4 topic 1 part 1 notes
Module 4 topic 1 part 1 notescauleyc
 

What's hot (19)

Visual realism -HIDDEN REMOVAL METHODS
Visual realism -HIDDEN REMOVAL METHODSVisual realism -HIDDEN REMOVAL METHODS
Visual realism -HIDDEN REMOVAL METHODS
 
Functional Programming In Mathematica
Functional Programming In MathematicaFunctional Programming In Mathematica
Functional Programming In Mathematica
 
Three dimensional concepts - Computer Graphics
Three dimensional concepts - Computer GraphicsThree dimensional concepts - Computer Graphics
Three dimensional concepts - Computer Graphics
 
Area of a square
Area of a squareArea of a square
Area of a square
 
Area of a square
Area of a squareArea of a square
Area of a square
 
Dilations edmodo 2013 14
Dilations edmodo 2013 14Dilations edmodo 2013 14
Dilations edmodo 2013 14
 
Hidden Surface Removal using Z-buffer
Hidden Surface Removal using Z-bufferHidden Surface Removal using Z-buffer
Hidden Surface Removal using Z-buffer
 
Computer Graphics - Hidden Line Removal Algorithm
Computer Graphics - Hidden Line Removal AlgorithmComputer Graphics - Hidden Line Removal Algorithm
Computer Graphics - Hidden Line Removal Algorithm
 
3 d display methods
3 d display methods3 d display methods
3 d display methods
 
testpang
testpangtestpang
testpang
 
Clipping
ClippingClipping
Clipping
 
Morphological operations
Morphological operationsMorphological operations
Morphological operations
 
3D Graphics
3D Graphics3D Graphics
3D Graphics
 
3 d
3 d3 d
3 d
 
Morphological image processing
Morphological image processingMorphological image processing
Morphological image processing
 
morphological image processing
morphological image processingmorphological image processing
morphological image processing
 
Saad alsheekh multi view
Saad alsheekh  multi viewSaad alsheekh  multi view
Saad alsheekh multi view
 
Artificial Intelligence- TicTacToe game
Artificial Intelligence- TicTacToe gameArtificial Intelligence- TicTacToe game
Artificial Intelligence- TicTacToe game
 
Module 4 topic 1 part 1 notes
Module 4 topic 1 part 1 notesModule 4 topic 1 part 1 notes
Module 4 topic 1 part 1 notes
 

Similar to Darkonoid

Beginning direct3d gameprogramming06_firststepstoanimation_20161115_jintaeks
Beginning direct3d gameprogramming06_firststepstoanimation_20161115_jintaeksBeginning direct3d gameprogramming06_firststepstoanimation_20161115_jintaeks
Beginning direct3d gameprogramming06_firststepstoanimation_20161115_jintaeksJinTaek Seo
 
Hi there I am having difficulty in finalizing my Tetris game , below.pdf
Hi there I am having difficulty in finalizing my Tetris game , below.pdfHi there I am having difficulty in finalizing my Tetris game , below.pdf
Hi there I am having difficulty in finalizing my Tetris game , below.pdffonecomp
 
The Day You Finally Use Algebra: A 3D Math Primer
The Day You Finally Use Algebra: A 3D Math PrimerThe Day You Finally Use Algebra: A 3D Math Primer
The Day You Finally Use Algebra: A 3D Math PrimerJanie Clayton
 
Mrongraphs acm-sig-2 (1)
Mrongraphs acm-sig-2 (1)Mrongraphs acm-sig-2 (1)
Mrongraphs acm-sig-2 (1)Nima Sarshar
 
B. SC CSIT Computer Graphics Unit 4 By Tekendra Nath Yogi
B. SC CSIT Computer Graphics Unit 4 By Tekendra Nath YogiB. SC CSIT Computer Graphics Unit 4 By Tekendra Nath Yogi
B. SC CSIT Computer Graphics Unit 4 By Tekendra Nath YogiTekendra Nath Yogi
 
Trident International Graphics Workshop 2014 4/5
Trident International Graphics Workshop 2014 4/5Trident International Graphics Workshop 2014 4/5
Trident International Graphics Workshop 2014 4/5Takao Wada
 
Beginning direct3d gameprogramming10_shaderdetail_20160506_jintaeks
Beginning direct3d gameprogramming10_shaderdetail_20160506_jintaeksBeginning direct3d gameprogramming10_shaderdetail_20160506_jintaeks
Beginning direct3d gameprogramming10_shaderdetail_20160506_jintaeksJinTaek Seo
 
Math426_Project3-1
Math426_Project3-1Math426_Project3-1
Math426_Project3-1Yijun Zhou
 
The N-Dimensional Map Maker Algorithm
The N-Dimensional Map Maker AlgorithmThe N-Dimensional Map Maker Algorithm
The N-Dimensional Map Maker Algorithmijcga
 
3D Reconstruction from Multiple uncalibrated 2D Images of an Object
3D Reconstruction from Multiple uncalibrated 2D Images of an Object3D Reconstruction from Multiple uncalibrated 2D Images of an Object
3D Reconstruction from Multiple uncalibrated 2D Images of an ObjectAnkur Tyagi
 
Essay On Linear Function
Essay On Linear FunctionEssay On Linear Function
Essay On Linear FunctionAngie Lee
 
ACM ICPC 2013 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2013 NEERC (Northeastern European Regional Contest) Problems ReviewACM ICPC 2013 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2013 NEERC (Northeastern European Regional Contest) Problems ReviewRoman Elizarov
 
Exponential-Function.pptx general Mathematics
Exponential-Function.pptx general MathematicsExponential-Function.pptx general Mathematics
Exponential-Function.pptx general MathematicsPrinCess534001
 
03 image transformations_i
03 image transformations_i03 image transformations_i
03 image transformations_iankit_ppt
 

Similar to Darkonoid (20)

Darkonoid
DarkonoidDarkonoid
Darkonoid
 
Beginning direct3d gameprogramming06_firststepstoanimation_20161115_jintaeks
Beginning direct3d gameprogramming06_firststepstoanimation_20161115_jintaeksBeginning direct3d gameprogramming06_firststepstoanimation_20161115_jintaeks
Beginning direct3d gameprogramming06_firststepstoanimation_20161115_jintaeks
 
Hi there I am having difficulty in finalizing my Tetris game , below.pdf
Hi there I am having difficulty in finalizing my Tetris game , below.pdfHi there I am having difficulty in finalizing my Tetris game , below.pdf
Hi there I am having difficulty in finalizing my Tetris game , below.pdf
 
The Day You Finally Use Algebra: A 3D Math Primer
The Day You Finally Use Algebra: A 3D Math PrimerThe Day You Finally Use Algebra: A 3D Math Primer
The Day You Finally Use Algebra: A 3D Math Primer
 
Mrongraphs acm-sig-2 (1)
Mrongraphs acm-sig-2 (1)Mrongraphs acm-sig-2 (1)
Mrongraphs acm-sig-2 (1)
 
B. SC CSIT Computer Graphics Unit 4 By Tekendra Nath Yogi
B. SC CSIT Computer Graphics Unit 4 By Tekendra Nath YogiB. SC CSIT Computer Graphics Unit 4 By Tekendra Nath Yogi
B. SC CSIT Computer Graphics Unit 4 By Tekendra Nath Yogi
 
Trident International Graphics Workshop 2014 4/5
Trident International Graphics Workshop 2014 4/5Trident International Graphics Workshop 2014 4/5
Trident International Graphics Workshop 2014 4/5
 
Beginning direct3d gameprogramming10_shaderdetail_20160506_jintaeks
Beginning direct3d gameprogramming10_shaderdetail_20160506_jintaeksBeginning direct3d gameprogramming10_shaderdetail_20160506_jintaeks
Beginning direct3d gameprogramming10_shaderdetail_20160506_jintaeks
 
Math426_Project3-1
Math426_Project3-1Math426_Project3-1
Math426_Project3-1
 
The N-Dimensional Map Maker Algorithm
The N-Dimensional Map Maker AlgorithmThe N-Dimensional Map Maker Algorithm
The N-Dimensional Map Maker Algorithm
 
3D Reconstruction from Multiple uncalibrated 2D Images of an Object
3D Reconstruction from Multiple uncalibrated 2D Images of an Object3D Reconstruction from Multiple uncalibrated 2D Images of an Object
3D Reconstruction from Multiple uncalibrated 2D Images of an Object
 
Drawing Tools
Drawing ToolsDrawing Tools
Drawing Tools
 
Essay On Linear Function
Essay On Linear FunctionEssay On Linear Function
Essay On Linear Function
 
ACM ICPC 2013 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2013 NEERC (Northeastern European Regional Contest) Problems ReviewACM ICPC 2013 NEERC (Northeastern European Regional Contest) Problems Review
ACM ICPC 2013 NEERC (Northeastern European Regional Contest) Problems Review
 
Exponential-Function.pptx general Mathematics
Exponential-Function.pptx general MathematicsExponential-Function.pptx general Mathematics
Exponential-Function.pptx general Mathematics
 
Image segmentation
Image segmentationImage segmentation
Image segmentation
 
dreamon
dreamondreamon
dreamon
 
03 image transformations_i
03 image transformations_i03 image transformations_i
03 image transformations_i
 
Report
ReportReport
Report
 
algorithm Unit 3
algorithm Unit 3algorithm Unit 3
algorithm Unit 3
 

More from graphitech

A graphic library and an application for simple curve manipolation
A graphic library and an application for simple curve manipolationA graphic library and an application for simple curve manipolation
A graphic library and an application for simple curve manipolationgraphitech
 
A graphic library and an application for simple curve manipolation
A graphic library and an application for simple curve manipolationA graphic library and an application for simple curve manipolation
A graphic library and an application for simple curve manipolationgraphitech
 
A graphic library and an application for simple curve manipolation
A graphic library and an application for simple curve manipolationA graphic library and an application for simple curve manipolation
A graphic library and an application for simple curve manipolationgraphitech
 
A graphic library and an application for simple curve manipolation
A graphic library and an application for simple curve manipolationA graphic library and an application for simple curve manipolation
A graphic library and an application for simple curve manipolationgraphitech
 
Rescue Mission
Rescue MissionRescue Mission
Rescue Missiongraphitech
 
Rescue Mission
Rescue MissionRescue Mission
Rescue Missiongraphitech
 
Mashup - Sustainability
Mashup - SustainabilityMashup - Sustainability
Mashup - Sustainabilitygraphitech
 
Mashup - Sustainability
Mashup - SustainabilityMashup - Sustainability
Mashup - Sustainabilitygraphitech
 
Multiple Screens
Multiple ScreensMultiple Screens
Multiple Screensgraphitech
 
Multiple Screens
Multiple ScreensMultiple Screens
Multiple Screensgraphitech
 
Graph Matching
Graph MatchingGraph Matching
Graph Matchinggraphitech
 
Shape Analysis
Shape AnalysisShape Analysis
Shape Analysisgraphitech
 
Human Interaction Library
Human Interaction LibraryHuman Interaction Library
Human Interaction Librarygraphitech
 
Human Interaction Library
Human Interaction LibraryHuman Interaction Library
Human Interaction Librarygraphitech
 
WebCams Mapping on Nasa World Wind
WebCams Mapping on Nasa World WindWebCams Mapping on Nasa World Wind
WebCams Mapping on Nasa World Windgraphitech
 
Street Builder
Street BuilderStreet Builder
Street Buildergraphitech
 
Street Builder
Street BuilderStreet Builder
Street Buildergraphitech
 
Live Video in World Wind
Live Video in World WindLive Video in World Wind
Live Video in World Windgraphitech
 
Live Video in World Wind
Live Video in World WindLive Video in World Wind
Live Video in World Windgraphitech
 
Terrain Modification
Terrain ModificationTerrain Modification
Terrain Modificationgraphitech
 

More from graphitech (20)

A graphic library and an application for simple curve manipolation
A graphic library and an application for simple curve manipolationA graphic library and an application for simple curve manipolation
A graphic library and an application for simple curve manipolation
 
A graphic library and an application for simple curve manipolation
A graphic library and an application for simple curve manipolationA graphic library and an application for simple curve manipolation
A graphic library and an application for simple curve manipolation
 
A graphic library and an application for simple curve manipolation
A graphic library and an application for simple curve manipolationA graphic library and an application for simple curve manipolation
A graphic library and an application for simple curve manipolation
 
A graphic library and an application for simple curve manipolation
A graphic library and an application for simple curve manipolationA graphic library and an application for simple curve manipolation
A graphic library and an application for simple curve manipolation
 
Rescue Mission
Rescue MissionRescue Mission
Rescue Mission
 
Rescue Mission
Rescue MissionRescue Mission
Rescue Mission
 
Mashup - Sustainability
Mashup - SustainabilityMashup - Sustainability
Mashup - Sustainability
 
Mashup - Sustainability
Mashup - SustainabilityMashup - Sustainability
Mashup - Sustainability
 
Multiple Screens
Multiple ScreensMultiple Screens
Multiple Screens
 
Multiple Screens
Multiple ScreensMultiple Screens
Multiple Screens
 
Graph Matching
Graph MatchingGraph Matching
Graph Matching
 
Shape Analysis
Shape AnalysisShape Analysis
Shape Analysis
 
Human Interaction Library
Human Interaction LibraryHuman Interaction Library
Human Interaction Library
 
Human Interaction Library
Human Interaction LibraryHuman Interaction Library
Human Interaction Library
 
WebCams Mapping on Nasa World Wind
WebCams Mapping on Nasa World WindWebCams Mapping on Nasa World Wind
WebCams Mapping on Nasa World Wind
 
Street Builder
Street BuilderStreet Builder
Street Builder
 
Street Builder
Street BuilderStreet Builder
Street Builder
 
Live Video in World Wind
Live Video in World WindLive Video in World Wind
Live Video in World Wind
 
Live Video in World Wind
Live Video in World WindLive Video in World Wind
Live Video in World Wind
 
Terrain Modification
Terrain ModificationTerrain Modification
Terrain Modification
 

Recently uploaded

IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...PsychoTech Services
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 

Recently uploaded (20)

IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 

Darkonoid

  • 1. PRINCIPLES OF COMPUTER GRAPHICS Instructors : RAFFAELE DE AMICIS, GIUSEPPE CONTI Final Project : 3-D Arkonoid Student : ORUC HUSEYIN GURSOY
  • 2. 1. INTRODUCTION OF THE GAME DARKONOID : Darkonoid is the 3-d version of the old game Arkonoid.(3-D Arkonoid=Darkonoid) In Arkonoid you had everything as 2-d objects. Your base was a thick line- shaped object, ball was circle, items to destroy was rectangles and all of the movements were in 2-d. So in Darkonoid everything is in 3-d. In picture-1 you can see the difference. Picture-1 : Difference of Arkonoid and Darkonoid. In Darkonoid every object is typically 6-gon prism, but there is a little difference in your ball. The ball is modified to make it spehere-like shape. You can see a general picture of these objects in picture-2 You can control your base with the mouse, and you can move your point of view with the keyboard. Your mission is to destroy the items which are colored red, green and blue. Red is 5 points, Blue is 3 points, Green is 1 point. The scoreboard and other information is displayed in a seperate window. When the game starts the ball will start to move and bounce from the walls and the items. You must not miss the ball towards youerself. If so you will loose 1 life and you have 3 lives. If you loose all of them the game is over.
  • 3. Picture 2.The objects in Darkonoid. 2. THE CLASSES: A. Class MATRIX : Members : public int satir; // #rows public int sutun; // #columns public double[][] sayi; // matrix items Construction : public Matrix(int satir, int sutun) public Matrix(Point3D p) The class matrix is used for matrix related operations. it has three members : the number of rows, the number of columns and the array which holds the matrix's items. It can be created by just giving the row and column or giving a point. If row and column is given, then an identity matrix is created. If a point is given, then the matrix form ofthe point is created. Methods . public void sifirla() : makes this matrix identity public void Esitle(Matrix e) : makes this matrix equal to e public void MultiplyWith(Matrix m) : multiplies with m public void transMatrix(double a,double b,double c) : makes this matrix a translation matrix public void scaleMatrix(double sx, double sy, double sz) : makes this matrix a scaling matrix public void rotateAroundY(double theta) : makes this matrix a rotation matrix
  • 4. public void rotateMatrixAroundPoint(Point3D p, double theta) : makes this matrix a rotation around a Point public void strToConsole() : writes matrix to console B. Class Geometry : The class Geometry is the base geometry for all of the objects. Every object can have its own matrix. Every geometry has its own display, applyTtansform, range and coloring (renk) method. C. Class Point3D : Members : public double x; public double y; COORDINATES OF THE POINT public double z; public double r; public double g; COLOR OF THE POINT public double b; Methods : public void renkRandom() // Random coloring of the point. Point3D is the primitive class in the project. Every thing is created from Point3D. It has the coordinates and the color as the members. The renkRandom is used for coloring the point randomly. D. Class N_gon3D : Members; public int n; // n of Ngon public Point3D Points[]; // points of Ngon public Point3D center; // center point Construction public N_gon3D(Point3D center, double r1,double r2, int n) center : center point r1 : radius 1 r2 : radius 2 n : n of N_gon3D N_gon3D, has a ceter point and set of points which forms the Ngon. It is constructed by giving n, radius 1, radius 2 and the center pont. So the shape of the Ngon can be elliptical if r1is not equal to r2. If r1==r2 then it is circular.
  • 5. E. Class Obj3D : Members; public N_gon3D alt; public N_gon3D ust; public int n; public double r1; public double r2; public double h; Construction public Obj3D(int n, double r1,double r2, double h) h : height of object Obj3D is formed by two N_gon3D s. One is placed at the bottom and the other at the top. h is the range between them. 3. HOW IT WORKS : A. Creating The Objects : All of the objects are created at the initialization phase. The objects are first created and moved to their locations. The items are located randomly in the game volume. The ball is also Obj3D but it is modified for transforming it into sphere-like shape. The center ponts of the N_gon3D at the bottom and the top, are moved towards outside. The game volume and the base are displayed by lines in order to make the game playable. At each mouse movement, the base is moved to the location of the mouse on its plane. B. Main Algorithm : At each display following actions are done; 1: get the ball, 2: apply its own transformation matrix, 3: if collision with the walls take back the movement, change the transformation matrix properly, apply new transformation, 4: if inside an item take back the movement, change the transformation matrix properly, apply new transformation, 5: if life lost do appropriate actions.
  • 6. C. Info About Code : 1. Rage from a plane : In this project, the range from a point to a plane is needed to be calculated for understanding the collision between the objects. The form of this method is as follows : double rangeFromPlane(Point3D p, Point3D p1,Point3D p2,Point3D p3) In order to calculate the range the plane has to be calculated in the form : ax+by+cz+d=0. This is done by solving an equations system. This system is shown in picture 3. Picture 3. Equation system of the plane. x,y,z are the coordinates of p1,p2 and p3. Whe you get a,b,c,d the distance becomes to If you don't take the absolute value, then you can determine the point is in the normal's side or not. 2. Reflection from a plane : Some can do this by setting the normal of the wall on one of the axes, then rotating 180 degrees or scaling with -1 according to that axis and setting the normal back to the original.(Of course you have to negate the vector.) There are lots of matrix multiplications in this way. However my way is a bit different and faster. It is faster because you don't need to do lots ofmutrix multiplications. Here is the algorithm : ● get the normal of the plane ● get the projection of your vector on the normal and negate it ● add the 2 x result to your vector In picture 4 Reflection from a plane is demonstrated.
  • 7. Picture 4 : Reflection from a plane. 3. Round-like shaped base : In order to increase the playabality of the game, a minor control of the ball is added to the game. If the ball hits the center of the base no change at the direction of the ball occurs. If it hits far from the center, then the reflection is a bit changed against the center point. This is shown in picture 5. Picture 5 : Reflection from the base. This is done with a trick : by just adjusting the normal according to the range between the center of the base and the hitting point. 4. Information about other parts : The collision detection of the ball and the items, requires a lot of calculations. In order to avoid this a pre-check of the range is done. First the range between a point on the ball and one of the center points on the item is checked. If it is below a value then further check is done. This make the game run faster.