-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPoint.py
More file actions
45 lines (32 loc) · 921 Bytes
/
Point.py
File metadata and controls
45 lines (32 loc) · 921 Bytes
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
40
41
42
43
44
45
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 19 11:53:04 2021
@author: SANDHYA
"""
import math
from Shape import Shape
class Point(Shape):
def __init__(self, X, Y):
self.X = float(X)
self.Y = float(Y)
def init_shape(self, strokeWidth, strokeColor, fillColor):
super().__init__(strokeWidth, strokeColor, fillColor)
def getX(self):
return self.X
def getY(self):
return self.Y
def setX(self, X):
self.X = X
def setY(self, Y):
self.Y = Y
def setPosition(self,X,Y):
self.X = X
self.Y = Y
def distance(self, X, Y):
xpt = (self.X - X) ** 2
ypt = (self.Y - Y) ** 2
dist = math.sqrt(xpt + ypt)
return dist
def toString(self):
ptstr = "Point ("+ str(self.X) + "," + str(self.Y) + ")"
return ptstr