Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def asymptote(self, x='x', y='y', equation=False, _slope=None):
- x0 = self.center.x
- y0 = self.center.y
- a = self.hradius
- b = self.vradius
- c = self.focus_distance
- x = self.directrix()[0]
- if _slope:
- k1 = (b + a * tan(_slope)) / (a - b * tan(_slope))
- k2 = (-b + a * tan(_slope)) / (a + b * tan(_slope))
- eq1 = y0 - k1 * (x - x0)
- eq2 = y0 + k2 * (x - x0)
- else:
- eq1 = y0 + (b / a) * (x - x0)
- eq2 = y0 - (b / a) * (x - x0)
- if equation:
- x = Symbol('x')
- y = Symbol('x')
- return Eq(y, eq1), Eq(y, eq2)
- else:
- return eq1, eq2
- def directrix(self, _x='x', _y='y', equation=False, _slope=None):
- x0 = self.center.x
- y0 = self.center.y
- a = self.hradius
- c = self.focus_distance
- if _slope:
- x = self.directrix()[0]
- eq1 = y0 - cot(_slope) * (x - x0) + (a ** 2 / c) * sqrt(1 + cot(_slope))
- eq2 = y0 - cot(_slope) * (x - x0) - (a ** 2 / c) * sqrt(1 + cot(_slope))
- else:
- eq1 = x0 + a ** 2 / c
- eq2 = x0 - a ** 2 / c
- if equation:
- x = Symbol('x')
- y = Symbol('x')
- return (Eq(y, eq1), Eq(y, eq2)) if _slope else (Eq(x, eq1), Eq(x, eq2))
- else:
- return eq1, eq2
Advertisement
Add Comment
Please, Sign In to add comment