Geometry Point class Gsoc 14

Akshay edited this page May 20, 2014 · 1 revision

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

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.