Skip to main content

No project description provided

Project description

PG3D

PG3D is a simple 3D graphics library written using Pygame.

Installation


  1. Install Python 3.7 or newer. https://www.python.org/downloads/
  2. Open cmd/terminal and type:
pip install pg3d

Dependencies


  • python 3.7+
  • pygame

Usage


  1. Import the library
from pg3d import *
  1. 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


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.1.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pg3d-0.1.1-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file pg3d-0.1.1.tar.gz.

File metadata

  • Download URL: pg3d-0.1.1.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for pg3d-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e718cf54f198dcc7b7c5eb12d6cfa889427a5cd6c3be4f45046892b46eecd9d7
MD5 e63ffc5d611ac6cac38e7f0c88e4d6a7
BLAKE2b-256 d0794a7bf89641204fb9b59c4b4cc7becbd9f9ce999f79e45de860cb13d3a607

See more details on using hashes here.

File details

Details for the file pg3d-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pg3d-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for pg3d-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d2a596c4a07f046f6d19a93740160695e268760d1e648a312853de49581f216e
MD5 8c9fe78e0b1707bee51977b51b90b379
BLAKE2b-256 ebe471faa6eeaccf89faeae7dfd5c4f0aa8eb03884639eb3e91a261f9e3b45e7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page