Hello,
This is more of a note of my findings and also just implicitly
verifying whether I am doing the right thing.
Problem: I want to find whether a point lies on a circle.
I was hoping that like Linear entity objects, the circle/ellipse would
have a contains() method as well. But, contains() in the context of a
circle or ellipse certainly means something else and I see that there
is an encloses() method for that purpose.
So, to do what I want to, this is my plan of action:
- Find the equation of the circle
- Substitute the point's co-ordinates in the above equation and see if
it equates to 0
Circle(Point(0, 0), 1)
x**2 + y**2 - 1
That is not what I expect. Trying out a few other things (restarting
the shell, etc), I finally hit the idea that may be the x and y in the
equation are different objects from the ones I am specifying to
subs(). So:
And I have what I wanted to find
(The same reasoning also applies if I want to use the solve() method
and also to equations of other objects).
Query 1: Is there any reason why we don't have a method for finding
whether a point lies on a circle/ellipse?
Thanks for reading.
Best,
Amit.
This is more of a note of my findings and also just implicitly
verifying whether I am doing the right thing.
Problem: I want to find whether a point lies on a circle.
I was hoping that like Linear entity objects, the circle/ellipse would
have a contains() method as well. But, contains() in the context of a
circle or ellipse certainly means something else and I see that there
is an encloses() method for that purpose.
So, to do what I want to, this is my plan of action:
- Find the equation of the circle
- Substitute the point's co-ordinates in the above equation and see if
it equates to 0
Circle(Point(0, 0), 1)
x**2 + y**2 - 1
That is not what I expect. Trying out a few other things (restarting
the shell, etc), I finally hit the idea that may be the x and y in the
equation are different objects from the ones I am specifying to
subs(). So:
And I have what I wanted to find
(The same reasoning also applies if I want to use the solve() method
and also to equations of other objects).
Query 1: Is there any reason why we don't have a method for finding
whether a point lies on a circle/ellipse?
Thanks for reading.
Best,
Amit.