Skip to content

Instantly share code, notes, and snippets.

@scratcheurs25
Last active May 22, 2025 17:03
Show Gist options
  • Save scratcheurs25/9ece46e1f51e798dabb6fcd0a8aa06d5 to your computer and use it in GitHub Desktop.
Save scratcheurs25/9ece46e1f51e798dabb6fcd0a8aa06d5 to your computer and use it in GitHub Desktop.
3d
from math import *
from kandinsky import *
camX = 0
camY = 0
camZ = 0
distanceToScreen = 200
def draw_pixel_3d(x, y, z, color):
global distanceToScreen
if z == 0: # Évite la division par zéro
raise ValueError("La profondeur z ne peut pas être zéro.")
screenX = (x * distanceToScreen) / z
screenY = (y * distanceToScreen) / z
set_pixel(int(screenX), int(screenY), color)
# Exemple d'utilisation
draw_pixel_3d(0, 0, 400, (0, 0, 0))# This comment was added automatically to allow this file to save.
# You'll be able to remove it after adding text to the file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment