当前位置: 首页>>代码示例>>Python>>正文


Python Vector.threed_cross_product方法代码示例

本文整理汇总了Python中vector.Vector.threed_cross_product方法的典型用法代码示例。如果您正苦于以下问题:Python Vector.threed_cross_product方法的具体用法?Python Vector.threed_cross_product怎么用?Python Vector.threed_cross_product使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vector.Vector的用法示例。


在下文中一共展示了Vector.threed_cross_product方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_cross_product

# 需要导入模块: from vector import Vector [as 别名]
# 或者: from vector.Vector import threed_cross_product [as 别名]
def test_cross_product():
    """Test 3d dimensional cross product of two Vectors"""
    vector1 = Vector([5, 3, -2])
    vector2 = Vector([-1, 0, 3])
    answer = Vector([9, -13, 3])

    cross_product = vector1.threed_cross_product(vector2)
    assert cross_product == answer
    assert cross_product.is_orthogonal(vector1) is True
    assert cross_product.is_orthogonal(vector2) is True
开发者ID:madhavajay,项目名称:ud953,代码行数:12,代码来源:vector_test.py

示例2: test_cross_products

# 需要导入模块: from vector import Vector [as 别名]
# 或者: from vector.Vector import threed_cross_product [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
开发者ID:madhavajay,项目名称:ud953,代码行数:24,代码来源:udacity_test.py


注:本文中的vector.Vector.threed_cross_product方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。