本文整理汇总了Python中Geometry.norm方法的典型用法代码示例。如果您正苦于以下问题:Python Geometry.norm方法的具体用法?Python Geometry.norm怎么用?Python Geometry.norm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Geometry
的用法示例。
在下文中一共展示了Geometry.norm方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addPolygon
# 需要导入模块: import Geometry [as 别名]
# 或者: from Geometry import norm [as 别名]
def addPolygon(self, polygon, colour=None):
if not Visualiser.VISUALISER_ON:
return
if isinstance(polygon, geo.Polygon):
if colour == None:
visual.convex(pos=polygon.pts, color=geo.norm([0.1,0.1,0.1]), material=visual.materials.plastic)
else:
visual.convex(pos=convex.points, color=geo.norm(colour), opacity=0.5)
示例2: addConvex
# 需要导入模块: import Geometry [as 别名]
# 或者: from Geometry import norm [as 别名]
def addConvex(self, convex, colour=None):
"""docstring for addConvex"""
if not Visualiser.VISUALISER_ON:
return
if isinstance(convex, geo.Convex):
if colour == None:
print "Color is none"
visual.convex(pos=polygon.pts, color=geo.norm([0.1,0.1,0.1]), material=visual.materials.plastic)
else:
import pdb; pdb.set_trace()
print "Colour is", geo.norm(colour)
visual.convex(pos=convex.points, color=geo.norm(colour), material=visual.materials.plastic)
示例3: addLine
# 需要导入模块: import Geometry [as 别名]
# 或者: from Geometry import norm [as 别名]
def addLine(self, start, stop, colour=None):
if not Visualiser.VISUALISER_ON:
return
if colour == None:
colour = visual.color.white
axis = np.array(stop) - np.array(start)
visual.cylinder(pos=start, axis=axis, radius=0.0001, color=geo.norm(colour))
示例4: addRay
# 需要导入模块: import Geometry [as 别名]
# 或者: from Geometry import norm [as 别名]
def addRay(self, ray, colour=None):
if not Visualiser.VISUALISER_ON:
return
if isinstance(ray, geo.Ray):
if colour == None:
colour = visual.color.white
pos = ray.position
axis = ray.direction * 5
visual.cylinder(pos=pos, axis=axis, radius=0.0001, color=geo.norm(colour))
示例5: addSphere
# 需要导入模块: import Geometry [as 别名]
# 或者: from Geometry import norm [as 别名]
def addSphere(self, sphere, colour=None, opacity=1., material=None):
"""docstring for addSphere"""
if not Visualiser.VISUALISER_ON:
return
if isinstance(sphere, geo.Sphere):
if colour == None:
colour = visual.color.red
if np.allclose(np.array(colour), np.array([0,0,0])):
visual.sphere(pos=sphere.centre, radius=sphere.radius, opacity=opacity, material=material)
else:
visual.sphere(pos=sphere.centre, radius=sphere.radius, color=geo.norm(colour), opacity=opacity, material=material)
示例6: addBox
# 需要导入模块: import Geometry [as 别名]
# 或者: from Geometry import norm [as 别名]
def addBox(self, box, colour=None):
if not Visualiser.VISUALISER_ON:
return
if isinstance(box, geo.Box):
if colour == None:
colour = visual.color.red
org = geo.transform_point(box.origin, box.transform)
ext = geo.transform_point(box.extent, box.transform)
print "Visualiser: box origin=%s, extent=%s" % (str(org), str(ext))
size = np.abs(ext - org)
pos = org + 0.5*size
print "Visualiser: box position=%s, size=%s" % (str(pos), str(size))
angle, direction, point = tf.rotation_from_matrix(box.transform)
print "colour,", colour
if colour == [0,0,0]:
visual.box(pos=pos, size=size, opacity=0.3, material=visual.materials.plastic)
else:
visual.box(pos=pos, size=size, color=geo.norm(colour), opacity=0.5)
示例7: addSmallSphere
# 需要导入模块: import Geometry [as 别名]
# 或者: from Geometry import norm [as 别名]
def addSmallSphere(self, point, colour=None):
if not Visualiser.VISUALISER_ON:
return
if colour == None:
colour = visual.color.blue
visual.sphere(pos=point, radius=0.00012, color=geo.norm(colour))