43 views

Uploaded by tomtech999

For our second maths assignment we moved away from Microsoft Excel and used OpenGL to display 3D graphics. However, as use of OpenG’s 3D functionality was forbidden, we had to program each stage of the simple graphics pipeline to allow for a model to be rendered on screen. I also added an importing algorithm which can import .obj models into the application.
This assignment involved implementing algorithms for back face culling, viewport clipping and manipulation of the camera through a “look at” matrix.

save

- Principles of Robot Motion Errata
- Maths 4u 1967 Hsc
- Report Lab1
- Syllabus 2015 - 16 Pcm Cbse
- Part 1 - Introduction to Matlab
- HW1F11Solution
- Brief MatLab Commands
- math40-lect07
- Chapter Two
- set1_new
- (1981)Wind Induced Torsional Loads on Structures
- sec13pt6.pdf
- artinvocab
- AP DSC School Assistant (Mathematics) 2015
- Matrix 1
- IRJET-Design and Development of Automated Weed Seeker and Tracker
- Scilab Assignments
- Design of Machinery, Mathcad, Matlab y Working Model Basic Software Manual.pdf
- Optimization of a Smoke Producer Composition by Experiment Design.pdf
- Math 3 Week 4 Lecture Slides [Compatibility Mode]
- B.C.A.-Sem.1 to 6-(2012-13).PDF
- WebGalbraith Matrix Organizations
- iit jee sllybus
- Non-linear dynamic analysis of oshore jack-up units
- hw1s
- 09ams_AmSlDOc
- An Alternative Approach of Modeling Structures Using Dynamic Stiffness Matrices
- Introduction to Matlab
- Electrostatics
- MATLAB_tutorial.pdf
- Dispatches from Pluto: Lost and Found in the Mississippi Delta
- Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
- The Innovators: How a Group of Hackers, Geniuses, and Geeks Created the Digital Revolution
- Sapiens: A Brief History of Humankind
- The Unwinding: An Inner History of the New America
- Yes Please
- A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
- This Changes Everything: Capitalism vs. The Climate
- Grand Pursuit: The Story of Economic Genius
- The Emperor of All Maladies: A Biography of Cancer
- The Prize: The Epic Quest for Oil, Money & Power
- John Adams
- Devil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New America
- The World Is Flat 3.0: A Brief History of the Twenty-first Century
- Rise of ISIS: A Threat We Can't Ignore
- Smart People Should Build Things: How to Restore Our Culture of Achievement, Build a Path for Entrepreneurs, and Create New Jobs in America
- The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers
- Team of Rivals: The Political Genius of Abraham Lincoln
- The New Confessions of an Economic Hit Man
- How To Win Friends and Influence People
- Steve Jobs
- Angela's Ashes: A Memoir
- Bad Feminist: Essays
- You Too Can Have a Body Like Mine: A Novel
- The Incarnations: A Novel
- The Light Between Oceans: A Novel
- Leaving Berlin: A Novel
- The Silver Linings Playbook: A Novel
- The Sympathizer: A Novel (Pulitzer Prize for Fiction)
- Extremely Loud and Incredibly Close: A Novel
- A Man Called Ove: A Novel
- Bel Canto
- The Master
- We Are Not Ourselves: A Novel
- The First Bad Man: A Novel
- The Rosie Project: A Novel
- The Blazing World: A Novel
- The Flamethrowers: A Novel
- Brooklyn: A Novel
- Life of Pi
- The Love Affairs of Nathaniel P.: A Novel
- The Perks of Being a Wallflower
- The Bonfire of the Vanities: A Novel
- Lovers at the Chameleon Club, Paris 1932: A Novel
- A Prayer for Owen Meany: A Novel
- The Cider House Rules
- Wolf Hall: A Novel
- The Art of Racing in the Rain: A Novel
- The Wallcreeper
- Interpreter of Maladies
- Beautiful Ruins: A Novel
- The Kitchen House: A Novel
- Good in Bed

You are on page 1of 6

[THOMAS SAMPSON, GROUP 2Y, GAMES SOFTWARE DEVELOPMENT]

Maths for Modelling and Rendering Assignment 2 2009

Contents

Question 1 introduction Question 1a (Combined matrix transformation) Question 1b (Resultant vertices) Introducing faces Defining the faces Excel for automation Question 1c (Face normal results table) Hidden surface removal Question 1d (Hypothesis and results)

page 2 page 3 page 3 page 4 page 5 page 5 page 5 page 6 page 6

1

Modelling and Rendering - Assignment 2

[THOMAS SAMPSON, GROUP 2Y, GAMES SOFTWARE DEVELOPMENT]

Question 1

Personal Numbers Variable r = 17 s= 55 t= 33 Derivation

12+5 ( 99/2 ) + 5 ( 84/3 ) + 5

1 1

Octahedron Vertices

F

A = (200,0,0) B = (0,200,0) C = (-200,0,0) D = (0,-200,0) E = (0,0,200) F = (0,0,-200)

B

A C D

Transformation Steps 1. Rotated through 17o about the 𝜒-axis. 2. Translate by (33,0,0). 3. Rotated through 55o about the y-axis. Matrix Multiplication Chain As we are using column vectors, (a requirement of OpenGL) the following matrices are applied from right to left.

E

1

Rounded to nearest whole number

2

Modelling and Rendering - Assignment 2

[THOMAS SAMPSON, GROUP 2Y, GAMES SOFTWARE DEVELOPMENT]

a) Combined matrix transformation To find a combined matrix transformation for the three transformation steps outlined on the previous page, we multiply the matrices in pairs from left to right. So, we find the product of the y-axis rotation and the translation, and then find the product of this result and the x-axis rotation. The final multiplication can be represented as follows.

Resultant Matrix

b) Resultant Vertices

A=( B=( C=( D=( E=( F=(

133.64, -28.97, -95.79, 66.83, -137.74, 175.6,

0, 191.26, 0, -191.26, -58.47, 58.47,

190.86 60.57 -136.8 -6.5 136.73 -82.67

) ) ) ) ) )

3

Modelling and Rendering - Assignment 2

[THOMAS SAMPSON, GROUP 2Y, GAMES SOFTWARE DEVELOPMENT]

Faces For this question I am required to find the normal vectors for each face of my octahedron. The way I will achieve this is to take two vectors along each face. A plane can always be represented by two vectors along the plane, and the cross, or "vector" product of these two vectors gives us the normal to the plane. Example

F

As an example let us take the plane defined by the vertices C F and D. I specify the vertices in this order as we must take vertices in clockwise order when looking at the plane.

C

D

We will also use a clockwise approach to specify our vectors. The two vectors we will take are C→F and F→D.

Working C→F = F - C and F→D = D - F C→F = (175.6+95.79)i + (58.47-0)j +(-82.67+136.8)k C→F = 271.39i + 58.47j + 54.13k F→D = (66.83-175.6)i + (-191.26-58.47)j + (-6.5+82.67)k F→D = -108.77i + -249.73j 76.17k Let a = C→F and b= F→D Normal to the plane = a X b ("a cross b" or "the vector product of a and b") Unit Normal to the plane CFD = 0.26i -0.38j - 0.89k

4

Modelling and Rendering - Assignment 2

[THOMAS SAMPSON, GROUP 2Y, GAMES SOFTWARE DEVELOPMENT]

Defining the faces The octahedron has 8 faces which in our example can be described by the following vertices. FACE 1 FACE 2 FACE 3 FACE 4 FACE 5 FACE 6 FACE 7 FACE 8 = = = = = = = = FBA FAD FDC FCB EAB EDA ECD EBC

F

B

A C E D

Using excel for automation To save repeating tedious calculations by hand which may result in a loss of accuracy, I have constructed a unit normal calculator (this can be found on the CD as "unit_normal_calc.xls") to find the unit normals. This spreadsheet simply carries out the vector cross product as described on the previous page, and divides the resulting normal by the modulus of the result to create a unit normal (a normal with a length of 1). c) Face normal results table Face FACE 1 FACE 2 FACE 3 FACE 4 FACE 5 FACE 6 FACE 7 FACE 8 Unit Normal

Screenshot of "unit_norm_calc.xls"

0.645i + 0.721j + 0.253k 0.922i -0.383j + 0.059k 0.259i -0.383j -0.886k -0.017i + 0.721j -0.692k -0.259i + 0.383j + 0.886k 0.017i -0.721j + 0.692k -0.645i -0.721j - 0.253k -0.922i + 0.383j - 0.059k

5

Modelling and Rendering - Assignment 2

[THOMAS SAMPSON, GROUP 2Y, GAMES SOFTWARE DEVELOPMENT]

Hidden surface removal As the octahedron is a convex shape (each line segments joining vertices lies within the object) then the only hidden surface removal we need to deal with is back face culling as no two front facing surfaces will be occluded by one another. To achieve hidden surface removal we simply take two vectors, one joining the centre of projection with a point on the polygon, and the other being the unit normal of the polygon (calculated in the previous question). If the angle between these two vectors is acute (<90) the surface is rendered, otherwise the surface is not rendered. Finding the vector between angles To find the angle between two vectors I will use the following formula 𝑎. 𝑏 = 𝑎 . 𝑏 𝑐𝑜𝑠𝜃 Hence... 𝜃 = 𝑐𝑜𝑠 −1
𝑎

.𝑏 𝑎 .|𝑏|

Finding the polygon to camera vector Finding the vector from the camera to the polygon is a simple calculation. We take a vertex from the polygon (the top 4 faces all share a common vertex, as do the bottom 4) and the position of the camera (0,0,500) and subtract the two (as A→B=B-A). d) Hypothesis and results Attempting to guess the results of these angles is near impossible after the transformations have been applied, but as a maximum 4 faces of an octahedron can ever be visible at one given time, I am hoping this is reflected in my results. Face FACE 1 FACE 2 FACE 3 FACE 4 FACE 5 FACE 6 FACE 7 FACE 8 Unit Normal 0.645i + 0.721j + 0.253k 0.922i -0.383j + 0.059k 0.259i -0.383j -0.886k -0.017i + 0.721j -0.692k -0.259i + 0.383j + 0.886k 0.017i -0.721j + 0.692k -0.645i -0.721j - 0.253k -0.922i + 0.383j - 0.059k

Polygon to Camera Vector

Angle

60.15

o

0.286i+0.1j-0.953k 0.286i+0.1j-0.953k 0.286i+0.1j-0.953k 0.286i+0.1j-0.953k -0.7867i-0.149k-0.925k -0.7867i-0.149k-0.925k -0.7867i-0.149k-0.925k -0.7867i-0.149k-0.925k

Visible? Yes Yes No No No No Yes Yes

73.64o 144.0o 126.34o 123.38o 116.52o 46.06o 53.79o

6

- Principles of Robot Motion ErrataUploaded bySubhransu Mishra
- Maths 4u 1967 HscUploaded byKingom 885
- Report Lab1Uploaded byNguyen Van Sinh
- Syllabus 2015 - 16 Pcm CbseUploaded byKunalKaushik
- Part 1 - Introduction to MatlabUploaded bynhatthang299
- HW1F11SolutionUploaded byVipin Nair
- Brief MatLab CommandsUploaded byJoshua Duffy
- math40-lect07Uploaded byFrank Lucas Duarte Ozório
- Chapter TwoUploaded byIlcham Lynx
- set1_newUploaded bybikash08146
- (1981)Wind Induced Torsional Loads on StructuresUploaded bylufias2009
- sec13pt6.pdfUploaded bycarolinataringarcia
- artinvocabUploaded byKevinhu827
- AP DSC School Assistant (Mathematics) 2015Uploaded byMruthyunjay
- Matrix 1Uploaded byRachel Flores
- IRJET-Design and Development of Automated Weed Seeker and TrackerUploaded byIRJET Journal
- Scilab AssignmentsUploaded byChandreyee Mukherjee
- Design of Machinery, Mathcad, Matlab y Working Model Basic Software Manual.pdfUploaded byalejandro_baro419
- Optimization of a Smoke Producer Composition by Experiment Design.pdfUploaded bywarrior_2008
- Math 3 Week 4 Lecture Slides [Compatibility Mode]Uploaded byReeve Seah
- B.C.A.-Sem.1 to 6-(2012-13).PDFUploaded byshilpashree
- WebGalbraith Matrix OrganizationsUploaded byArun Mahapatro
- iit jee sllybusUploaded bye
- Non-linear dynamic analysis of oshore jack-up unitsUploaded bySankar Cdm
- hw1sUploaded byGunvir Singh
- 09ams_AmSlDOcUploaded byPaul Dremyn
- An Alternative Approach of Modeling Structures Using Dynamic Stiffness MatricesUploaded byWladimir Gonzalez Velez
- Introduction to MatlabUploaded byArianto
- ElectrostaticsUploaded byDadi Aziz
- MATLAB_tutorial.pdfUploaded byGovind Gaurav