vector math:python的矢量数学实用程序

vectormath的Python项目详细描述


向量路径

Latest PyPI versionMIT licenseTravis CI build statusCode test coverage

python的向量数学实用程序构建在NumPy

为什么

vectormath包提供了一个快速、简单的矢量数学库 利用numpy的实用程序。这允许显式 要创建的几何结构(例如,Vector3Plane) 不需要重新定义底层数组数学。

范围

vectormath包包括Vector3/Vector2Vector3Array/Vector2Array

目标

  • 速度:所有低级操作都依赖于numpy数组。这些都是密密麻麻的, 类型化的,并在c中部分实现的。 利用此速度,在 一次,而不是一个循环。
  • 简单:高级操作是明确和直接的。 程序员、数学家和地质学家应该可以使用这个库。

替代方案

  • NumPy可用于任何数组操作
  • pypi上的许多小库(例如vectors) 实现向量数学运算,但仅使用单个向量构建 记住。

连接

  • properties使用vectormath 作为向量属性的基础框架。

安装

要安装存储库,请确保 pip installed然后运行:

pip install vectormath

对于开发版本:

git clone https://github.com/seequent/vectormath.git
cd vectormath
pip install -e .

示例

此示例简要演示了 Vector3Vector3Array

importnumpyasnpimportvectormathasvmath# Single Vectorsv=vmath.Vector3(5,0,0)v.normalize()print(v)# >> [1, 0, 0]print(v.x)# >> 1.0# VectorArrays are much faster than a for loop over Vectorsv_array=vmath.Vector3Array([[4,0,0],[0,2,0],[0,0,3]])print(v_array.x)# >> [4, 0, 0]print(v_array.length)# >> [4, 2, 3]print(v_array.normalize())# >> [[1, 0, 0], [0, 1, 0], [0, 0, 1]]# Vectors can be accessed individually or in slicesprint(type(v_array[1:]))# >> vectormath.Vector3Arrayprint(type(v_array[2]))# >> vectormath.Vector3# All these classes are just numpy arraysprint(isinstance(v,np.ndarray))# >> Trueprint(type(v_array[1:,1:]))# >> numpy.ndarray

当前版本:v0.2.2

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java如何正确使用JdbcTemplate。用钥匙夹更新?   java如何仅在XML的根元素上声明名称空间   使用Selenium和Java可以实现多少拖放功能   java如何从一棵树构造一棵树而无需递归   java My bubble排序似乎运行了太多次,或者是向后运行   创建bean时发生java错误:没有符合条件的bean,需要一个匹配的bean,但找到了3个   java 安卓 6.0生成错误:找不到包   java从列表中创建具有多个对象类型的arraylist<object[]>   安卓重写sendevent。c从c到Java   java为什么不支持流。最大接受整数。作为输入参数进行比较?   java我能阻止RCP编辑器加载吗   java无法在将来从异常传播自定义异常   java在Android中从PHP获取数据   Java创建具有多个GUI框架的程序   java如何解决枚举或接口预期错误   在java中按从高到低的数字排序bubblesort   C++我不能理解java的普通类库的用法   java将图像发送到另一个应用程序   java为什么maven构建失败并出现错误:“包com.microsoft.jdbc.sqlserver不存在”?   python Spark安装问题,java异常