Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6151431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:46:06+00:00 2026-05-23T19:46:06+00:00

I have vector data for buildings on my map and want them to appear

  • 0

I have vector data for buildings on my map and want them to appear extruded, depending on known height.

I know this is a common task, but i didn’t find any satisfying solution.

I saw realization in mapnik, they use simple sort by minimum Y of all vertices in a polygon. As result, most are drawn right, but some are still overlapped (about 2-3%).

Buildings overlap if sorted just by minimum Y

In most cases it is enough just to sort buldings well (somehow?) and draw them in appropriate sequence (for above case this sequence would be 3-2-1).

In more complex cases, when polygons are concave and too close to each other, every wall and cap (roof) should be drawn separately (see below).

enter image description here

UPDATED:

So, there are two kinds of segments to draw: walls and caps. Wall segments are easy to order (by minimum Y). I can’t figure out how to order caps.

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T19:46:06+00:00Added an answer on May 23, 2026 at 7:46 pm

    In the case of straight walls it is easy to sort them by depth. Consider just their bases which are straight line segments. Note that each line divides the plane in two parts, one of them is closer to the viewer and the other is farther. For any segment A, call the closer part A+ and the farther part A-. Now, for any two segments A and B, at least one of the propositions holds:

    1. A lies entirely in B+
    2. A lies entirely in B-
    3. B lies entirely in A-
    4. B lies entirely in A+
    5. One segment is parallel to the line of sight and the other is entirely to the left or entirely to the right of it
    6. A and B intersect

    In cases 1 and 3, B should be drawn before A (A may occlude B, but B may not occlude A); in cases (2) and (4) A before B; in case 5, it doesn’t matter; and 6 should not occur for normal walls.

    You can now do a topological sort of the walls, and draw them from furthest to closest.

    As for roofs, this is not possible for concave buildings, since a part of the roof can be obscured by a wall which obscures another part of that same roof. Imagine a low U-shaped building, visible from its side, with a tall tower in the middle of the U. The tower will both obscure and be obscured by the U-roof, so in whatever order you draw them, the picture will be wrong.

    So you will have to subdivide concave roofs into convex polygons. Then it should be easy to sort them together with the walls, along the same principles.

    A totally another method is to use a Z-buffer, which frees you from thinking about the order. It is my impression that you can get Z-buffer on the lowest of the low-powered cell phone graphic cards these days.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have a vector: (def data [Hello World Test This]) And I want
I have a vector<set<char> > data structure (transactions database) and I want to know
I have a large nested vector that look like this: import Data.Vector let x
I have a vector that I want to insert into a set . This
I have a vector<char> of data which I want to write into std::stringstream .
I have a vector of discrete data and I want to simulate from the
I have a one dimensional vector of data in R and I want to
I have an std::vector<unsigned char> with binary data in. I just would like to
I have some data structures: all_unordered_m is a big vector containing all the strings
Say you have a simple class with some storage data structure (list, vector, queue,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.