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

  • Home
  • SEARCH
  • 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 103583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:08:48+00:00 2026-05-11T01:08:48+00:00

I am working on a project where I need to create a boundary around

  • 0

I am working on a project where I need to create a boundary around a group of rectangles.

Let’s use this picture as an example of what I want to accomplish.

EDIT: Couldn’t get the image tag to work properly, so here is the full link: http://www.flickr.com/photos/21093416@N04/3029621742/

We have rectangles A and C who are linked by a special link rectangle B. You could think of this as two nodes in a graph (A,C) and the edge between them (B). That means the rectangles have pointers to each other in the following manner: A->B, A<-B->C, C->B

Each rectangle has four vertices stored in an array where index 0 is bottom left, and index 3 is bottom right.

I want to ‘traverse’ this linked structure and calculate the vertices making up the boundary (red line) around it. I already have some small ideas around how to accomplish this, but want to know if some of you more mathematically inclined have some neat tricks up your sleeves.

The reason I post this here is just that someone might have solved a similar problem before, and have some ideas I could use. I don’t expect anyone to sit down and think this through long and hard. I’m going to work on a solution in parallell as I wait for answers.

Any input is greatly appreciated.

  • 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. 2026-05-11T01:08:49+00:00Added an answer on May 11, 2026 at 1:08 am

    Using the example, where rectangles are perpendicular to each other and can therefore be presented by four values (two x coordinates and two y coordinates):

       1   2   3   4   5   6  1  +---+---+    |       |    2  +   A   +---+---+    |       | B     | 3  +       +   +---+---+    |       |   |   |   | 4  +---+---+---+---+   +                |       | 5              +   C   +                |       | 6              +---+---+ 

    1) collect all the x coordinates (both left and right) into a list, then sort it and remove duplicates

    1 3 4 5 6

    2) collect all the y coordinates (both top and bottom) into a list, then sort it and remove duplicates

    1 2 3 4 6

    3) create a 2D array by number of gaps between the unique x coordinates * number of gaps between the unique y coordinates. It only needs to be one bit per cell, so in c++ a vector<bool> with likely give you a very memory-efficient version of this

    4 * 4

    4) paint all the rectangles into this grid

        1   3   4   5   6  1  +---+    | 1 | 0   0   0 2  +---+---+---+    | 1 | 1 | 1 | 0 3  +---+---+---+---+    | 1 | 1 | 1 | 1 | 4  +---+---+---+---+      0   0 | 1 | 1 | 6          +---+---+ 

    5) for each cell in the grid, for each edge, if the cell beside it in that cardinal direction is not painted, draw the boundary line for that edge


    In the question, the rectangles are described as being four vectors where each represents a corner. If each rectangle can be at arbitrary and different rotation from others, then the approach I’ve outlined above won’t work. The problem of finding the path around a complex polygon is regularly solved by vector graphics rasterizers, and a good approach to solving the problem is using a library such as Cairo to do the work for you!

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

Sidebar

Ask A Question

Stats

  • Questions 86k
  • Answers 86k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer userInteractionEnabled is not a method but a property. But I… May 11, 2026 at 5:22 pm
  • Editorial Team
    Editorial Team added an answer check this out Save Form Data With Cookies May 11, 2026 at 5:22 pm
  • Editorial Team
    Editorial Team added an answer If the application is, as you said, a very simple… May 11, 2026 at 5:22 pm

Related Questions

I am working on a project where I need to deal at the byte
I am working on a project for an IT class where I need to
I am working on a project where I produce an aluminium extrusion cutting list.
Edit: I am using SqlDataAdapters to fill the data sets. Sorry--I should have been

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.