本文整理汇总了Python中Point.Point.y方法的典型用法代码示例。如果您正苦于以下问题:Python Point.y方法的具体用法?Python Point.y怎么用?Python Point.y使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point.Point
的用法示例。
在下文中一共展示了Point.y方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: calcMotionEnergy
# 需要导入模块: from Point import Point [as 别名]
# 或者: from Point.Point import y [as 别名]
def calcMotionEnergy(self):
n = len(self.points)
l = 3
speed = []
for i in range(0,n-l-1):
a,b = self.points[i].getCoords()
dx = dy = 0
for j in range(l):
index = i+j+1
c,d = self.points[i+l+1].getCoords()
dx = dx + c - a
dy = dy + d - b
dx = dx/l
dy = dy/l
d = Point(dx, dy)
speed.append(d)
n = len(speed)
if n == 0:
return 0
e = Point(0, 0)
mx = my = 0
for i in range(0,n):
a,b = speed[i].getCoords()
mx = mx + a
my = my + b
mx = mx/n
my = my/n
for i in range(0,n):
a,b = speed[i].getCoords()
dx = mx - a
dy = my - b
dx2 = dx*dx
dy2 = dy*dy
e.x = e.x + dx2
e.y = e.y + dy2
print(str(n-1))
e.x = e.x/(n-1)
e.y = e.y/(n-1)
return e.length()
示例2: center
# 需要导入模块: from Point import Point [as 别名]
# 或者: from Point.Point import y [as 别名]
def center(points):
center_point = Point(0,0,0)
for point in points:
center_point.x += point.x
center_point.y += point.y
center_point.x = center_point.x/float(len(points))
center_point.y = center_point.y/float(len(points))
return center_point
示例3: position_at
# 需要导入模块: from Point import Point [as 别名]
# 或者: from Point.Point import y [as 别名]
def position_at(self, time):
dt = time - self.src_time
if dt > 0.0 and self.total_time > 0.0:
ratio = dt / self.total_time
p = Point()
p.x = self.src.x + self.dx * ratio
p.y = self.src.y + self.dy * ratio
return p
else:
return self.src
示例4: Point
# 需要导入模块: from Point import Point [as 别名]
# 或者: from Point.Point import y [as 别名]
from subscriber.srv import *
from Point import Point
from velchange import *
import math
from numpy import matrix
import signal
import sys
# from roboclaw import *
start_time = 1
centerField = Point()
goal = Point()
#hardcoded if vision is untrustworthy
centerField.x = 423
centerField.y = 234
goal.x = 0
goal.y = 234
defensex = 50
globalCounter = 0
dbehind = 20
yNorthThreshold = -30
ySouthThreshold = 15
yNorthOffset = -16
ySouthOffset = 18
goalYOffset = -12
fastMaxSpeed = .9
slowMaxSpeed = .3
maxSpeed = fastMaxSpeed
FIELD_CENTERX = 304