本文整理汇总了Python中vector.Vector.threed_triangle_area方法的典型用法代码示例。如果您正苦于以下问题:Python Vector.threed_triangle_area方法的具体用法?Python Vector.threed_triangle_area怎么用?Python Vector.threed_triangle_area使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vector.Vector
的用法示例。
在下文中一共展示了Vector.threed_triangle_area方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_triangle_area
# 需要导入模块: from vector import Vector [as 别名]
# 或者: from vector.Vector import threed_triangle_area [as 别名]
def test_triangle_area():
"""Test calculate the area of triangle of two 3d Vectors"""
vector1 = Vector([5, 3, -2])
vector2 = Vector([-1, 0, 3])
answer = Decimal('8.047')
area = round(vector1.threed_triangle_area(vector2), 3)
assert area == answer
示例2: test_cross_products
# 需要导入模块: from vector import Vector [as 别名]
# 或者: from vector.Vector import threed_triangle_area [as 别名]
def test_cross_products():
"""Quiz 6 cross products"""
vector1 = Vector([8.462, 7.893, -8.187])
vector2 = Vector([6.984, -5.975, 4.778])
answer1 = Vector([-11.205, -97.609, -105.685]).round_coords(3)
cross_product = vector1.threed_cross_product(vector2).round_coords(3)
assert cross_product == answer1
vector3 = Vector([-8.987, -9.838, 5.031])
vector4 = Vector([-4.268, -1.861, -8.866])
answer2 = Decimal('142.122')
parallelogram_area = round(vector3.threed_parallelogram_area(vector4), 3)
assert parallelogram_area == answer2
vector5 = Vector([1.5, 9.547, 3.691])
vector6 = Vector([-6.007, 0.124, 5.772])
answer3 = Decimal('42.565')
triangle_area = round(vector5.threed_triangle_area(vector6), 3)
assert triangle_area == answer3