{ "info": { "author": "#0K Srinivasan Ramachandran", "author_email": "ashok.srinivasan2002@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "Chenhancc\n==============\n\nA Fast geodesic algorithm in python that spans across the surface through the polygons. You will find it useful if you are working with 3D graphics and triangular meshes. Given a pt as seed then this algorithm finds a smooth point to any point

on the mesh.\n

\nThe algorithm is purely based on the paper of Shiqing who provided me with this wonderful c++ code as well. All I had to do was make some changes so it can be compiled as a python library. The timing or efficiency difference between the pure python implementation and c++ -> python conversion is atleast 210x times. \n\n\nMany Thanks\n-----------\n\nThe original c++ source code was provided to me by Dr. Xin Shiqing (https://sites.google.com/site/xinshiqing/). My sincere thanks to him for his help\n\n```\nXin SQ, Wang GJ. Improving Chen and Han's algorithm on the discrete geodesic problem. ACM Transactions on Graphics (TOG). 2009 Aug 1;28(4):104.\n```\n\n-----------------\nRunning the tests\n-----------------\n\nBelow snippets are some examples to test the chenhancc library::\n\n---------------------------\nA simple test using Python3\n---------------------------\n\n #!/usr/bin/env python3\n\n from chenhancc import CPoint3D, CFace, CRichModel, CBaseModel, CExactMethodForDGP;\n\tfrom random import random, randint;\n\t\n\tverts = [CPoint3D(random() * 3,random() * 3,random() * 3) for i in range(20)];\n\tfaces = [CFace(randint(0,3),randint(0,3),randint(0,3)) for i in range(20)];\n\t\n\tprint('TESTING BASE MODEL');\n\tbmodel = CBaseModel();\n\tbmodel.LoadModel(verts, faces);\n\t\n\tprint('TESTING RICH MODEL');\n\t\n\trmodel = CRichModel();\n\trmodel.LoadModel(verts, faces);\n\trmodel.Preprocess();\n\t\n\tprint('END OF TESTS')\n\nDemos\n---------\n\nIf you want to perform demos as shown in the screenshots above. Then after installing the sharedobject for chenhancc you should be also install another Blender plugin to see live paths on meshes. The link to the repository is [here](https://github.com/aalavandhaann/ch_bl_geodesics). Once you have installed the plugin then start clicking on the meshes and see paths between consecutive clicks. \n\n\nDemos - Blender\n-------------------\n\nYou will find blender folder inside the demo folder. There is a blend file that can test a mesh loaded in the scene. Just ensure to load a mesh, select it with mouse and run the script `(Alt-p)`. You should see a path between the selected vertices as supplied in the code in the text editor of Blender. In the below code change the `svid` and `evid` to change the vertex selection. `svid` is the seed vertex index, and `evid` is the target vertex index to which a path should be found. \n\n---------------------------\nA simple test using Blender\n---------------------------\n.. code:: python\n\t#----------Blender based api modules import----------------\n\timport bpy, bmesh;\n\tfrom mathutils import Vector;\n\t#----------End of Blender based api modules import----------------\n\t\n\tfrom chenhancc import CBaseModel as BaseModel, CRichModel as RichModel, CPoint3D as Point3D, CFace as Face, CICHWithFurtherPriorityQueue as ICHWithFurtherPriorityQueue;\n\t\n\t\n\tc = bpy.context;\n\tm = c.active_object;\n\tsvid = 0;\n\tevid = 20000;\n\t\n\tdef rotate(l, n):\n\t return l[n:] + l[:n];\n\t\n\tdef createPathMesh(points):\n\t myvertexlist = [[2,2,2],[4,4,4],[6,6,6],[8,8,8]]\n\t \n\t obName = \"path_\"+str(len(points));\n\t me = bpy.data.meshes.new(obName);\n\t ob = bpy.data.objects.new(obName, me);\n\t\n\t # Get a BMesh representation\n\t bm = bmesh.new(); # create an empty BMesh\n\t bm.from_mesh(me); # fill it in from a Mesh\n\t\n\t # Modify the BMesh, can do anything here...\n\t for index, co in enumerate(points):\n\t v = bm.verts.new(co);\n\t v.index = index;\n\t \n\t bm.verts.ensure_lookup_table();\n\t \n\t for index, co in enumerate(points[1:]):\n\t v1 = bm.verts[index-1];\n\t v2 = bm.verts[index];\n\t e = bm.edges.new((v1, v2));\n\t \n\t \n\t # also add bm.edges and bm.faces\n\t\n\t # Finish up, write the bmesh back to the mesh\n\t bm.to_mesh(me);\n\t bm.free(); # free and prevent further access\n\t \n\t scn = bpy.context.scene;\n\t scn.objects.link(ob);\n\t scn.objects.active = ob;\n\t ob.select = True;\n\t\n\t\n\tif(m):\n\t verts = [];\n\t faces = [];\n\t loops = m.data.loops;\n\t \n\t bmodel = RichModel();\n\t \n\t m.data.vertices[svid].select = True;\n\t m.data.vertices[evid].select = True;\n\t \n\t for v in m.data.vertices:\n\t p3d = Point3D(v.co.x, v.co.y, v.co.z);\n\t verts.append(p3d);\n\t \n\t for f in m.data.polygons:\n\t f_vids = [loops[lid].vertex_index for lid in f.loop_indices]; \n\t faces.append(Face(f_vids[0], f_vids[1], f_vids[2]));\n\t \n\t bmodel.LoadModel(verts, faces);\n\t bmodel.Preprocess();\n\t \n\t emethod = ICHWithFurtherPriorityQueue(bmodel, set([svid]));\n\t emethod.Execute();\n\t paths = emethod.FindSourceVertex(evid,[]);\n\t paths = rotate(paths, 1);\n\t \n\t path_verts = [];\n\t \n\t for epoint in paths:\n\t pt = epoint.Get3DPoint(bmodel);\n\t path_verts.append(Vector((pt.x, pt.y, pt.z)));\n\t createPathMesh(path_verts);\n\t print('DONE FOUND THE PATHS::: ');\n\n-------------\nInstallation\n-------------\n**On any OS (Linux, OS X, MAC, Windows)**\n\n - Clone this repository\n - Navigate inside distribution_files\n - run `python3 setup.py build` - To create the build\n - run `python3 setup.py install --user` - for copying in your local library\n - Or this can be pip-able soon or already available as ```pip3 install chenhancc ```\n\n\n**Prerequesties for compiling everything yourself**\n- This code is compiled using the magic binders for pybind11 created by binder.\n\n\t*[Github link for binder](https://github.com/RosettaCommons/binder).\n\t\n\t*[Github link for pybind11](https://github.com/pybind/pybind11).", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/aalavandhaann/chenhancc", "keywords": "geodesic mesh mesh3d opengl pygl triangle triangular meshes blender", "license": "LICENSE.txt", "maintainer": "", "maintainer_email": "", "name": "chenhancc", "package_url": "https://pypi.org/project/chenhancc/", "platform": "", "project_url": "https://pypi.org/project/chenhancc/", "project_urls": { "Homepage": "https://github.com/aalavandhaann/chenhancc" }, "release_url": "https://pypi.org/project/chenhancc/0.0.5/", "requires_dist": null, "requires_python": ">=3", "summary": "A geodesic path solution using chenhan", "version": "0.0.5" }, "last_serial": 3229296, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "805125d4ca567dc29c6c5f7442a5c6ad", "sha256": "b03a8f9cf72862c4e8bf46faa885c0d4d2a6e0c6c3d3b9c6c3a4e0a3478a37b6" }, "downloads": -1, "filename": "chenhancc-0.0.1.tar.gz", "has_sig": false, "md5_digest": "805125d4ca567dc29c6c5f7442a5c6ad", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 189573, "upload_time": "2017-10-02T03:49:41", "url": "https://files.pythonhosted.org/packages/66/9e/b39794c594f9a4141a6d50cad3e858d8800b4cf7706c1a3306fb5739c5f1/chenhancc-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "24c1de187a6ec456b00387c17d748d13", "sha256": "6683af0c3f9d5a27c89aeb47c661da9d477f073324841c25dd8b6023a94313bb" }, "downloads": -1, "filename": "chenhancc-0.0.2.tar.gz", "has_sig": false, "md5_digest": "24c1de187a6ec456b00387c17d748d13", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 98922, "upload_time": "2017-10-03T03:12:18", "url": "https://files.pythonhosted.org/packages/e5/de/8d40d168e2e70f4dc72ddb9f3d35e075ebd8d27c4413865f57b84b4df761/chenhancc-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "4cb6cb0abab4fdef1d15577bb7cf6e52", "sha256": "8ffafdb04ad5ee8914fc60353cc727b9fbe691118e0c06ee0481a1a43d5f9a22" }, "downloads": -1, "filename": "chenhancc-0.0.3.tar.gz", "has_sig": false, "md5_digest": "4cb6cb0abab4fdef1d15577bb7cf6e52", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 172660, "upload_time": "2017-10-03T03:35:40", "url": "https://files.pythonhosted.org/packages/74/d1/845fc527e7c747d4e6a177b0c3d4a460de4a1f1a06935bab623ecdd5ac11/chenhancc-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "cd5f3bda27ff904c0b21918984c7f12e", "sha256": "322d94d958ddc986fc6e0deb93ed29b867c835e8effb7864febd9e04b9fabe68" }, "downloads": -1, "filename": "chenhancc-0.0.4.tar.gz", "has_sig": false, "md5_digest": "cd5f3bda27ff904c0b21918984c7f12e", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 173142, "upload_time": "2017-10-06T00:09:44", "url": "https://files.pythonhosted.org/packages/69/7f/da0d988940e385dbb012de8847c565cfb1c0864d2afb2eb038f2d64e1ccf/chenhancc-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "d68927125e6642edfc6435148d6e99d1", "sha256": "c7b17ea6b6168aedb096a8198082105ee5f0bc8d4feeef39413316fc5d757b85" }, "downloads": -1, "filename": "chenhancc-0.0.5.tar.gz", "has_sig": false, "md5_digest": "d68927125e6642edfc6435148d6e99d1", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 173056, "upload_time": "2017-10-06T00:29:44", "url": "https://files.pythonhosted.org/packages/fb/6e/61165180464161b6434c8598660f4a83fd14cf18e41a2fde0eab841a356f/chenhancc-0.0.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d68927125e6642edfc6435148d6e99d1", "sha256": "c7b17ea6b6168aedb096a8198082105ee5f0bc8d4feeef39413316fc5d757b85" }, "downloads": -1, "filename": "chenhancc-0.0.5.tar.gz", "has_sig": false, "md5_digest": "d68927125e6642edfc6435148d6e99d1", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 173056, "upload_time": "2017-10-06T00:29:44", "url": "https://files.pythonhosted.org/packages/fb/6e/61165180464161b6434c8598660f4a83fd14cf18e41a2fde0eab841a356f/chenhancc-0.0.5.tar.gz" } ] }