Giter Club home page Giter Club logo

Comments (4)

pkra avatar pkra commented on July 21, 2024 1

Also: this is a wonderful tool -- thank you!

from city-roads.

anvaka avatar anvaka commented on July 21, 2024 1

Found a solution that doesn't consume as much CPU power as my original version. You can try it now, by loading a city, and then in the browser's developer tools, enter this command:

scene.queryLayer().lineWidth = 2; // Sets new width to lines.

from city-roads.

anvaka avatar anvaka commented on July 21, 2024

Thank you! I'd totally love to do this, but I don't know how to do it efficiently.

Right now it is not uncommon to have a road graph with 100,000+ segments, each encoded as a pair of coordinates (x, y).

To render segments I'm using gl.LINES draw type, which is very fast, and needs just two points per segment.

The only way that I know how to add thickness to the line is via triangulation. We turn each line segment into a rectangle, and then split it into two triangles. This method would require much more memory and a little bit more pre-processing.

Even if we don't consider memory consumption a problem, there is another thing that I haven't solved yet. My current implementation of thick lines doesn't have smooth transition between connected segments, which gives very jagged experience on high zoom levels:

image

I'm learning webgl myself, and if there are some good tricks that could help us get thick lines in the most efficient manner - please share!

from city-roads.

pkra avatar pkra commented on July 21, 2024

Thanks for taking the time to respond, @anvaka ! I don't know much about webgl, I'm afraid. But I did notice that the SVG export is relatively easy to customize afterwards (by increasing the stroke-width of the <g> wrapping around the paths).

from city-roads.

Related Issues (20)

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.