Code Monkey home page Code Monkey logo

voronoilibswift's People

Contributors

wilhelmoks avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

voronoilibswift's Issues

Polygon generation problems

Hello, I think I found a problem with the polygon generation algorithm. When using a specific set of coordinates I get a polygon with only 2 sides (in my code).

I adapted the iOS example with my own values to get a visualization for the problem at it is quite strange. Without filling in the polygons everything looks alright, but when turning on polygon fill you can clearly see that something is not right.

IMG_0066

IMG_0065

I modified the iOS example like this:

private func makeSites(forViewSize size: CGSize) {
        let numberOfSites = 30
        
        Random.setGlobalSeed(pointsSeed)
        
        var coords: [Double] = [467.14, 115.11, 467.14, 160.03, 467.14, 204.94, 467.14, 249.86, 467.14, 294.78, 467.14, 339.7, 496.64, 115.11, 496.64, 160.03, 496.64, 204.94, 496.64, 249.86, 496.64, 294.78, 496.64, 339.7, 526.14, 115.11, 526.14, 160.03, 526.14, 204.94, 526.14, 249.86, 526.14, 294.78, 526.14, 339.7, 674.12, 160.03, 555.64, 204.94, 555.64, 249.86, 555.64, 294.78, 555.64, 339.7, 585.14, 115.11, 585.14, 160.03, 585.14, 204.94, 585.14, 249.86, 585.14, 294.78, 585.14, 339.7, 614.64, 115.11, 614.64, 160.03, 614.64, 204.94, 614.64, 249.86, 614.64, 294.78, 614.64, 339.7, 644.14, 160.03, 644.14, 204.94, 644.14, 249.86, 644.14, 294.78, 644.14, 339.7, 673.64, 204.94, 673.64, 249.86, 673.64, 294.78, 673.64, 339.7, 703.14, 294.78, 703.14, 339.7]
        
        sitePoints = []
        
        var i: Int = 0
        
        while(i < coords.count) {
            let point = SIMD2<Double>(x: coords[i], y: coords[i+1])
            let color = randomColor()
            sitePoints.append(SitePoint(point: point, userData: color))
            
            i = i + 2
        }
        /*for _ in 0..<numberOfSites {
            let point = randomPointInArea(withSize: size)
            let color = randomColor()
            sitePoints.append(SitePoint(point: point, userData: color))
        }*/
    }

Memory leak

Hi, this is working well but creates zombies.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.