문제

I am working on the cutting problem, and I need to figure out how to represent the solution.

For example look at this image, where the gray areas are unused material.

enter image description here

Can you please recommend me possible representations? By the way I am using c++ for this.

Thanks

도움이 되었습니까?

해결책

You could use a vector of structs std::vector<sub> areas; like

struct sub
{
  size_t x, y;
  size_t extent_x, extent_y;
  sub (void) : x(0U), y(0U), extent_x(0U), extent_y(0U) { }
};

Where (x,y) as well as (x+extent_x, y+extent_y) are mapped on the Points of the total image. This vector may either store used or unused parts of the Image.

다른 팁

The 2D image looks like a system memory. Gray area is un-allocated memory and white space is allocated memory. The solution can be similar to memory management done by OS.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top