{ "info": { "author": "Olaf Haag", "author_email": "haag.olaf@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Console", "Intended Audience :: End Users/Desktop", "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Topic :: Games/Entertainment" ], "description": "# VectorFields\nScripts to create vector fields and flowmaps that can be used in game engines like Unreal Engine 4 and Unity 3D. \nHave a look at UE4's [documentation](https://docs.unrealengine.com/en-us/Engine/Rendering/ParticleSystems/VectorFields).\n\n## Installation\n### via Python Package Index\n`pip install vectorfields`\n### Bleeding Edge\n* To install using development mode: \n`pip install -e git+https://github.com/OlafHaag/vectorfields.git@master#egg=vectorfields`\n* To install using regular mode (building the package): \n`pip install https://github.com/OlafHaag/vectorfields/archive/master.zip`\n\n## Usage\nYou have to know a bit of python and math.\n\nThe abstract base classes VectorField and VectorField2D can't be instantiated.\n\nInstantiate a specific vector field, like ElectricDipole2D. \nYou can use the __*save* method to write the vector field to disk in FGA or VF format__. To be able to save in vf format, you have to turn instances of VectorField2D subclasses into 3D vector fields with the *to_3d* method. If I'm not mistaken Unity expects *cubic* vector fields with resolution x=y=z.\nYou can also save instances of Vectorfield2D's sub classes to __flow maps__ (e.g. png).\n\nIt's best to preview your vector field directly in engine. Saving to disk usually reloads the file in Unity. \nFor other purposes you can use the plot-method of the Vectorfield2D class to get a preview.\n\n### Special classes\n#### Vortex2D\nHas parameters __radius__ and __pull__. \n![Vortex2D Example Animation](https://github.com/OlafHaag/VectorFields/raw/master/docs/img/vortex.gif \"Vortex2D example\")\n\n#### TwirlFlow2D\n![TwirlFlow2D Example Animation](https://github.com/OlafHaag/VectorFields/raw/master/docs/img/twirlflow.gif \"TwirlFlow2D example\")\n\n#### ElectricDipole2D\nElectricDipole2D has 2 special methods to either normalize the vectors and lose all information on field strength or to clamp the field strength to a maximum value. This was necessary, because the physical properties of this field aren't visually pleasing. \n![ElectricDipole Example Animation](https://github.com/OlafHaag/VectorFields/raw/master/docs/img/dipole.gif \"Electric Dipole example with clamped field strength\")\n\n#### Belt2D\nWith this you can place rotating areas in the field that more or less merge together, hence creating the impression of a belt running over pulleys. \nBesides their x and y coordinates each *pulley* has a radius, thickness and speed (negative speed to change direction).\n![Belt2D Example Animation](https://github.com/OlafHaag/VectorFields/raw/master/docs/img/belts.gif \"Belt2D example\") \nAs a flowmap: \n![Belt2D Example Flowmap](https://github.com/OlafHaag/VectorFields/raw/master/docs/img/BeltFlow.png \"Belt2D FlowMap\")\n\n#### CustomUVW\nThis is a class for quick prototyping and generation of vector fields.\n\nYou provide custom functions to the constructor for creating the U, V and W vector components. \nThese functions must take 3 parameters that will be substituted for the class' data members grid_x, grid_y, grid_z. \nThe return value must be an array of the same shape as grid_x, grid_y or grid_z respectively.\n\n#### CustomUV2D\nThis is a class for quick prototyping and generation of 2D vectorfields.\n\nYou provide custom functions to the constructor for creating the U and V vector components. \nThese functions must take 2 parameters that will be substituted for the class' data members grid_x and grid_y.\nThe return value must be an array of the same shape as grid_x or grid_y respectively.\n\n__2D Examples:__\n\nnon-square sine vector field\n```python\nimport numpy as np\nfrom vectorfields import CustomUV2D\nufunc = lambda x,y: np.ones(x.shape) # Flow in one direction.\nvfunc = lambda x,y: np.sin(x)\nvf = CustomUV2D(ufunc, vfunc, size=[8,2], resolution=[32,8])\n```\nsquare example:\n![Sine Wave Example Animation](https://github.com/OlafHaag/VectorFields/raw/master/docs/img/sine.gif \"Sine wave example\")\n\nregular cosine whirls\n```python\nimport numpy as np\nfrom vectorfields import CustomUV2D\nufunc = lambda x,y: np.cos(y)\nvfunc = lambda x,y: np.cos(x)\nvf = CustomUV2D(ufunc, vfunc, size=16)\n```\n![Diamonds Example Animation](https://github.com/OlafHaag/VectorFields/raw/master/docs/img/diamonds.gif \"diamonds example\")\n\n\"flowers\"\n```python\nimport numpy as np\nfrom vectorfields import CustomUV2D\nufunc = lambda x,y: np.sin(y + x)\nvfunc = lambda x,y: np.cos(x - y)\nvf = CustomUV2D(ufunc, vfunc, size=12, resolution=48)\n```\n![Belt2D Example Animation](https://github.com/OlafHaag/VectorFields/raw/master/docs/img/flowers.gif \"\\\"flowers\\\" example\")\n\nsome diagonal flow thingy\n```python\nimport numpy as np\nfrom vectorfields import CustomUV2D\nufunc = lambda x,y: np.cos(np.sqrt(np.abs(x))) \nvfunc = lambda x,y: np.cos(np.sqrt(np.abs(y))) \nvf = CustomUV2D(ufunc, vfunc)\n``` \n[anvaka's](https://github.com/anvaka/fieldplay) square flow tiles (seriously, it's hard to find names for this stuff)\n```python\nimport numpy as np\nfrom vectorfields import CustomUV2D \nufunc = lambda x,y: 2.0 * np.mod(np.floor(-y), 2.0) - 1.0\nvfunc = lambda x,y: 2.0 * np.mod(np.floor(-x), -2.0) + 1.0\nvf = CustomUV2D(ufunc, vfunc, size=5.9, resolution=24)\n```\n\nbeautiful twirls\n```python\nimport numpy as np\nfrom vectorfields import CustomUV2D\nufunc = lambda x,y: np.cos(np.linalg.norm(np.dstack((x, y)), axis=2))[:,:,np.newaxis]\nvfunc = lambda x,y: np.cos(x-y)\nvf = CustomUV2D(ufunc, vfunc, size=16)\n```\n![Twirls Example Animation](https://github.com/OlafHaag/VectorFields/raw/master/docs/img/twirls.gif \"\\\"beautiful twirls\\\" example\")\n\ntwirl column\n```python\nimport numpy as np\nfrom vectorfields import CustomUV2D\nufunc = lambda x,y: np.sin(y)\nvfunc = lambda x,y: x\nvf = CustomUV2D(ufunc, vfunc, size=[12, 16], resolution=[24, 32])\n```\nOne last thingy...\n```python\nimport numpy as np\nfrom vectorfields import CustomUV2D\nufunc = lambda x,y: np.cos(y**2)\nvfunc = lambda x,y: np.cos(y*x)\nvf = CustomUV2D(ufunc, vfunc, size=[24, 16], resolution=[48,32])\n```\n![Thingy Example Animation](https://github.com/OlafHaag/VectorFields/raw/master/docs/img/thingy.gif \"\\\"thingy\\\" example\")\n\n## History\nThis little project started at a little game jam with the topic \"electricity\". I wanted to do something with particles and controlling their flow with formulas, but the available methods for creating vector fields at the time where either too complicated for this small task, or too time consuming or bound to purchasing a software license. Of course, this cannot compete with GUI software like VectorayGen, but it's free and open source.\n\n## Development\nSince it did what I needed it got stuck in early development stage. For example, there's a lack of three-dimensional vector field examples and there are no unit-tests.\n\nI'd like to see people creating other vector fields with this and improve and advance the code.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/OlafHaag/VectorFields", "keywords": "vector fields FGA vf flowmap unity unreal 3d game engine VFX", "license": "", "maintainer": "", "maintainer_email": "", "name": "vectorfields", "package_url": "https://pypi.org/project/vectorfields/", "platform": "", "project_url": "https://pypi.org/project/vectorfields/", "project_urls": { "Bug Reports": "https://github.com/OlafHaag/VectorFields/issues", "Homepage": "https://github.com/OlafHaag/VectorFields", "Source": "https://github.com/OlafHaag/VectorFields/" }, "release_url": "https://pypi.org/project/vectorfields/0.1.2/", "requires_dist": [ "numpy", "matplotlib" ], "requires_python": ">=2.7", "summary": "Module for creating vector fields for use in a game engine, e.g. Unreal Engine 4 or Unity 3D.", "version": "0.1.2" }, "last_serial": 4815543, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "7ce89d17f536112a409431b20d5e7cbb", "sha256": "98b26ca88d237a160f12085c36f27d8ccfed2c53ddfcb8981e05bd4fcb463bd2" }, "downloads": -1, "filename": "vectorfields-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "7ce89d17f536112a409431b20d5e7cbb", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7", "size": 9944, "upload_time": "2019-02-01T02:37:04", "url": "https://files.pythonhosted.org/packages/a5/75/232a55a66b437bcf6047d319e6c73a4ddfe5052adaf64ff88bc3cc4d86a9/vectorfields-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2553d43649ec4acafdad56df7c3f886b", "sha256": "e036b6091c6b78e73088c85c9c85662ba51b33400b12f0427fa1e37bfd6b54c9" }, "downloads": -1, "filename": "vectorfields-0.1.0.tar.gz", "has_sig": false, "md5_digest": "2553d43649ec4acafdad56df7c3f886b", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 11319, "upload_time": "2019-02-01T02:37:06", "url": "https://files.pythonhosted.org/packages/43/94/9b87d59b2c92ffea4144da614469257d664430d99b1f11173081ec458505/vectorfields-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "14bc0243ef346bf554e1defd16f7eefb", "sha256": "e6c8f78834c8b942f058ebb716ed2c3e724f44f47195eaa30217cb915007b7af" }, "downloads": -1, "filename": "vectorfields-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "14bc0243ef346bf554e1defd16f7eefb", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7", "size": 10393, "upload_time": "2019-02-02T17:14:36", "url": "https://files.pythonhosted.org/packages/2a/60/f15735f27fecc97a4ed7904b5561ae8833d84158e0d4970983a9c1cabe75/vectorfields-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0bd541e3f5cf2de0168c790e6d878a91", "sha256": "5cbd53813726c4a2409ad39fec40617ee805d899734211f08df74cc1c6a6c650" }, "downloads": -1, "filename": "vectorfields-0.1.1.tar.gz", "has_sig": false, "md5_digest": "0bd541e3f5cf2de0168c790e6d878a91", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 11926, "upload_time": "2019-02-02T17:14:37", "url": "https://files.pythonhosted.org/packages/a9/80/d72df180ef1e165b18b256b2c32b6526606cea32ff9c68e19c9f0f3d2a4d/vectorfields-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "6c95f40c644dac6031db6e5b83395250", "sha256": "c35f4278bb08559fe3387e4d90558b50608dda3d6a5f9064fd156a5acac480a5" }, "downloads": -1, "filename": "vectorfields-0.1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "6c95f40c644dac6031db6e5b83395250", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7", "size": 10400, "upload_time": "2019-02-13T12:51:22", "url": "https://files.pythonhosted.org/packages/ab/8e/183a3ccf2e8bbcd0d48697b42489e45f4bd23fee658cabb0b8a3b81b4cdb/vectorfields-0.1.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "384df566a512f258ca45c289c3704aba", "sha256": "0b6a406c4630559893ce81cdab8d25c658457c2e5ede568c01568e4316fec0e3" }, "downloads": -1, "filename": "vectorfields-0.1.2.tar.gz", "has_sig": false, "md5_digest": "384df566a512f258ca45c289c3704aba", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 12066, "upload_time": "2019-02-13T12:51:23", "url": "https://files.pythonhosted.org/packages/c2/fa/9187050e852c20d655249e3aaa14ffdce561d42ca85ec86eae148a054377/vectorfields-0.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "6c95f40c644dac6031db6e5b83395250", "sha256": "c35f4278bb08559fe3387e4d90558b50608dda3d6a5f9064fd156a5acac480a5" }, "downloads": -1, "filename": "vectorfields-0.1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "6c95f40c644dac6031db6e5b83395250", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7", "size": 10400, "upload_time": "2019-02-13T12:51:22", "url": "https://files.pythonhosted.org/packages/ab/8e/183a3ccf2e8bbcd0d48697b42489e45f4bd23fee658cabb0b8a3b81b4cdb/vectorfields-0.1.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "384df566a512f258ca45c289c3704aba", "sha256": "0b6a406c4630559893ce81cdab8d25c658457c2e5ede568c01568e4316fec0e3" }, "downloads": -1, "filename": "vectorfields-0.1.2.tar.gz", "has_sig": false, "md5_digest": "384df566a512f258ca45c289c3704aba", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 12066, "upload_time": "2019-02-13T12:51:23", "url": "https://files.pythonhosted.org/packages/c2/fa/9187050e852c20d655249e3aaa14ffdce561d42ca85ec86eae148a054377/vectorfields-0.1.2.tar.gz" } ] }