-
Notifications
You must be signed in to change notification settings - Fork 0
/
Parabola.py
39 lines (32 loc) · 876 Bytes
/
Parabola.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from Conic import Conic
import math
import numpy as np
class Parabola(Conic):
def __init__(self, a, angle):
a = self.bringToScale(a)
super().__init__(12*a, 12*a, angle)
self.a = a
def equate(self, x):
root = 4*self.a*x
if root >= 0:
return math.sqrt(root)
return None
def createXCoords(self):
# Create a linspace of XCoords
xCoords = np.arange(0, 24*self.a, 0.005).tolist()
return xCoords
def drawParabola(self):
self.plotCanvas()
def bringToScale(self, a):
if a < 10:
self.scale = 10
return a*10
else:
while a > 100:
a = int(a/10)
return a
print("Enter 'a' and 'angle' one by one")
a = int(input())
angle = float(input())
parabola = Parabola(a, angle)
parabola.drawParabola()