{"action":"created","comment":{"url":"https://api.github.com/repos/sintefmath/Splipy/pulls/comments/56496077","id":56496077,"diff_hunk":"@@ -892,6 +893,87 @@ def force_rational(self):\n \n         return self\n \n+    def split(self, knots, direction=0):\n+        \"\"\"Split an object into two or more separate representations with C0\n+        continuity between them.\n+\n+        :param int direction: The parametric direction to split in\n+        :param knots: The splitting points\n+        :type knots: float or [float]\n+        :param direction: Parametric direction\n+        :type direction: int\n+        :return: The new volumes\n+        :rtype: [Volume]\n+        \"\"\"\n+        # for single-value input, wrap it into a list\n+        knots = ensure_listlike(knots)\n+\n+        # error test input\n+        direction = check_direction(direction, self.pardim)\n+\n+        p = self.order(direction)\n+        results = []\n+        splitting_obj = self.clone()\n+        bases = self.bases\n+        # insert knots to produce C{-1} at all splitting points\n+        for k in knots:\n+            continuity = bases[direction].continuity(k)\n+            if continuity == np.inf:\n+                continuity = p - 1\n+            splitting_obj.insert_knot([k] * (continuity + 1), direction)\n+\n+        b = splitting_obj.bases[direction]\n+        if b.periodic > -1:\n+            mu = bisect_left(b.knots, knots[0])\n+            b.roll(mu)\n+            splitting_obj.controlpoints = np.roll(splitting_obj.controlpoints, -mu, direction)\n+            b.knots = b.knots[:-b.periodic-1]\n+            b.periodic = -1\n+            if len(knots) > 1:\n+                return splitting_obj.split(knots[1:], direction)\n+            else:\n+                return splitting_obj\n+\n+        # search for the right subclass constructor, i.e. Volume, Surface or Curve\n+        spline_object = [c for c in SplineObject.__subclasses__() if c._intended_pardim == len(bases)]\n+        spline_object = spline_object[0]\n+\n+        # everything is available now, just have to find the right index range\n+        # in the knot vector and controlpoints to store in each separate curve\n+        # piece\n+        last_cp_i = 0\n+        last_knot_i = 0\n+\n+        bases = splitting_obj.bases\n+        b     = bases[direction]\n+        cp_slice = [slice(None, None, None)] * len(self.controlpoints.shape)\n+        for k in knots:\n+            if self.start(direction) < k < self.end(direction): # skip start/end points\n+                mu = bisect_left(b.knots, k)\n+                n_cp = mu - last_knot_i\n+                print last_knot_i, mu","path":"splipy/SplineObject.py","position":127,"original_position":70,"commit_id":"4c30758ea79fdb6aaaba421fd51d1ac6cd4226a9","original_commit_id":"f0787890697247fddcc122e25f5482634af4ceda","user":{"login":"TheBB","id":619375,"avatar_url":"https://avatars.githubusercontent.com/u/619375?v=3","gravatar_id":"","url":"https://api.github.com/users/TheBB","html_url":"https://github.com/TheBB","followers_url":"https://api.github.com/users/TheBB/followers","following_url":"https://api.github.com/users/TheBB/following{/other_user}","gists_url":"https://api.github.com/users/TheBB/gists{/gist_id}","starred_url":"https://api.github.com/users/TheBB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheBB/subscriptions","organizations_url":"https://api.github.com/users/TheBB/orgs","repos_url":"https://api.github.com/users/TheBB/repos","events_url":"https://api.github.com/users/TheBB/events{/privacy}","received_events_url":"https://api.github.com/users/TheBB/received_events","type":"User","site_admin":false},"body":"!!","created_at":"2016-03-17T12:33:31Z","updated_at":"2016-03-17T12:33:31Z","html_url":"https://github.com/sintefmath/Splipy/pull/76#discussion_r56496077","pull_request_url":"https://api.github.com/repos/sintefmath/Splipy/pulls/76","_links":{"self":{"href":"https://api.github.com/repos/sintefmath/Splipy/pulls/comments/56496077"},"html":{"href":"https://github.com/sintefmath/Splipy/pull/76#discussion_r56496077"},"pull_request":{"href":"https://api.github.com/repos/sintefmath/Splipy/pulls/76"}}},"pull_request":{"url":"https://api.github.com/repos/sintefmath/Splipy/pulls/76","id":62398206,"html_url":"https://github.com/sintefmath/Splipy/pull/76","diff_url":"https://github.com/sintefmath/Splipy/pull/76.diff","patch_url":"https://github.com/sintefmath/Splipy/pull/76.patch","issue_url":"https://api.github.com/repos/sintefmath/Splipy/issues/76","number":76,"state":"open","locked":false,"title":"Assorted bugfixes","user":{"login":"VikingScientist","id":3500376,"avatar_url":"https://avatars.githubusercontent.com/u/3500376?v=3","gravatar_id":"","url":"https://api.github.com/users/VikingScientist","html_url":"https://github.com/VikingScientist","followers_url":"https://api.github.com/users/VikingScientist/followers","following_url":"https://api.github.com/users/VikingScientist/following{/other_user}","gists_url":"https://api.github.com/users/VikingScientist/gists{/gist_id}","starred_url":"https://api.github.com/users/VikingScientist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VikingScientist/subscriptions","organizations_url":"https://api.github.com/users/VikingScientist/orgs","repos_url":"https://api.github.com/users/VikingScientist/repos","events_url":"https://api.github.com/users/VikingScientist/events{/privacy}","received_events_url":"https://api.github.com/users/VikingScientist/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-03-10T14:36:11Z","updated_at":"2016-03-17T12:33:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9d5c6902dd83beb884cfee11bc2f0aeacc68317d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/sintefmath/Splipy/pulls/76/commits","review_comments_url":"https://api.github.com/repos/sintefmath/Splipy/pulls/76/comments","review_comment_url":"https://api.github.com/repos/sintefmath/Splipy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sintefmath/Splipy/issues/76/comments","statuses_url":"https://api.github.com/repos/sintefmath/Splipy/statuses/4c30758ea79fdb6aaaba421fd51d1ac6cd4226a9","head":{"label":"VikingScientist:master","ref":"master","sha":"4c30758ea79fdb6aaaba421fd51d1ac6cd4226a9","user":{"login":"VikingScientist","id":3500376,"avatar_url":"https://avatars.githubusercontent.com/u/3500376?v=3","gravatar_id":"","url":"https://api.github.com/users/VikingScientist","html_url":"https://github.com/VikingScientist","followers_url":"https://api.github.com/users/VikingScientist/followers","following_url":"https://api.github.com/users/VikingScientist/following{/other_user}","gists_url":"https://api.github.com/users/VikingScientist/gists{/gist_id}","starred_url":"https://api.github.com/users/VikingScientist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VikingScientist/subscriptions","organizations_url":"https://api.github.com/users/VikingScientist/orgs","repos_url":"https://api.github.com/users/VikingScientist/repos","events_url":"https://api.github.com/users/VikingScientist/events{/privacy}","received_events_url":"https://api.github.com/users/VikingScientist/received_events","type":"User","site_admin":false},"repo":{"id":53591134,"name":"Splipy","full_name":"VikingScientist/Splipy","owner":{"login":"VikingScientist","id":3500376,"avatar_url":"https://avatars.githubusercontent.com/u/3500376?v=3","gravatar_id":"","url":"https://api.github.com/users/VikingScientist","html_url":"https://github.com/VikingScientist","followers_url":"https://api.github.com/users/VikingScientist/followers","following_url":"https://api.github.com/users/VikingScientist/following{/other_user}","gists_url":"https://api.github.com/users/VikingScientist/gists{/gist_id}","starred_url":"https://api.github.com/users/VikingScientist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VikingScientist/subscriptions","organizations_url":"https://api.github.com/users/VikingScientist/orgs","repos_url":"https://api.github.com/users/VikingScientist/repos","events_url":"https://api.github.com/users/VikingScientist/events{/privacy}","received_events_url":"https://api.github.com/users/VikingScientist/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/VikingScientist/Splipy","description":"Spline modelling and preprocessing tool","fork":true,"url":"https://api.github.com/repos/VikingScientist/Splipy","forks_url":"https://api.github.com/repos/VikingScientist/Splipy/forks","keys_url":"https://api.github.com/repos/VikingScientist/Splipy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/VikingScientist/Splipy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/VikingScientist/Splipy/teams","hooks_url":"https://api.github.com/repos/VikingScientist/Splipy/hooks","issue_events_url":"https://api.github.com/repos/VikingScientist/Splipy/issues/events{/number}","events_url":"https://api.github.com/repos/VikingScientist/Splipy/events","assignees_url":"https://api.github.com/repos/VikingScientist/Splipy/assignees{/user}","branches_url":"https://api.github.com/repos/VikingScientist/Splipy/branches{/branch}","tags_url":"https://api.github.com/repos/VikingScientist/Splipy/tags","blobs_url":"https://api.github.com/repos/VikingScientist/Splipy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/VikingScientist/Splipy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/VikingScientist/Splipy/git/refs{/sha}","trees_url":"https://api.github.com/repos/VikingScientist/Splipy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/VikingScientist/Splipy/statuses/{sha}","languages_url":"https://api.github.com/repos/VikingScientist/Splipy/languages","stargazers_url":"https://api.github.com/repos/VikingScientist/Splipy/stargazers","contributors_url":"https://api.github.com/repos/VikingScientist/Splipy/contributors","subscribers_url":"https://api.github.com/repos/VikingScientist/Splipy/subscribers","subscription_url":"https://api.github.com/repos/VikingScientist/Splipy/subscription","commits_url":"https://api.github.com/repos/VikingScientist/Splipy/commits{/sha}","git_commits_url":"https://api.github.com/repos/VikingScientist/Splipy/git/commits{/sha}","comments_url":"https://api.github.com/repos/VikingScientist/Splipy/comments{/number}","issue_comment_url":"https://api.github.com/repos/VikingScientist/Splipy/issues/comments{/number}","contents_url":"https://api.github.com/repos/VikingScientist/Splipy/contents/{+path}","compare_url":"https://api.github.com/repos/VikingScientist/Splipy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/VikingScientist/Splipy/merges","archive_url":"https://api.github.com/repos/VikingScientist/Splipy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/VikingScientist/Splipy/downloads","issues_url":"https://api.github.com/repos/VikingScientist/Splipy/issues{/number}","pulls_url":"https://api.github.com/repos/VikingScientist/Splipy/pulls{/number}","milestones_url":"https://api.github.com/repos/VikingScientist/Splipy/milestones{/number}","notifications_url":"https://api.github.com/repos/VikingScientist/Splipy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/VikingScientist/Splipy/labels{/name}","releases_url":"https://api.github.com/repos/VikingScientist/Splipy/releases{/id}","deployments_url":"https://api.github.com/repos/VikingScientist/Splipy/deployments","created_at":"2016-03-10T14:32:37Z","updated_at":"2016-03-10T14:32:38Z","pushed_at":"2016-03-14T14:44:12Z","git_url":"git://github.com/VikingScientist/Splipy.git","ssh_url":"git@github.com:VikingScientist/Splipy.git","clone_url":"https://github.com/VikingScientist/Splipy.git","svn_url":"https://github.com/VikingScientist/Splipy","homepage":"http://sintefmath.github.io/Splipy/","size":6608,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"sintefmath:master","ref":"master","sha":"4b6269a3cc2e4d728941886beaf178b52e0e39ca","user":{"login":"sintefmath","id":1901550,"avatar_url":"https://avatars.githubusercontent.com/u/1901550?v=3","gravatar_id":"","url":"https://api.github.com/users/sintefmath","html_url":"https://github.com/sintefmath","followers_url":"https://api.github.com/users/sintefmath/followers","following_url":"https://api.github.com/users/sintefmath/following{/other_user}","gists_url":"https://api.github.com/users/sintefmath/gists{/gist_id}","starred_url":"https://api.github.com/users/sintefmath/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sintefmath/subscriptions","organizations_url":"https://api.github.com/users/sintefmath/orgs","repos_url":"https://api.github.com/users/sintefmath/repos","events_url":"https://api.github.com/users/sintefmath/events{/privacy}","received_events_url":"https://api.github.com/users/sintefmath/received_events","type":"Organization","site_admin":false},"repo":{"id":45246019,"name":"Splipy","full_name":"sintefmath/Splipy","owner":{"login":"sintefmath","id":1901550,"avatar_url":"https://avatars.githubusercontent.com/u/1901550?v=3","gravatar_id":"","url":"https://api.github.com/users/sintefmath","html_url":"https://github.com/sintefmath","followers_url":"https://api.github.com/users/sintefmath/followers","following_url":"https://api.github.com/users/sintefmath/following{/other_user}","gists_url":"https://api.github.com/users/sintefmath/gists{/gist_id}","starred_url":"https://api.github.com/users/sintefmath/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sintefmath/subscriptions","organizations_url":"https://api.github.com/users/sintefmath/orgs","repos_url":"https://api.github.com/users/sintefmath/repos","events_url":"https://api.github.com/users/sintefmath/events{/privacy}","received_events_url":"https://api.github.com/users/sintefmath/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sintefmath/Splipy","description":"Spline modelling and preprocessing tool","fork":false,"url":"https://api.github.com/repos/sintefmath/Splipy","forks_url":"https://api.github.com/repos/sintefmath/Splipy/forks","keys_url":"https://api.github.com/repos/sintefmath/Splipy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sintefmath/Splipy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sintefmath/Splipy/teams","hooks_url":"https://api.github.com/repos/sintefmath/Splipy/hooks","issue_events_url":"https://api.github.com/repos/sintefmath/Splipy/issues/events{/number}","events_url":"https://api.github.com/repos/sintefmath/Splipy/events","assignees_url":"https://api.github.com/repos/sintefmath/Splipy/assignees{/user}","branches_url":"https://api.github.com/repos/sintefmath/Splipy/branches{/branch}","tags_url":"https://api.github.com/repos/sintefmath/Splipy/tags","blobs_url":"https://api.github.com/repos/sintefmath/Splipy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sintefmath/Splipy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sintefmath/Splipy/git/refs{/sha}","trees_url":"https://api.github.com/repos/sintefmath/Splipy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sintefmath/Splipy/statuses/{sha}","languages_url":"https://api.github.com/repos/sintefmath/Splipy/languages","stargazers_url":"https://api.github.com/repos/sintefmath/Splipy/stargazers","contributors_url":"https://api.github.com/repos/sintefmath/Splipy/contributors","subscribers_url":"https://api.github.com/repos/sintefmath/Splipy/subscribers","subscription_url":"https://api.github.com/repos/sintefmath/Splipy/subscription","commits_url":"https://api.github.com/repos/sintefmath/Splipy/commits{/sha}","git_commits_url":"https://api.github.com/repos/sintefmath/Splipy/git/commits{/sha}","comments_url":"https://api.github.com/repos/sintefmath/Splipy/comments{/number}","issue_comment_url":"https://api.github.com/repos/sintefmath/Splipy/issues/comments{/number}","contents_url":"https://api.github.com/repos/sintefmath/Splipy/contents/{+path}","compare_url":"https://api.github.com/repos/sintefmath/Splipy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sintefmath/Splipy/merges","archive_url":"https://api.github.com/repos/sintefmath/Splipy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sintefmath/Splipy/downloads","issues_url":"https://api.github.com/repos/sintefmath/Splipy/issues{/number}","pulls_url":"https://api.github.com/repos/sintefmath/Splipy/pulls{/number}","milestones_url":"https://api.github.com/repos/sintefmath/Splipy/milestones{/number}","notifications_url":"https://api.github.com/repos/sintefmath/Splipy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sintefmath/Splipy/labels{/name}","releases_url":"https://api.github.com/repos/sintefmath/Splipy/releases{/id}","deployments_url":"https://api.github.com/repos/sintefmath/Splipy/deployments","created_at":"2015-10-30T11:00:23Z","updated_at":"2016-03-10T10:22:52Z","pushed_at":"2016-03-14T14:44:12Z","git_url":"git://github.com/sintefmath/Splipy.git","ssh_url":"git@github.com:sintefmath/Splipy.git","clone_url":"https://github.com/sintefmath/Splipy.git","svn_url":"https://github.com/sintefmath/Splipy","homepage":"http://sintefmath.github.io/Splipy/","size":6543,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":13,"forks":1,"open_issues":13,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sintefmath/Splipy/pulls/76"},"html":{"href":"https://github.com/sintefmath/Splipy/pull/76"},"issue":{"href":"https://api.github.com/repos/sintefmath/Splipy/issues/76"},"comments":{"href":"https://api.github.com/repos/sintefmath/Splipy/issues/76/comments"},"review_comments":{"href":"https://api.github.com/repos/sintefmath/Splipy/pulls/76/comments"},"review_comment":{"href":"https://api.github.com/repos/sintefmath/Splipy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sintefmath/Splipy/pulls/76/commits"},"statuses":{"href":"https://api.github.com/repos/sintefmath/Splipy/statuses/4c30758ea79fdb6aaaba421fd51d1ac6cd4226a9"}}}}