Geometry Point class Gsoc 14 - gxyd/sympy GitHub Wiki
Point Class(inherits from the entity class):
__new__
It blocks imaginary points and raises an error for points other than 2-D and 3-D
Methods:
Contains methods common to both 2-D and 3-D
x-coordinate
y-coordinate
length
intersection
__add__
__mul__
__div__
__sub__
evalf
Point_2D Class(inherits from the Point class)
__new__
It checks if the point is 2-D then proceeds
Methods:
convert2D to 3D(converts a 2-D point to 3-D point)
Point_3D Class(inherits from the Point class)
__new__
It checks if the point is 3-D then proceeds
Methods:
z-coordinate
are_coplanar
direction_ratios
direction_cosines
Now coming to the methods common to both Point_2D and Point_3D
is_collinear
is_concyclic
mid_point
distance
transform
rotate
These methods are common to both classes but would require a different algorithm to solve. So should i include them individually in their respective classes? or Place it in the Point class like this for example:
def is_collinear(*args):
if any in args is_instance(Point_3D):
implement 3-D algorithm(In this case we have to convert any 2-D points into 3-D)
else:
implement 2-D algorithm