#Not sure why the vertical one are not

1 messages · Page 1 of 1 (latest)

hidden cargo
#

Let's say you have label: "Area size: 400m^2" - it's width is greater than height always so that's why the vertical bars would not fit the label

storm bay
#

Not following you. The width and the height are the same

hidden cargo
#

Oh, sorry! the width and height of the LABEL itself

storm bay
#

Oh, you are trying to place a label inside a shape.

hidden cargo
#

Like the whole phrase is always longer than taller.. if I'm clear 😆

#

Yeah, exactly!

storm bay
#

So at the end, we are not placing a point, but a box.

#

The problem is:
What is the place where the margin of the box would be the largest.

hidden cargo
#

It's true, but I think if we have a center point then in most cases there would be no problem with the rect box to overlap outside

hidden cargo
storm bay
#

So, we could work the following:
What is the point with largest horizontal space.

hidden cargo
#

In that shape the red box is larger, but the best place to put the label is the green one:

storm bay
#

Why is it the case ? We need to define the problem without ambiguity before solving it.

hidden cargo
#

Okay, you are indeed right...

#

It's weird how little is there about this topic

storm bay
#

Do you see how the described the problem. "the most distant internal point from the polygon outline"

hidden cargo
#

Here is the ss of some game having the labels inside some shapes as well

storm bay
#

It is not what you want.

#

At least, that what you said.

hidden cargo
#

I've read about it on some blog and I think it meets the idea of putting the label inside the best spot:

storm bay
#

The example of the right wouldnt be the best spot ?

hidden cargo
#

Yeah, certainly

#

It's visually the center of this concave shape. I know the center of the mass is outside it

#

But the green point is the most logical place to place a label in my opinion

storm bay
#

I mean, the real one would be in the center of the lower part of the rectangle

hidden cargo
#

Same for the left example ofc

#

I would be happy with any solution that at least fit within this rule that the label has to be inside the shape. The best solution would be to center it but it's not required that much now

storm bay
#

Could you state your problem without ambiguity ?

hidden cargo
#

My problem is that I can make a label that is centered inside the CONVEX polygon. But I can't if it's a NON-CONVEX (concave)

#

That's the main problem for me

storm bay
#

You need to define the second half of the problem. I proposed multiple definition, be there were not what you wanted.

#

We cannot work on solving something that has not been defined.

hidden cargo
#

Okay let me draw some examples so we are on the same page then

storm bay
#

I need a word base definition like: "the most distant internal point from the polygon outline"

#

Otherwise, the problem is: What is the problem without ambiguity.

hidden cargo
#

But I can't find the better wording than:
"The center point of an concave shape that lays in that shape"

#

Don't mind with the box etc. as we said earlier, just as the above ^

storm bay
#

The issue is that the center point of a concave shape does not exists.

#

So, define the center point of a concave shape.

#

If you cannot define that, you wont be able to solve your issue.

hidden cargo
#

Looking at this map of US all the labels are well centerized inside each state

#

For example the Texas is the state with an concave shape

storm bay
#

Look at Mississipi and Alabama

#

The problem is even greater than what you are sayinh

hidden cargo
#

I'm just hopeless now xD I know it's hard to define this problem as I spent whole day on it..

I don't know what is the best way to call it but I would like to not pay attention to details like the case of Missisipi

#

Maybe the best way to resolve is to find the biggest possible rectangle in given shape and take it center as a center point of that shape and put label in it?

storm bay
#

Look at Lousiana then. It looks like the L shape one where you said the corner was the best spot

hidden cargo
#

What do you think..

storm bay
#

I think it sound perfect

#

Could you solve this problem ?

hidden cargo
hidden cargo
storm bay
#

I would start by trying to search on internet. Ask Chatgpt, that could be a good use case for that AI.

hidden cargo
#

Is it even possible to find the largest rectangle in given non-convex shape?

storm bay
#

It sure is.

#

Because it exists

hidden cargo
storm bay
#

What you want to know is what is the algorithmic complexity

#

but in your case, I'm pretty sure it does not even matter.

#

If it were something like a map with a lot of irregularity.

#

it would be something else

hidden cargo
#

No there are sets of 3 to like 20 points maximum.. so the level of complexity is practically a zero

#

Thanks for help, will inform you tomorrow if I found the solution

storm bay
#

See how it could help you.

#

Beware though, it is really goods at giving answer that seem to work but does not.

hidden cargo
#

In that shape the future algorithm would take the '2' as the best place to place a label, but logically it should be the '1'.

#

oh..

#

Never mind

#

The biggest box, not the widest one.. My bad

#

But let's say the '2' is a lot wider so the area of it is greater than the area of '1'
So there is a possibility to get weird result

#

But at least it resolves the problem of the label being inside this shape

#

Which is already huge

storm bay
#

I feel like that you cold solve the problem like a CSP. Your graph would be all the possible configuration of line such as D is to the left of B, A is to the top of C and that the resulting rectangle is fully inside the polygone.

#

The graph being the starts that is not a valid state.

#

You can then use any pathfinding algorithm you want.