Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could be much faster #2

Open
Permafacture opened this issue Jul 26, 2014 · 0 comments
Open

Could be much faster #2

Permafacture opened this issue Jul 26, 2014 · 0 comments

Comments

@Permafacture
Copy link

I happened to implement this algorithm and found my version much faster. Also, I could not get your version to do 200000 pts (which who knows if anyone needs that). Situations such as being on a server might benefit from a faster, less resource intense implementation. Here's my Visvalingam-Whyatt code

Here is a comparison between our two implementations I did in IPython.

import numpy as np
from visvalingam.visvalingam import VisvalingamSimplification
from polysimplify import VWSimplifier
n = 5000
thetas = np.linspace(0,2*np.pi,n)
thetas = np.linspace(0,2*np.pi,n)
pts = [[np.sin(x),np.cos(x)] for x in thetas]

def milkbread(pts):
    simplifier = VisvalingamSimplification(pts)
    simplifier.enrichLineString()

def permafacture(pts):
    simplifier = VWSimplifier(pts)

%timeit milkbread(pts)
    1 loops, best of 3: 21.7 s per loop

%timeit permafacture(pts)
    10 loops, best of 3: 115 ms per loop

len(pts)
5000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant