Quantcast

Modifying a LibGEOS.Point inplace

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Modifying a LibGEOS.Point inplace

omri_treidel
This post has NOT been accepted by the mailing list yet.
I'm using LibGEOS to test whether a point is contained inside a polygon.

```julia
N = 100000
pos = [2rand(2) for i=1:N]
p2 = parseWKT("POLYGON((0 0,1 0,1 1,0 1,0 0))")

function test1(points, poly)
    N = length(points)
    sel = falses(N)
    for i=1:N
        sel[i] = contains(poly, Point(points[i]))
    end
    return collect(1:N)[sel]
end
```

My code is slow since I'm creating a new Point every iteration. Is there any way to simply modify it inpalce?
Loading...