This commit is contained in:
2021-09-06 18:32:02 +02:00
parent a0c7caf727
commit e112ce52e3
17 changed files with 72 additions and 33 deletions

View File

@@ -2,6 +2,9 @@ import pygame.draw
class Circle:
object_type = "nr"
def __init__(self, center, radius, color, scene):
self.center = center
self.radius = radius

View File

@@ -2,6 +2,9 @@ import pygame
class Ellipse:
object_type = "nr"
def __init__(self, center, a, b, color, scene):
self.center = center
self.a = a

View File

@@ -4,6 +4,9 @@ import math
class EquilateralTriangle:
object_type = "nr"
def __init__(self, position, side_length, rotation, color, scene, width=0):
self.position = position
self.side_length = side_length

View File

@@ -5,6 +5,9 @@ import copy
class Image:
object_type = "nr"
def __init__(self, center, scalar, path, scene):
self.center = center
self.scalar = scalar

View File

@@ -2,6 +2,9 @@ import pygame.draw
class Line:
object_type = "nr"
def __init__(self, a, b, width, color, scene):
self.a = a
self.b = b

View File

@@ -2,6 +2,9 @@ import pygame
class Text:
object_type = "nr"
def __init__(self, position, text, font_size, color, scene, font_name="calibri", bold=True):
self.position = position
self.text = text

View File

@@ -3,6 +3,9 @@ import pygame
class RopeInteractiveDot:
object_type = "nr_c"
def __init__(self, position, r, color, force, forcefield_range, scene):
self.position = position
self.r = r
@@ -25,7 +28,8 @@ class RopeInteractiveDot:
if node.locked is False:
if math.sqrt(sum((node.position - self.position) ** 2)) < self.forcefield_range:
force_vector = node.position - self.position
full_force_vector = (force_vector / math.sqrt(sum(force_vector ** 2))) * self.forcefield_range
full_force_vector = (force_vector / math.sqrt(sum(force_vector ** 2))) \
* self.forcefield_range
force_vector = full_force_vector - force_vector
force_vector /= self.forcefield_range / self.force

View File

@@ -5,6 +5,8 @@ import math
class Rope:
object_type = "nr_d_i"
class Node:
def __init__(self, position):
self.position = position