{ "info": { "author": "Rohit Pandey", "author_email": "rohitpandey576@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "[![Build Status](https://travis-ci.org/ryu577/pyray.svg?branch=master)](https://travis-ci.org/ryu577/pyray)\n\n# Introduction\n\nI'm creating this repository in January 2018 and it is crazy that the best open source option for rendering 3d scenes remains POV ray.\nNow, POV ray is a great program, but why can't we have that functionality (rendering 2d, 3d and higher dimensional objects and scenes) in Python, a language that is perhaps the most widely used already and only growing in popularity?\nThis code is a first step towards that goal - have the ability to do everything POV ray does - rendering complex 3d objects and scenes, animations and much more in plain, vanilla Python. I imagine this would find applications in creating videos, video games, physical simulations or just pretty pictures.\n\nWhile there certainly is a very long way to go before this can be a reality, it won't happen without taking a first step. And of course, I could use help :)\n\nAbove all else, I want to emphasize simplicity in this library and minimize the dependence on external libraries so more people can hit the ground running with it.\n\n\n# Installation\nTo install the library, run (pyray was taken on pypi):\n\n```\npip install raypy\n```\n\nMake sure you have all the requirements (requirements.txt) installed. If not, you can run:\n\n```\npip install -r requirements.txt\n```\n\nAlternately, you can fork/download the code and run from the main folder:\n\n```\npython setup.py install\n```\n\n# Requirements\nI've made every effort to keep the requirements for this project to the bare minimum so most people can get it running with almost no pain. These are - \nPython Imaging Library (PIL), numpy and scipy. For writing on math equations images using the methods in WriteOnImage.py, you'll need matplotlib and sympy. All of these can be installed quite easily with `pip install -r requirements.txt`\n\n# Usage\nTo keep things simple and the dependencies minimal, the program simply writes an image or a series of images to the folder `./Images/RotatingCube` (this was the first object that was animated with this tool). \n\nYou can run any method tagged @MoneyShot to see how this works. For example, you can run the following method from cube.py - \n\n```python\nfrom pyray.shapes.cube import *\ncube_with_cuttingplanes(7, popup=True)\n```\nand this will generate a colorful 3d cube with diagonal cutting planes shaded in different colors (in the folder where you run it from, file called im0.png). Something like this (click to see what happens) - \n\n\n\n\nYou can now create a series of them using the following code - \n\n```python\nfor i in range(3, 15):\n\tcube_with_cuttingplanes(numTerms = i, im_ind = i-3)\n```\n\nThe series of images can then be easily converted to a video using the open source ffmpeg program. For example\n\n> ffmpeg -framerate 10 -f image2 -i im%d.png -vb 20M vid.avi\n\nThe video can then be converted to a .gif file if required - \n\n> ffmpeg -i vid.avi -pix_fmt rgb24 -loop 0 out.gif\n\nFor example, something like this:\n\n\n\n\nIn case you're wondering, you can generate the images used in the gif above via:\n\n```python\nfrom pyray.shapes.plane import *\nfor i in range(20):\n\tbest_plane_direction(im_ind=i)\n```\n\nIf you think this is valuable, please star :)\n\n# Contributing\n\nWe welcome any kind of contribution, bug report, suggestion, new module, etc. Anything is welcome.\n\n# Other examples\n\nTo create a bouncy sphere or a wavy sphere, run \n```python\nfrom pyray.shapes.sphere import *\ndraw_wavy_sphere_wrapper('.\\\\im', 66, 1)\n```\n\n\n\n```python\nimport numpy as np;from PIL import Image, ImageDraw, ImageFont, ImageMath;from pyray.axes import *\nfrom pyray.rotation import *;from pyray.axes import draw_2d_arrow, Path, ZigZagPath, draw_grid, draw_grey_grid\nfrom pyray.misc import dist\n\nim = draw_grid()\ndraw = ImageDraw.Draw(im,'RGBA')\npts = np.array([[0,0],[1,1],[5,-3]])\npth = Path(pts)\npth.zg.draw_lines(draw,i/10.0)\nim.save(\"im\" + str(i) + \".png\")\n```\n\n\n\n```python\nfrom pyray.shapes.polyhedron import *\nbasedir = '.\\\\'\ntr = Tetartoid()\nfor i in range(0, 31):\n im = Image.new(\"RGB\", (2048, 2048), (1,1,1))\n draw = ImageDraw.Draw(im,'RGBA')\n r = general_rotation(np.array([0,1,0]),2*np.pi*i/30)\n tr.render_solid_planes(draw, r, shift=np.array([1000, 1000, 0]), scale=750)\n im.save(basedir + \"im\" + str(i) + \".png\")\n```\n\n\n\n\n```python\nfrom pyray.shapes.paraboloid import *\ndraw_paraboloids()\n```\n\n\n\n\n\n```python\nfrom pyray.shapes.pointswarm import *\npoints_to_bins()\n```\n\n\n\n# Demonstrations\nSo far, I've been using this to create YouTube videos for my channel.\n\nHere are some that demonstrate the abilities of this code (also see below for some images created with it) - \n\n1. Binomial coefficients on hypercubes.\n\n2. Why does Gradient descent work?\n\n3. Introduction to Platonic solids\n\n4. Slice a 4d hypercube (Teserract).\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/ryu577/pyray", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "raypy", "package_url": "https://pypi.org/project/raypy/", "platform": "", "project_url": "https://pypi.org/project/raypy/", "project_urls": { "Homepage": "https://github.com/ryu577/pyray" }, "release_url": "https://pypi.org/project/raypy/0.0.2/", "requires_dist": [ "numpy", "scipy", "matplotlib", "sympy", "pillow", "pytest ; extra == 'test'" ], "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4", "summary": "A 3d rendering library written completely in python.", "version": "0.0.2" }, "last_serial": 5661008, "releases": { "0.0.0": [ { "comment_text": "", "digests": { "md5": "57420f5e82c956d45fd99f13adef27d3", "sha256": "a58fe22f5d479cdf667d5fa395d5b2cb8d26a53643e6dc9fecdff081e44055c2" }, "downloads": -1, "filename": "raypy-0.0.0-py2-none-any.whl", "has_sig": false, "md5_digest": "57420f5e82c956d45fd99f13adef27d3", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 32076, "upload_time": "2018-06-05T08:02:43", "url": "https://files.pythonhosted.org/packages/95/f4/10325e128224c7b0e1e48e4e680db89a4d228c989d88a17a154ca1b75b38/raypy-0.0.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1d8236d7bfc7f9d7abf990ecd8ebdfcf", "sha256": "cf8684edf6535b9d14e6d5f84494b2a1b0f57ae109bfec96641d3247ed5b6d33" }, "downloads": -1, "filename": "raypy-0.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "1d8236d7bfc7f9d7abf990ecd8ebdfcf", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 74912, "upload_time": "2018-08-08T07:47:16", "url": "https://files.pythonhosted.org/packages/13/eb/fc434acaa09e4a06babf14f93a7b118d1c48d1f425a93609039ed03cfe13/raypy-0.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9b2831bca0f21101ce8cd15ff22c9132", "sha256": "585ecd7d468fcc1ce42aade2b758957cf4f2b166f9dfd51e7f69e31d3b282369" }, "downloads": -1, "filename": "raypy-0.0.0.tar.gz", "has_sig": false, "md5_digest": "9b2831bca0f21101ce8cd15ff22c9132", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 27678, "upload_time": "2018-06-05T08:02:45", "url": "https://files.pythonhosted.org/packages/f0/76/3943b964f991f9e96fa94dc6ebb00a1b23bb6cf8f35f1e2e5f40562f3e27/raypy-0.0.0.tar.gz" } ], "0.0.1": [ { "comment_text": "", "digests": { "md5": "d4a1e2d4db65be50f2840ee06638c6ed", "sha256": "08b4996149fa0a37fd34b224a482ca076559ae250204d1f230447c6b597cf848" }, "downloads": -1, "filename": "raypy-0.0.1-py2-none-any.whl", "has_sig": false, "md5_digest": "d4a1e2d4db65be50f2840ee06638c6ed", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4", "size": 74948, "upload_time": "2018-08-08T07:55:10", "url": "https://files.pythonhosted.org/packages/77/44/2b74cc7092f7f345bb0cea5f51d385f2dbb0f548d2abfd6b2e2947fd3394/raypy-0.0.1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3da7bc32d0b456f64a465ac9f672c494", "sha256": "8045c642df38d4dc0f0e9dccec085be0f0b768e5a1013e71c5aec8b1aaf92b34" }, "downloads": -1, "filename": "raypy-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "3da7bc32d0b456f64a465ac9f672c494", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4", "size": 74914, "upload_time": "2018-08-08T07:49:40", "url": "https://files.pythonhosted.org/packages/2e/40/cd68b7a0c314a998c9c670ea7b0306de904ccc33e6ed8b7dd8e9b1f23774/raypy-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "359ab707815702616e1911f7075f5a00", "sha256": "e1ca24b8b2c5d8bf71da9c3edfda37d704382834d931c46d0077d6cfeb960601" }, "downloads": -1, "filename": "raypy-0.0.1.tar.gz", "has_sig": false, "md5_digest": "359ab707815702616e1911f7075f5a00", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4", "size": 37699, "upload_time": "2018-08-08T07:49:42", "url": "https://files.pythonhosted.org/packages/ec/67/9c5c5446c0a122e29a34a253fcc3ee4ab161e6bb2c24864d33a90e037020/raypy-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "4d0137940492a95d91ef98d3fda208a9", "sha256": "54f8b8b5e6c300b32c310425d5f28d7800bd1f13e9de5574a6a1e61e26e110ab" }, "downloads": -1, "filename": "raypy-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "4d0137940492a95d91ef98d3fda208a9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4", "size": 131623, "upload_time": "2019-08-11T04:58:20", "url": "https://files.pythonhosted.org/packages/05/f7/bcddd5a6ad60c12f6104017beeca47d08c3bb8d43234a8999498d23a84cf/raypy-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4a7ad9f67f0064d6d0e7d8dce12ea15b", "sha256": "b8a60b0d194c16ac603e7538cedde23f20afbf96dd6b52a6f3e07824ccf9131f" }, "downloads": -1, "filename": "raypy-0.0.2.tar.gz", "has_sig": false, "md5_digest": "4a7ad9f67f0064d6d0e7d8dce12ea15b", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4", "size": 55873, "upload_time": "2019-08-11T04:58:22", "url": "https://files.pythonhosted.org/packages/69/ff/6e3649dd1b13ce8fd4d534530f01f569923e35d109e8182c547b18323b80/raypy-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4d0137940492a95d91ef98d3fda208a9", "sha256": "54f8b8b5e6c300b32c310425d5f28d7800bd1f13e9de5574a6a1e61e26e110ab" }, "downloads": -1, "filename": "raypy-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "4d0137940492a95d91ef98d3fda208a9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4", "size": 131623, "upload_time": "2019-08-11T04:58:20", "url": "https://files.pythonhosted.org/packages/05/f7/bcddd5a6ad60c12f6104017beeca47d08c3bb8d43234a8999498d23a84cf/raypy-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4a7ad9f67f0064d6d0e7d8dce12ea15b", "sha256": "b8a60b0d194c16ac603e7538cedde23f20afbf96dd6b52a6f3e07824ccf9131f" }, "downloads": -1, "filename": "raypy-0.0.2.tar.gz", "has_sig": false, "md5_digest": "4a7ad9f67f0064d6d0e7d8dce12ea15b", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4", "size": 55873, "upload_time": "2019-08-11T04:58:22", "url": "https://files.pythonhosted.org/packages/69/ff/6e3649dd1b13ce8fd4d534530f01f569923e35d109e8182c547b18323b80/raypy-0.0.2.tar.gz" } ] }