{"action":"created","issue":{"url":"https://api.github.com/repos/adamlwgriffiths/Pyrr/issues/21","labels_url":"https://api.github.com/repos/adamlwgriffiths/Pyrr/issues/21/labels{/name}","comments_url":"https://api.github.com/repos/adamlwgriffiths/Pyrr/issues/21/comments","events_url":"https://api.github.com/repos/adamlwgriffiths/Pyrr/issues/21/events","html_url":"https://github.com/adamlwgriffiths/Pyrr/issues/21","id":50262699,"number":21,"title":"2D ","user":{"login":"Permafacture","id":6076141,"avatar_url":"https://avatars.githubusercontent.com/u/6076141?v=3","gravatar_id":"","url":"https://api.github.com/users/Permafacture","html_url":"https://github.com/Permafacture","followers_url":"https://api.github.com/users/Permafacture/followers","following_url":"https://api.github.com/users/Permafacture/following{/other_user}","gists_url":"https://api.github.com/users/Permafacture/gists{/gist_id}","starred_url":"https://api.github.com/users/Permafacture/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Permafacture/subscriptions","organizations_url":"https://api.github.com/users/Permafacture/orgs","repos_url":"https://api.github.com/users/Permafacture/repos","events_url":"https://api.github.com/users/Permafacture/events{/privacy}","received_events_url":"https://api.github.com/users/Permafacture/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2014-11-27T07:37:10Z","updated_at":"2015-03-28T23:42:37Z","closed_at":null,"body":"I couldn't find any way to communicate other than filing a bug.\r\n\r\nI've been programming in python as a hobby for 5 years.  I contributed heavily to a now abandoned non sequential ray tracer using cython.  My interest in ray tracing is for optics but I know it can be applied to many fields and I'd like there to be a go to python library for scientists.\r\n\r\nI'm very interested in contributing to a fast python geometry library.  Specifically, in computing intersections and normals of rays and 2D surfaces (even more specifically, rational b splines) for 2d ray tracing.  Bivariate b splines are a more than a bit over my head, but I'd be interested in that 3D possibility.  In 3d, I'd be willing to go as far as a triangular mesh.\r\n\r\nIs there any interest here in 2d geometry or computing normals (which I'd use for raytracing)?"},"comment":{"url":"https://api.github.com/repos/adamlwgriffiths/Pyrr/issues/comments/87330966","html_url":"https://github.com/adamlwgriffiths/Pyrr/issues/21#issuecomment-87330966","issue_url":"https://api.github.com/repos/adamlwgriffiths/Pyrr/issues/21","id":87330966,"user":{"login":"Permafacture","id":6076141,"avatar_url":"https://avatars.githubusercontent.com/u/6076141?v=3","gravatar_id":"","url":"https://api.github.com/users/Permafacture","html_url":"https://github.com/Permafacture","followers_url":"https://api.github.com/users/Permafacture/followers","following_url":"https://api.github.com/users/Permafacture/following{/other_user}","gists_url":"https://api.github.com/users/Permafacture/gists{/gist_id}","starred_url":"https://api.github.com/users/Permafacture/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Permafacture/subscriptions","organizations_url":"https://api.github.com/users/Permafacture/orgs","repos_url":"https://api.github.com/users/Permafacture/repos","events_url":"https://api.github.com/users/Permafacture/events{/privacy}","received_events_url":"https://api.github.com/users/Permafacture/received_events","type":"User","site_admin":false},"created_at":"2015-03-28T23:42:37Z","updated_at":"2015-03-28T23:42:37Z","body":"Hey,\r\n\r\nI've got some messy code (embarassed to show it at this point) that is starting to do what I want.  Here's how a user uses it (only does line intersections right now):\r\n\r\n'''python\r\nif __name__ == '__main__':\r\n    import matplotlib.pyplot as plt\r\n    from composite_geometry import Lines2d\r\n    from base_geometry import Vec2d\r\n\r\n    n = 5\r\n    begins1 = np.random.randint(-25,25,(n,2))\r\n    ends1 = np.random.randint(-25,25,(n,2))\r\n    segs1 = Lines2d(begin=begins1,end=ends1)\r\n\r\n    m=7\r\n    begins2 = np.random.randint(-25,25,(m,m,2))\r\n    ends2 =np.random.randint(-25,25,(m,m,2))\r\n    segs2 = Lines2d(begin=begins2,end=ends2)\r\n\r\n    #plot segments\r\n    xs,ys = export2mpl(segs1)\r\n    plt.plot(xs,ys,'b') #blue solid\r\n    xs,ys = export2mpl(segs2)\r\n    plt.plot(xs,ys,'g--') #dashed green\r\n    \r\n    #plot the begining of all segments in segs2\r\n    xs,ys = export2mpl(segs2['begin'])\r\n    plt.plot(xs,ys,'ko')  #black dot\r\n\r\n    #Set up result object (not calculated untill results are access) \r\n    result = LineLineIntersect(segs1,segs2)\r\n\r\n    ###plot segs2 from begining to first intersection###\r\n    \r\n    #Get the parameter of point intersections in the frame of segs2\r\n    ub = result.points[segs2] #actually triggers calculation\r\n\r\n    #result.lines[segs2], the line segments representing co-linear overlap\r\n    # has not been calculated, but would be if accessed\r\n\r\n    axis = 2  #manually specify the axis representing segs2 \r\n    shortest = np.nanmin(ub.arr,axis=axis)  #smallest parameter is first intersection\r\n    pts = segs2.eval_param(shortest)\r\n    \r\n    #create new line segments that represent segs2 from begining to first intersection\r\n    short_lines = Lines2d(begin=segs2['begin'].arr, end=pts.arr)\r\n    xs,ys =batched_mpl(short_lines) \r\n    plt.plot(xs,ys,'g')  #solid green\r\n    plt.show()\r\n'''\r\n\r\nResult:\r\n\r\n![simple_trace](https://cloud.githubusercontent.com/assets/6076141/6883400/8f945416-d579-11e4-8bc8-a737a1b91ae1.png)\r\n\r\n\r\n\r\nI'm a bit stuck mucking through making better tools for using named axes (Ie, shortest = min(ub.arr,axis=segs1)).  I thought a good next step is to see if I can make this code do some of what you are actually using it for. If it is more performant (which I strongly suspect) and more useful to you, I'll know to keep going.\r\n\r\nI'd prefer to keep as much communication public as possible, but if this one bug report is not the best forum for communication, we could use email (list-serve?) My email address is my user name at gmail.  "}}