Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9]
python-version: [3.5, 3.6, 3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v2
Expand Down
32 changes: 17 additions & 15 deletions jieji.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ def plot(self):
y = [self.p2.y_coord , self.p2.y_coord]
plt.plot(x,y)

def create_line (puntoa , puntob):
return Line(puntoa , puntob)
def create_line_segment (puntoa , puntob):
return Line_Segment(puntoa , puntob)

class Math_Vector():
"""2d math vector"""
Expand All @@ -123,39 +123,39 @@ def __init__(self , x , y):
self.y = y

def __add__(self , other):
return Math_Vector ( self.x + other.x , self.y + other.y )
return Math_Vector ( self.x + other.x , self.y + other.y )

def __neg__(self):
return Math_Vector (-self.x , -self.y)
return Math_Vector (-self.x , -self.y)

def __pos__(self):
return self
return self

def __sub__(self , other):
return -self + other
return -self + other

def __mul__(self , other):
if (Is_arithmetic(other)):
return Math_Vector ( self.x * other , self.y * other )
if (Is_arithmetic(other)):
return Math_Vector ( self.x * other , self.y * other )

class Circle():
"""a circle defined by the center and radius"""

def __init__(self , center , radius):
self.center = center
self.radius = radius

def __eq__(self , otro):
"""
note: this only checks if the two are equal in normal geometry terms.
It does not checkif the centers are on the same point.
If you wnat checking against the center, use All_Equal.
"""
return self.radius == otro.radius

def __ne__(self , otro):
return not self == otro

def All_Equal(self , otro):
return self == otro and self.center == otro.center

Expand All @@ -170,23 +170,25 @@ def __str__(self):

class Quadrilateral():
def __init__(self , a , b , c , d):
self.points = [a,b,c,d]
self.points = {a,b,c,d}

def Circumference(self):
a,b,c,d=self.points
return (distance(a,b) + distance(b,c) + distance(c,d) + distance(d,a))

def All_Equal(self , other):
return self.points == other.points

class Triangle():
def __init__(self,a,b,c):
self.points = [a,b,c]
self.points = {a,b,c}

def Sides(self):
a,b,c=self.points
toa = distance(b,c)
tob = distance(a,c)
toc = distance(a,b)
return [toa , tob , toc]
return {toa , tob , toc}

def All_Equal(self , other):
return self.points == other.points
Expand Down