Good geometry library in python? [closed]

2020-01-25 12:46发布

I am looking for a good and well developed library for geometrical manipulations and evaluations in python, like:

  • evaluate the intersection between two lines in 2D and 3D (if present)
  • evaluate the point of intersection between a plane and a line, or the line of intersection between two planes
  • evaluate the minimum distance between a line and a point
  • find the orthonormal to a plane passing through a point
  • rotate, translate, mirror a set of points
  • find the dihedral angle defined by four points

I have a compendium book for all these operations, and I could implement it but unfortunately I have no time, so I would enjoy a library that does it. Most operations are useful for gaming purposes, so I am sure that some of these functionalities can be found in gaming libraries, but I would prefer not to include functionalities (such as graphics) I don't need.

Any suggestions ? Thanks

8条回答
Deceive 欺骗
2楼-- · 2020-01-25 13:14

Shapely is a nice python wrapper around the popular GEOS library.

查看更多
迷人小祖宗
3楼-- · 2020-01-25 13:19
我欲成王,谁敢阻挡
4楼-- · 2020-01-25 13:21

geometry-simple has classes Point Line Plane Movement in ~ 300 lines, using only numpy; take a look.

查看更多
倾城 Initia
5楼-- · 2020-01-25 13:24

Perhaps take a look at SymPy.

查看更多
Emotional °昔
6楼-- · 2020-01-25 13:34

I really want a good answer to this question, and the ones above left me dissatisfied. However, I just came across pythonocc which looks great, apart from lacking good docs and still having some trouble with installation (not yet pypi compatible). The last update was 4 days ago (June 19th, 2011). It wraps OpenCascade which has a ton of geometry and modeling functionality. From the pythonocc website:

pythonOCC is a 3D CAD/CAE/PLM development framework for the Python programming language. It provides features such as advanced topological and geometrical operations, data exchange (STEP, IGES, STL import/export), 2D and 3D meshing, rigid body simulation, parametric modeling.

[EDIT: I've now downloaded pythonocc and began working through some of the examples]

I believe it can perform all of the tasks mentioned, but I found it to be unintuitive to use. It is created almost entirely from SWIG wrappers, and as a result, introspection of the commands becomes difficult.

查看更多
等我变得足够好
7楼-- · 2020-01-25 13:37

You may be interested in Python module SpaceFuncs from OpenOpt project, http://openopt.org

SpaceFuncs is tool for 2D, 3D, N-dimensional geometric modeling with possibilities of parametrized calculations, numerical optimization and solving systems of geometrical equations

查看更多
登录 后发表回答