{ "info": { "author": "", "author_email": "", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Science/Research", "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Topic :: Multimedia :: Graphics :: 3D Modeling", "Topic :: Scientific/Engineering :: Mathematics" ], "description": "\n# ![Splipy Logo](https://github.com/sintefmath/Splipy/tree/master/images/logo_small.svg) SpliPy\n\nThis repository contains the SpliPy packages. SpliPy is a pure python library\nfor the creation, evaluation and manipulation of B-spline and NURBS geometries.\nIt supports n-variate splines of any dimension, but emphasis is made on the\nuse of curves, surfaces and volumes. The library is designed primarily for\nanalysis use, and therefore allows fine-grained control over many aspects which\nis not possible to achieve with conventional CAD tools.\n\n## Features\n\nSpliPy allows for the generation of parametric curves, surfaces and volumes in the form of non-uniform rational B-splines (NURBS). It supports traditional curve- and surface-fitting methods such as (but not limited to)\n\n### Curve fitting\n* Bezier curves\n* Hermite Interpolation\n* Cubic Curve Interpolation\n* B-spline Interpolation\n* Least Square Fit\n\n### Surface operations\n* Sweep\n* Revolve\n* Loft\n* Edge_Curves (interior from four edges)\n* Extrude\n* Structured Point Cloud Interpolation\n* Least Square Fit\n\n **Revolve**\n![Revolve](https://github.com/sintefmath/Splipy/tree/master/images/revolve.png)\n\n**Sweep**\n![Sweep](https://github.com/sintefmath/Splipy/tree/master/images/sweep.png)\n\n**Loft**\n![Loft](https://github.com/sintefmath/Splipy/tree/master/images/loft.png)\n\n### Volume operations\n* Revolve\n* Extrude\n* Loft\n* Structured Point Cloud Interpolation\n* Least Square Fit\n\nIn addition to these basic building blocks, it also supports a number of primitive shapes such as (but not limited to)\n\n### Primitive shapes\n* Cube\n* Circle\n* Disc\n* Cylinder\n* Torus\n* Teapot\n\n## Examples\n\n### Derivatives of spline curves\n``` python\n from splipy import *\n import numpy as np\n\n n = 250 # number of evaluation points\n c = curve_factory.circle() # create the NURBS circle (r=1)\n t = np.linspace(c.start(0), c.end(0), n) # parametric evaluation points\n x = c(t) # physical (x,y)-coordinates, size (n,2)\n v = c.derivative(t, 1) # velocity at all points\n a = c.derivative(t, 2) # acceleration at all points\n```\n\n![Missing circle animation](http://i.imgur.com/8MaBiTW.gif \"Circle animation\")\n\n### Curve fitting\nLissajous curves are a family of parametric curves of the type\n\n```\nx = A sin(at+d)\ny = B sin(bt)\n```\n\nMore info: [https://en.wikipedia.org/wiki/Lissajous_curve](https://en.wikipedia.org/wiki/Lissajous_curve). Stripping the [animation parts of the code](https://github.com/sintefmath/Splipy/blob/master/examples/lissajous.py), one can generate these curves in the following way\n\n\n``` python\nfrom splipy import *\nimport numpy as np\nfrom fractions import gcd\n\ndef lissajous(a, b, d):\n # request a,b integers, so we have closed, periodic curves\n n = np.gcd(a,b)\n N = (a/n) * (b/n) # number of periods before looping\n\n # compute a set of interpolation points\n numb_pts = max(3*N, 100) # using 3N interpolation points is decent enough\n t = np.linspace(0,2*np.pi/n, numb_pts)\n x = np.array([np.sin(a*t + d), np.sin(b*t)])\n\n# do a cubic curve interpolation with periodic boundary conditions\nmy_curve = curve_factory.cubic_curve(x.T, curve_factory.Boundary.PERIODIC)\n```\n\n![Missing Lissajous curve animation](http://i.imgur.com/HKr59BT.gif \"lissajous(3,4,pi/2)\")\n\nAnimation of the lissajous curve with a=3, b=4 and d=pi/2\n\n### Surface Sweep\n\nThis produces the trefoil knot shown above\n\n``` python\nfrom splipy import *\nfrom numpy import pi,cos,sin,transpose,array,sqrt\n\n# define a parametric representation of the trefoil knot (to be sampled)\ndef trefoil(u):\n x = [41*cos(u) - 18*sin( u) - 83*cos(2*u) - 83*sin(2*u) - 11*cos(3*u) + 27*sin(3*u),\n 36*cos(u) + 27*sin( u) - 113*cos(2*u) + 30*sin(2*u) + 11*cos(3*u) - 27*sin(3*u),\n 45*sin(u) - 30*cos(2*u) + 113*sin(2*u) - 11*cos(3*u) + 27*sin(3*u)]\n return transpose(array(x))\n\nknot_curve = curve_factory.fit(trefoil, 0, 2*pi) # adaptive curve fit of trefoil knot\nsquare_curve = 15 * curve_factory.n_gon(4) # square cross-section\nmy_surface = surface_factory.sweep(crv, square) # sweep out the surface\n```\n\n### Working with the controlpoints\n\n``` python\n>>> from splipy import *\n>>> my_curve = curve_factory.circle(r=3)\n>>> print(my_curve[0])\n[3. 0. 1.]\n>>> print(my_curve[1])\n[2.12132034 2.12132034 0.70710678]\n>>> for controlpoint in my_curve:\n... print(controlpoint)\n[3. 0. 1.]\n[2.12132034 2.12132034 0.70710678]\n[0. 3. 1.]\n[-2.12132034 2.12132034 0.70710678]\n[-3. 0. 1.]\n[-2.12132034 -2.12132034 0.70710678]\n[ 0. -3. 1.]\n[ 2.12132034 -2.12132034 0.70710678]\n```\n\n### Creating STL files\n\nSTL files are used extensively for 3D representation and is one of the only supported formats for 3D printing.\n\n``` python\nfrom splipy.io import STL\nfrom splipy import surface_factory\n\n# create a NURBS torus\nmy_torus = surface_factory.torus(minor_r=1, major_r=4)\n\n# STL files are tessellated linear triangles. View with i.e. meshlab\nwith STL('torus.stl') as my_file:\n my_file.write(my_torus, n=(50, 150)) # specify resolution of 50x150 evaluation pts\n```\n\n**Torus tesselation as viewed in Meshlab**\n![Torus](https://github.com/sintefmath/Splipy/tree/master/images/torus.png)\n\n\n\n", "description_content_type": "text/markdown", "docs_url": "https://pythonhosted.org/Splipy/", "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/sintefmath/Splipy", "keywords": "Bspline,Splines,NURBS,Curve,Surface,Volume,Interpolation,Approximation,Fit,Integration,Differentiation", "license": "GNU public license v3", "maintainer": "Kjetil Andre Johannessen", "maintainer_email": "kjetijo@gmail.com", "name": "Splipy", "package_url": "https://pypi.org/project/Splipy/", "platform": "", "project_url": "https://pypi.org/project/Splipy/", "project_urls": { "Homepage": "https://github.com/sintefmath/Splipy" }, "release_url": "https://pypi.org/project/Splipy/1.3.1/", "requires_dist": [ "numpy (>=1.9)", "scipy (>=0.17)", "nutils (>=3.0); extra == 'FiniteElement'", "opencv-python (>=3.3); extra == 'Images'" ], "requires_python": "", "summary": "Spline modelling library for Python", "version": "1.3.1" }, "last_serial": 3804436, "releases": { "1.1.0": [ { "comment_text": "", "digests": { "md5": "347485c93571e3c87f013bcacc9f400d", "sha256": "faa26b137c64969a24088eac27d59fa1f7ae4de89eadd00a28a78ff0e3cd7279" }, "downloads": -1, "filename": "Splipy-1.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "347485c93571e3c87f013bcacc9f400d", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 1972684, "upload_time": "2017-06-29T07:44:24", "url": "https://files.pythonhosted.org/packages/3c/76/bc0cdfd75e4a89a03cbc377e45f6923e977ea5ea138835fa6edc2e84eb3d/Splipy-1.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d21290b8bae17f28be9affbfb07a0dc0", "sha256": "612c8c38ae774456229ded4bd252f65a093277d48d63d79301e636372884a84f" }, "downloads": -1, "filename": "Splipy-1.1.0.tar.gz", "has_sig": false, "md5_digest": "d21290b8bae17f28be9affbfb07a0dc0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 83723, "upload_time": "2017-06-29T07:44:29", "url": "https://files.pythonhosted.org/packages/8c/33/5ba9c182fbad68be2fd83065b40f5d11919f4c6cb8569f1639e315a2533f/Splipy-1.1.0.tar.gz" } ], "1.2.0": [ { "comment_text": "", "digests": { "md5": "e3175235aec4cd87aa171eea24c03159", "sha256": "369b4b3fc5fde101bb312c8a5f7e6f68d7a969003bf1060ef495b5cbf3da76fa" }, "downloads": -1, "filename": "Splipy-1.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e3175235aec4cd87aa171eea24c03159", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 1980800, "upload_time": "2017-11-09T08:11:52", "url": "https://files.pythonhosted.org/packages/f3/9e/cb5051de91d1e8d7475ca51c171613bffa99711488ae286f5425e09e12d0/Splipy-1.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "88ed9d1833f5530dd3c11b781a062d99", "sha256": "9daa0272dfcb7c6bcdd16af7a6c42a117d93b51237333e84d402722b27c3fe2d" }, "downloads": -1, "filename": "Splipy-1.2.0.tar.gz", "has_sig": false, "md5_digest": "88ed9d1833f5530dd3c11b781a062d99", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 89804, "upload_time": "2017-11-09T08:11:55", "url": "https://files.pythonhosted.org/packages/c4/dc/30a1a80c912b20af499659dd80e633bc840e7f10684cb0222c5ad51eb257/Splipy-1.2.0.tar.gz" } ], "1.3.1": [ { "comment_text": "", "digests": { "md5": "b9e2b7c4dde9c939dc63182451e9ea5c", "sha256": "15bdd9148cc9a1c803543cd3705a8aa233e758a81daee1bdc6c255435efd0488" }, "downloads": -1, "filename": "Splipy-1.3.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "b9e2b7c4dde9c939dc63182451e9ea5c", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 117026, "upload_time": "2018-04-24T20:17:48", "url": "https://files.pythonhosted.org/packages/f5/df/6a4dc273987f620795b438f773c0fe01e7d39fff5c2dfa712c5b808d43d4/Splipy-1.3.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7f33c10fe894d39c259498a5a9fd3b37", "sha256": "43b5f2d03cccf9339d3c582e52433d71dfd2bad7598351719e123dc8a87b9601" }, "downloads": -1, "filename": "Splipy-1.3.1.tar.gz", "has_sig": false, "md5_digest": "7f33c10fe894d39c259498a5a9fd3b37", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 101831, "upload_time": "2018-04-24T20:17:50", "url": "https://files.pythonhosted.org/packages/67/94/2d2cdd5eacbfcdb5aed034049db665eedc36e8ddba8f66267b0680c3b22b/Splipy-1.3.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b9e2b7c4dde9c939dc63182451e9ea5c", "sha256": "15bdd9148cc9a1c803543cd3705a8aa233e758a81daee1bdc6c255435efd0488" }, "downloads": -1, "filename": "Splipy-1.3.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "b9e2b7c4dde9c939dc63182451e9ea5c", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 117026, "upload_time": "2018-04-24T20:17:48", "url": "https://files.pythonhosted.org/packages/f5/df/6a4dc273987f620795b438f773c0fe01e7d39fff5c2dfa712c5b808d43d4/Splipy-1.3.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7f33c10fe894d39c259498a5a9fd3b37", "sha256": "43b5f2d03cccf9339d3c582e52433d71dfd2bad7598351719e123dc8a87b9601" }, "downloads": -1, "filename": "Splipy-1.3.1.tar.gz", "has_sig": false, "md5_digest": "7f33c10fe894d39c259498a5a9fd3b37", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 101831, "upload_time": "2018-04-24T20:17:50", "url": "https://files.pythonhosted.org/packages/67/94/2d2cdd5eacbfcdb5aed034049db665eedc36e8ddba8f66267b0680c3b22b/Splipy-1.3.1.tar.gz" } ] }