No project description provided
Project description
PG3D
PG3D is a simple 3D graphics library written using Pygame.
Installation
- Install Python 3.7 or newer. https://www.python.org/downloads/
- Open cmd/terminal and type:
pip install pg3d
Dependencies
- python 3.7+
- pygame
Usage
- Import the library
from pg3d import *
- Create an App instance and call the run function
app = App()
#---Code goes here---#
#--------------------#
app.run()
API Reference
App(kwargs):
kwargs:
dimensions=(1000, 700)
cam_pos=[0, 0, 0]
BG_COLOR=(0, 0, 0)
LINE_COLOR=(255, 255, 255)
VERTEX_SIZE=2
stats=False # Show stats on screen
fullscreen=False
mouse_look=False # Use mouse for camera orientation
functions:
run() # Draws all vertices and checks for movement
Model(args)
args:
app # Specify the App() object
path # Specify path of .obj file
Shape(args, kwargs)
args:
app # Specify the App() object
shape # "cube" | "pyramid" | "tetrahedron"
kwargs:
size=1
center=[0, 0, 0]
width=1
Triangle(args)
args:
app # Specify the App() object
vertices # List or tuple with 3 cartesian coordinates
functions:
__getitem__(index) # Returnes indext point of Triangle object
Point(args, kwargs)
args:
app # Specify the App() object
coordinate # A list with a single cartesian coordinate
kwargs:
vertex=True # If true the point is drawn and vice versa
functions:
__repr__() # Prints Point object
__setitem__(index, value) # Sets indexed coordinate of Point object to value
__getitem__(index) # Returns indexed coordinate of Point object
Matrix(args)
args:
matrix # A 2D array
functions:
__repr__() # Prints a Matrix object
__setitem__(index, value) # Sets indexed value of Matrix object to value
__getitem__(index) # Returns value of indexed Matrix object
__rmul__(value) # Returns product of Matrix object and number
__mul__(other) # Multiplies 2 matrices together
__add__(other) # Adds 2 matrices together
__sub__(other) # Subtracts 2 matrices together
transpose() # Transposes Matrix object
determinant() # Finds determinant of Matrix object
inverse() # Finds inverse of Matrix object
is_square() # Checks whether matrix is square or not
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pg3d-0.1.5.tar.gz
(12.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
pg3d-0.1.5-py3-none-any.whl
(14.4 kB
view details)
File details
Details for the file pg3d-0.1.5.tar.gz.
File metadata
- Download URL: pg3d-0.1.5.tar.gz
- Upload date:
- Size: 12.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c81d71ad04066c4a03a8580a05eca14b2b86ce49b5cbc8bd60aec85d35772c3
|
|
| MD5 |
404c2d57174a7a95c63bd9e352849a96
|
|
| BLAKE2b-256 |
6254fc6bef210fa77fa682919574b109941cc038dbfdefcb64a24b8cfff904c1
|
File details
Details for the file pg3d-0.1.5-py3-none-any.whl.
File metadata
- Download URL: pg3d-0.1.5-py3-none-any.whl
- Upload date:
- Size: 14.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f533424af0b0361a208b0a93730d49e3e723b6b26c72de5fbd2f978d5d9e1cf
|
|
| MD5 |
64207384d0851b84fe355c7f04ea5a02
|
|
| BLAKE2b-256 |
1f4e1a7f46d3eabbc0f776646c5a391f590ea7f1e4df2c8d79c396dd194451b0
|