Good geometry library in python? [closed]
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
Asked by: Ada758 | Posted: 06-12-2021
Perhaps take a look at SymPy.Answered by: Jared676 | Posted: 07-01-2022
I found pyeuclid to be a great simple general purpose euclidean math package. Though the library may not contain exactly the problems that you mentioned, its infrastructure is good enough to make it easy to write these on your own.Answered by: John669 | Posted: 07-01-2022
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.Answered by: William650 | Posted: 07-01-2022
geometry-simple has classes Point Line Plane Movement in ~ 300 lines, using only numpy; take a look.Answered by: Aida160 | Posted: 07-01-2022
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 equationsAnswered by: Miranda464 | Posted: 07-01-2022
Python Wild Magic is another SWIG wrapped code. It is however a gaming library, but you could manipulate the SWIG library file to exclude any undesired graphics stuff from the Python API.Answered by: Michelle669 | Posted: 07-01-2022
python - How do I overlap widgets with the Tkinter pack geometry manager?
I want to put a Canvas with an image in my window, and then I want to pack widgets on top of it, so the Canvas acts as a background. Is it possible to have two states for the pack manager: one for one set of widgets and another for another set?
python - Postgis - How do i check the geometry type before i do an insert
i have a postgres database with millions of rows in it it has a column called geom which contains the boundary of a property. using a python script i am extracting the information from this table and re-inserting it into a new table. when i insert in the new table the script bugs out with the following: Traceback (most recent call last): File "build_parcels.py", line 258, in <module>...
python - How do I use Django to insert a Geometry Field into the database?
class LocationLog(models.Model): user = models.ForeignKey(User) utm = models.GeometryField(spatial_index=True) This is my database model. I would like to insert a row. I want to insert a circle at point -55, 333. With a radius of 10. How can I put this circle into the geometry field? Of course, then I would want to check which circles overlap a given circle. (my select stat...
Help with Windows Geometry in Python
Why are the commands to change the window position before and after sleep(3.00) being ignored? if self.selectedM.get() == 'Bump': W1 = GetSystemMetrics(1) + 200 print W1 w1.wm_geometry("+100+" + str(W1)) w2.wm_geometry("+100+" + str(W1)) w3.wm_geometry("+100+" + str(W1)) w4.wm_geometry("+100+" + str(W1)) self.rvar.set(0) self.rvar2.set(0) ...
python - Parsing MSDN Geometry Data Type
I have a database where one field gives spatial coordinates. I have learned the field is a serialised MSDN geometry Data Type (http://msdn.microsoft.com/en-us/library/bb933973.aspx). I want to access this database from Python and was wandering if anyone knew the format of the Geometry Data Type, or any libraries capable of parsing ...
python - GUI layout using Tk Grid Geometry Manager
Building a small application for personal use with Python and thought I'd try my hand with a little GUI programming using Tkinter. This is the GUI I've created so far: Application doubts: How can I make sure that the three LableFrames - A, B and C in the screenshot - have the same width? (Or rather, have ...
geometry - Integral of a triangle function in python
I have just defined a function which is the integral of a given step function, and now I would like to integrate the triangle function obtained. jerk:1,-1,1-1 The step function correspond of a given list of successive jerk. For getting the triangle function, I have used the formula: a(t)=kt+ac with k the Jerk and ac a con...
python - Is there a GUI design app for the Tkinter / grid geometry?
Closed. This question does not meet Stack Overflow guid...
geometry - Python - Pygame Drawing Angle
I need to draw an angle(in Pygame), given it's 1. Measure of the angle (θ) 2. Endpoints of the base(A & B) Here I know 1. Measure of θ (in radians and degrees) 2. (x,y) of A and B 3. Measure of BC My Question How do I calculate the position of the Co-ordinates(...
python - Convert Point Geometry to list
I have the following script that creates a point geometry. How can I convert this point geometry to a list only containing the coordiantes to look like [258432.79138201929, 1001957.4394514663]? >>> import ogr >>> driver = ogr.GetDriverByName('ESRI Shapefile') >>> pointshp = driver.Open('U:/My Documents/Tool/shp/point.shp', 0) >>> pointlyr = pointshp.GetLayer...