Exemple #1
0
 def __init__(self, j, x, y):
     Point.__init__(self, x, y)
     self.j = j
     self.E = Sensor.eInnit
     self.free = True
     self.moveTime = 0
     self.dieTime = 0
Exemple #2
0
 def get_nearest_location(self, s):
     d = self.get_distance(s)
     if PointClass.compare_leq(d, Point.rs):
         return Point(s.x, s.y)
     x = self.x - Point.rs * (self.x - s.x) / d
     y = self.y - Point.rs * (self.y - s.y) / d
     return Point(x, y)
Exemple #3
0
class Triangle():
    p1 = Point(0, 0)
    p2 = Point(0, 0)
    p3 = Point(0, 0)

    edge12 = False
    edge13 = False
    edge23 = False
    index = 0

    def __init__(self, P1, P2, P3):
        self.p1 = P1
        self.p2 = P2
        self.p3 = P3
Exemple #4
0
from Triangle import Triangle

num = 100

randX = 100 * np.random.rand(num)
randY = 100 * np.random.rand(num)
K = -1
L = -1
PointList = []
t1 = []
t2 = []
t3 = []
triangleList = []

for i in range(0, num):
    p = Point(randX[i], randY[i])
    p.index = i
    PointList.append(p)
    plt.scatter(p.x, p.y)

# 随机选取一个点,找出与之最近的一个点作为初始基线
initPoint = PointList[1]
t1.append(initPoint)

t2.append(PointList[Functions.getIndexOfMinDisPoint(t1[0], PointList)])
plt.plot([t1[0].x, t2[0].x], [t1[0].y, t2[0].y])

# 获取这两个点的中点
middlePoint = Point((t1[0].x + t2[0].x) / 2.0, (t1[0].y + t2[0].y) / 2.0)
# 剩余点到这个中点最小距离的点
t3.append(PointList[Functions.getIndexOfMinDisPointWithIgnoration(
 def center(self, x, y):
     """Puts the center of the circle to the point (x,y)"""
     self.__center = Point(x, y)
 def __init__(self, x=0, y=0, radius=1):  #note default center and radius
     self.__center = Point(x, y)  #MUST be a Point object!
     self.__rayon = radius
Exemple #7
0
 def __init__(self, i, x, y):
     Point.__init__(self, x, y)
     self.i = i
     self.lifeTime = 0