## polygons – Question about error executing RegionResize of map

I want to resize the map of the country as below.

``````region = EntityValue[Entity["Country", "SouthKorea"], "Polygon"] /. g_GeoPosition :> g["LongitudeLatitude"]
newregion = RegionResize[region, 10]
``````

Also, all previously executed information will be erased.

``````mf = RegionMember[newregion]; mf[{125, 35}]
``````

I want to discriminate the inside and outside of the data with a resized map.
Could the error be caused by the map being disconnected? How can I solve this?

## geometry – What is the sum of angles of polygons on a sphere (and other Riemann surface)

The sum of the angles of a triangle on a sphere is $$pi (1+4f)$$, where $$f$$ is the fraction of the area enclosed by the triangle. Then is it true that the sum of the angles of an $$n$$-polygon is $$pi(n-2+4f)$$? By induction, we can divide an $$n$$-polygon into a $$n-1$$-polygon and a triangle so the area is $$pi (n-3+4f_{n-1}) + pi (1+4f_1) = pi (n-2 +4f_{n-1}+4f_1) = pi(n-2+4f)$$. The only issue is that we have to prove there exists such a geodesic contained in the polygons that divides it as desired. I think this holds in sphere but I’m not sure about other surfaces.

Also I’m curious about the results in other Riemann surface. For sphere we only need to consider the fraction of area because the curvature is constant. What if it’s not and how can we express the sum of the angles of triangle in terms of the curvature at the edges?

## Different colors (shadows) when using Graphics3D to plot polygons

I am trying to plot a list of polygons. I would like the color to be uniform, i.e yellow is strictly yellow. However, when I rotate it, the sides of the structure seem to have a shadow or just a different color i.e orange-ish instead of yellow. Here is the picture:

I think I can add something to the code to avoid this, but I am not sure what. I tried playing with the lighting and the MeshShading with no good results. Any help would be immensely appreciated.

## Bounding box of polygons intersection via boost geometry

I am trying to calculate the bounding box of the polygon which is result of intersection of 2 polygons. In my case, poly1 lies completely inside poly2 and I am aiming to get bounding box which just encapsulates poly1.
I am hoping to get code which works for the case when poly1 and poly2 overlap partially and not just completely within each other

``````                boost::geometry::Polygon poly1;

// Additional code to populate poly1
//

boost::geometry::Polygon poly2;

// Additional code to populate poly2
//

boost::geometry::correct(poly1);
boost::geometry::correct(poly2);

std::deque<boost::geometry::Polygon> output;
// Check poly1 inside poly2
// This check is TRUE with the data I have

bool completely_inside = boost::geometry::within(poly1.outer(), poly2.outer());
if (completely_inside)
{
output.push_back(poly1);

boost::geometry::model::box<boost::geometry::Point> box;
boost::geometry::envelope(output(0).outer(), box);
}
``````

Issue is that bounding box above is much bigger than the bounding box of the intersection of the 2 polygons. I am not sure what is wrong in above code as i am following right process.

## Is a point inside a graphics group composed of multiple Polygons and FilledCurves, not all overlapping?

I have many thousands of points, and I want to check if they are inside a GraphicsGroup that is composed of many Polygons and FilledCurves, similar to GeoWithin but without having to make tedious cloud inquiries.

I get RegionMember Errors and besides I suspect RegionMember is too smart to do a simple 2D numerical True/False test efficiently.

I’ve done this once many years ago by counting if a line from the point to infinity crossed all of the polygon segments an even or odd number of times, but would expect Mathematica to have an function already.

## discrete geometry – Convex Polyhedrons that can be Folded from Convex Polygons

This question is based on http://www.science.smith.edu/~jorourke/Papers/FoldingPP.pdf.

Therein is stated the theorem: Every convex polygon folds to an infinite number (a continuum) of noncongruent convex polyhedra.

Question: What could one say in the reverse direction: given any convex polyhedron, what could one say about the polygon(s) that could fold into it? If there are convex polyhedrons that cannot be folded from convex polygons, then, how does one characterize convex polyhedrons (such as for example, the regular tetrahedron) that can be folded out of convex polygons?

## discrete geometry – Folding Polygons into ‘Vessels’

This question is based on http://www.science.smith.edu/~jorourke/Papers/FoldingPP.pdf

Define an vessel as a convex polyhedron with one face removed – in other words, a vessel can be converted into a convex polyhedron by attaching to it exactly one convex polygonal face (the ‘lid’). The capacity of a vessel is the volume of this convex polyhedron

Note: in a gravitational field, the vessel will have to be suitably oriented/mounted for it to be filled to its capacity; insisting on the stability of the filled vessel will give a variant to this question.

Question: Given a polygonal region, how does one fold/wrap it into a vessel of maximum capacity?

Remarks: For example, starting with a unit square, we can form (not sure of optimality) a ‘tub’ with dimensions (2/3 X 2/3 X 1/6 which is not uniformly thick but has more capacity than the volume of the (closed) largest polyhedron (of uniform thickness) that can be folded from the unit square (‘Geometric Folding Algorithms’ by Demaine and O’Rourke, page 418-19).

It seems that starting with a convex polygonal sheet, to achieve maximum capacity, one necessarily will have to allow for some overlap/ folding over of the material (thus leading to a vessel of non-uniform thickness) – a Greek cross can be folded into a cubical vessel without any overlap but it is not convex.

## algorithms – How to find simple polygons in a complex polygon created by two lines

Given the image attached, I am looking for a way/strategy/pseudocode to iteratively find each polygon created either by two blue-dotted lines, a blue-dotted line and an intersection, or two intersections.

I have an ordered list of line segments for each line, an ordered list of blue-dotted lines (also stored as line segments), and an ordered list of intersections. Segments are stored as a list of two (x,y) tuples, intersections are stored as one (x,y) tuple. By ordered in this case I mean the shape has been processed from left to right, so everything is stored as if you were to follow the paths in an S shape from the bottom left to the top right.

At the moment I am processing each section of the polygon based on what is contained within two projections, although I don’t think this is a good way of going about it. I feel as though any attempt at an algorithm so far has overfit to this specific example. I’m fairly new to computational geometry so any help is appreciated.

## graphics – On the geometric transformations of polygons

Each starry set has the following property:

``````pts0 = {{1, 0}, {2, 2.5}, {3, 0}, {2.5, 3.5}, {4, 5}, {2.5, 4.5},
{2, 7}, {1.5, 4.5}, {0, 5}, {1.5, 3.5}, {1, 0}};
centroid = Mean(Drop(pts0, -1));
pts = Table(k pts0 + ConstantArray((1 - k) centroid, Length(pts0)), {k, 0, 1, 0.2});
plots = Table(Graphics({Red, Point(pts((k))), Blue, Line(pts((k)))}), {k, Length(pts)});
Show(plots)
``````

while if a set isn’t starry, this geometric transformation doesn’t work:

``````pts0 = {{1, 0}, {2, 0}, {2, 3}, {3, 3}, {3, 4}, {0, 4}, {0, 3}, {1, 3}, {1, 0}};
centroid = Mean(Drop(pts0, -1));
pts = Table(k pts0 + ConstantArray((1 - k) centroid, Length(pts0)), {k, 0, 1, 0.2});
plots = Table(Graphics({Red, Point(pts((k))), Blue, Line(pts((k)))}), {k, Length(pts)});
Show(plots)
``````

In the latter case, to get what you want, you can proceed manually:

``````pts0 = {{1, 0}, {2, 0}, {2, 3}, {3, 3}, {3, 4}, {0, 4}, {0, 3}, {1, 3}, {1, 0}};
offset = {{1, 1}, {-1, 1}, {-1, 1}, {-1, 1}, {-1, -1}, {1, -1}, {1, 1}, {1, 1}, {1, 1}};
pts = Table(pts0 + k offset, {k, 0, 0.5, 0.1});
plots = Table(Graphics({Red, Point(pts((k))), Blue, Line(pts((k)))}), {k, Length(pts)});
Show(plots)
``````

but I honestly can’t see a way to generalize it.

So, I’m here to ask if there’s a way to get the first and last graphic result via a single code, thanks!

## 2d – What does Polygon2D’s polygons property do?

If we venture down to the Godot source code, on `Polygon_2d.cpp` we find how `polygons` is used (here).

Godot expects the array to contain arrays of integers. Reading the code we can also figure out that they are indexes (0 based) for the points.

So, let us try that. We create a `Polygon2D` on the editor, give it a set of points, and then in the `polygons` property we add `PoolIntArray` elements (Using a regular `Array` and adding `int` values also works). On each we add the indexes for the points.

Here I placed points in a grid, and created a couple polygons using the `polygons` property:

I placed the odd rows are left to right, and even rows are right to left, just because it was easy.

As we can see the single `Polygon2D` node is capable of representing multiple polygons created from the same set of points. The `polygons` property of `Polygon2D` specifies the lists of indexes that make up those polygons. That’s what the `Polygon2D`‘s `polygons` property does.

When we set something to it, the `Polygon2D` disappears because it will not longer create a single polygon loopings the points in the `polygon` property. Instead the `polygons` property specifies the indexes for the points to create multiple polygons. And, of course, setting anything invalid results in nothing visible.

It is worth noting that the property is just specified as “Array”. The type system does not tell an array of what (it is `Variant`, actually). And the editor will let you add elements to the `Array` that are not valid for this property. Which fails silently (there is no warning or error message).

However, if I add valid arrays of integers, and in them I set negative number, I get an error.

Also worth noting is that they are actually drawn as separate polygons. Here I have made some overlapping polygons and gave them some alpha transparency:

I used alpha on the `Polygon2D` color for that screenshot. However, using alpha on modulate has the same result.

As you can see the overlapping area appears more opaque.