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

Modifying a LibGEOS.Point inplace

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.

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]))
    return collect(1:N)[sel]

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