Python: Kann mir jemand beim Programmieren helfen?

Hallo erstmal. Ich bin Anfänger und bräuchte eure Hilfe.

Ich soll mit Raycasting etwas in Python implementieren.

Das ist die Aufgabe:

import math

class Canvas():
  def __init__(self, width, height, background = " "):
    """Initialisation method for the Canvas class"""

  def render(self):
    Rendering method for the raytracer. Renders all objects attached to the canvas.
    Everything is drawn using raycasting. The canvas is positioned at (0.0, 0.0, -1.0) and has the endpoints(-1.0, -1.0, -1.0), (-1.0, 1.0, -1.0), (1.0, 1.0, -1.0), (1.0, -1.0, -1.0).
    The camera is positioned at (0.0, 0.0 , -10.0).
    Rays are send from the camera to the sampling points on the canvas.
    You do not need to implement clipping, backface culling or similar methods.
    Make sure to send one ray per entry in the canvas.
    In addition make sure that only the nearest collision is drawn per ray, i.e. implement z-occlusion.
    The color returned by a given ray is the color of the nearest collison's hit object.
    When no attached object is hit, the color returned for that ray is the background of the canvas.
    Returns the content of the canvas as a string and does *not* print it.

class Sphere():
  def __init__(self, origin, radius, color):
    Initialisation method for Sphere class
    Expects the origin as an arrays in the form of [x, y, z].
    Radius is the radius of the sphere.
    Color is the color the triangle is drawn in.

class Triangle():
  def __init__(self, a, b, c, color):
    Initialisation method for the Triangle class
    Expects points as arrays in the form of [x, y, z]. Color is the color the triangle is drawn in.
Computer, Programm, Programmieren, Programmierung, Informatik, Python
2 Antworten

Meistgelesene Fragen zum Thema Programm