mirror of
https://github.com/pim-n/pg-rad
synced 2026-02-02 14:33:09 +01:00
Add blank Landscape to which to add Sources and Path
This commit is contained in:
38
src/pg_rad/objects.py
Normal file
38
src/pg_rad/objects.py
Normal file
@ -0,0 +1,38 @@
|
||||
import math
|
||||
from typing import Self
|
||||
|
||||
class Object:
|
||||
def __init__(
|
||||
self,
|
||||
x: float,
|
||||
y: float,
|
||||
z: float,
|
||||
name: str = "Unnamed object",
|
||||
color: str = 'grey'):
|
||||
|
||||
self.x = x
|
||||
self.y = y
|
||||
self.z = z
|
||||
self.name = name
|
||||
self.color = color
|
||||
|
||||
def distance_to(self, other: Self) -> float:
|
||||
return math.dist(
|
||||
(self.x, self.y, self.z),
|
||||
(other.x, other.y, other.z),
|
||||
)
|
||||
|
||||
class Source(Object):
|
||||
def __init__(
|
||||
self,
|
||||
x: float,
|
||||
y: float,
|
||||
z: float,
|
||||
strength: int,
|
||||
name: str = "Unnamed source",
|
||||
color: str = "red"):
|
||||
|
||||
super().__init__(x, y, z, name, color)
|
||||
|
||||
self.strength = strength
|
||||
self.color = color
|
||||
Reference in New Issue
Block a user