Download presentation
Presentation is loading. Please wait.
Published byAllyson Golden Modified over 9 years ago
1
Our aim is to try and do some 3d graphics in python.
2
We looked at loops, functions and classes. Today we are going to be trying to get a 3d point class working.
3
Talk about 3D and 3d problems Get some really basic 3D code running in python with Pygame (This may not be easy, the code sample I have is for older versions of python and Pygame) If we succeed in this, turn it into a skeleton code using the line function in Pygame.
4
How do we represent things in 3D? Say for instance a wall?
5
Viewpoint, Where we are, Where we are looking.
6
Pygame.draw.polygon() We will use this to draw shapes. Our steps will be draw points, Draw lines, Draw polygon’s
7
If we draw a wireframe version, we don’t have to worry about what’s in front of what. Because that’s hard!
8
Us, turning around. Things we see.
9
New x and y are given by R*Cos(Angle),R*Sin(angle) I’ll draw a diagram.
10
A right way and a wrong way! Hamilton’s walk by the canal Wrong is easier! So we will try wrong initially
11
Wiki page Wiki page Can we see where these come in? We will try and wrap up a lot of the fancy maths inside functions. But to use them we have to have an idea about what is going on inside so we know what we have to feed them.
12
In 3D Add how high to walls, maybe Jelly fish float up or down. Not doing this yet. But:- we could think about this.
13
We try and get the code from the website to run.
14
Start by adding one line and seeing how this works. Then we can try drawing all the sides of the cube and watching it rotate.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.