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

Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
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
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
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
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 

Recently uploaded (20)

Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
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
 
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
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
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
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 

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.