本文整理汇总了Python中Geometry.distance方法的典型用法代码示例。如果您正苦于以下问题:Python Geometry.distance方法的具体用法?Python Geometry.distance怎么用?Python Geometry.distance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Geometry
的用法示例。
在下文中一共展示了Geometry.distance方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: UpdateLigandAnchorPoint
# 需要导入模块: import Geometry [as 别名]
# 或者: from Geometry import distance [as 别名]
def UpdateLigandAnchorPoint(self):
try:
if self.Translation:
index = int(float(self.Line[self.colNo:self.colNo+10]))
coordX = self.top.GridVertex[index][0] # The atom X coordinate
coordY = self.top.GridVertex[index][1] # The atom Y coordinate
coordZ = self.top.GridVertex[index][2] # The atom Z coordinate
pointA = [coordX, coordY, coordZ]
pointB = [self.top.OriX[0], self.top.OriX[1], self.top.OriX[2]]
pointC = [self.top.Ori[0], self.top.Ori[1], self.top.Ori[2]]
pointD = [self.top.OriY[0], self.top.OriY[1], self.top.OriY[2]]
self.top.DisAngDih[self.top.VarAtoms[0]][0] = Geometry.distance(pointA, pointB)
self.top.DisAngDih[self.top.VarAtoms[0]][1] = Geometry.angle(pointA, pointB, pointC)
self.top.DisAngDih[self.top.VarAtoms[0]][2] = Geometry.dihedralAngle(pointA, pointB, pointC, pointD)
self.colNo += 11
if self.Rotation:
self.top.DisAngDih[self.top.VarAtoms[1]][1] = float(self.Line[self.colNo:self.colNo+10])
self.top.DisAngDih[self.top.VarAtoms[1]][2] = float(self.Line[self.colNo+11:self.colNo+21])
self.top.DisAngDih[self.top.VarAtoms[2]][2] = float(self.Line[self.colNo+22:self.colNo+32])
self.colNo += 33
except:
self.CriticalError(" Could not update ligand anchor point")
return 1
return 0
示例2: collides
# 需要导入模块: import Geometry [as 别名]
# 或者: from Geometry import distance [as 别名]
def collides(self,p):
#print Geometry.distance(self.x,self.y,p.x,p.y), self.r
if Geometry.distance(self.x,self.y,p.x,p.y) < self.r:
p.kill()
return True
else:
return False
示例3: apply
# 需要导入模块: import Geometry [as 别名]
# 或者: from Geometry import distance [as 别名]
def apply(self, particule, dt):
if self.cached and (particule.x, particule.y) in self.cache:
rx, ry = self.cache[(particule.x, particule.y)]
else:
distance = Geometry.distance(particule.x, particule.y, self.x, self.y)
er = (particule.x - self.x) / distance, (particule.y - self.y) / distance
g = - self.intensity / distance ** 2
rx, ry = g * er[0], g * er[1]
self.cache[(particule.x, particule.y)] = (rx,ry)
particule.vx += rx * dt
particule.vy += ry * dt
示例4: __init__
# 需要导入模块: import Geometry [as 别名]
# 或者: from Geometry import distance [as 别名]
def __init__(self, x1, y1, x2, y2, is_a_barrier = False):
self.x1 = x1
self.y1 = y1
self.x2 = x2
self.y2 = y2
self.is_a_barrier = is_a_barrier
if is_a_barrier:
self.shape = sf.Shape.Line(self.x1, self.y1, self.x2, self.y2, 6, sf.Color(100, 0, 0))
else:
self.shape = sf.Shape.Line(self.x1, self.y1, self.x2, self.y2, 4, sf.Color(150, 150, 190))
if Mirror.use_imgs:
self.sprMirror = sf.Sprite(Mirror.img)
self.length = Geometry.distance(x1,y1,x2,y2)
#self.angle = abs(atan((x2-x1)/(self.length)))
#self.angle = atan((x2-x1)/(self.length))
self.angle = atan((x2-x1)/(y2-y1))
self.sprMirror.SetRotation(degrees(self.angle)+90)
#self.sprMirror.SetRotation(45)
self.shape = sf.Shape.Line(self.x1, self.y1, self.x2, self.y2, 2, sf.Color(150, 150, 150))