# Tag Info

15

One way to solve the case provided is to apply a DistanceFunction to FindShortestTour. Here, I apply a stiff penalty to the next point that does not share an X or Y value with the current point. pts = {{1, 0}, {2, 0}, {2, 3}, {3, 3}, {3, 4}, {0, 4}, {0, 3}, {1, 3}, {1, 0}}; (*randomize points*) pts = (#[[RandomSample[Range[Length@#], Length@#]]]) &[...

13

Having Area generate conditions is informative: Area[ RegionIntersection[ Polygon[{{1, 2}, {-1, 1}, {2, 5}}], Polygon[{{2, 4}, {1, -3}, {1, a}}] ], GenerateConditions -> True ] (* Out: ConditionalExpression[0, a < 2] *) Indeed, for $a<2$ there is no intersection, so the area of the intersection is correctly $0$. On the one hand, we ...

9

For two points a and b, we rotation and scale the segment t*a + (1 - t)*b in the plane and then lift it to space,all of the transformation according to the parametric θ. we do the same thing for all the lines of the polygon,then we construct the desired surface. pts = CirclePoints; draw[a_, b_] := ParametricPlot3D[ TranslationTransform[{0, 0, -θ}]@...

8

If you already have the list of coordinates, then FindCurvePath should be able to re-order them for you: pts = {{0, 0}, {1, 1}, {1, 0}, {0, 1}}; Graphics@ Polygon[pts] Graphics@Polygon@pts[[First@FindCurvePath[pts]]]

7

A very naïve approach Let's use RegularPolygon (we could also use CirclePoints) with increasing radius. Then obtain its boundary and subdivide it. subdivide[n_] := Line[{p1_, p2_}] :> With[{pts = Table[p1 + i (p2 - p1), {i, 0, 1, 1/n}]}, pts]; centeredPolygon[p_, r_] := Join[MeshPrimitives[RegularPolygon[{r, 2 \[Pi]/p}, p], 1] /. subdivide[...

5

Here's another approach using AnglePath: cornerPath[n_, div_] := With[{s = Pi - (n-2)/(2n) Pi, a = Pi - (n-2)/n Pi}, AnglePath @ If[div==0, PadRight[{s}, n, a], Riffle[ConstantArray[0, n div], PadRight[{s}, n, a], {1, -2, div+1}] ] ] centerPath[n_, div_] := TranslationTransform[{(div+1)/(2 Cos[(n-2)/(2n) Pi]), 0}] @ cornerPath[n, div]...

5

OP and reply the comment. reg1 = Disk[{0, 0}, 1/2]; reg2 = ImplicitRegion[u^2 + v^2 <= 4 && 3 + u^2 + v^2 >= 4 u, {u, v}]; sol = Resolve[Exists[{x, y, u, v}, Element[{x, y}, reg1] && Element[{u, v}, reg2], (p == x + u && q == y + v)], Reals]; RegionPlot[List @@ sol, {p, -4, 4}, {q, -4, 4}, PlotPoints -> 80,...

3

You just need to sort your points according to an increase of the bypass angle. Graphics@Polygon[ SortBy[ {{0, 0}, {1, 1}, {1, 0}, {0, 1}}, Arg[First@# + I Last@#] & ]] Actually, the sorting function can be different just keep the bypass angle increasing...

3

One approach is to decompose your region into a collection of convex regions, find the Minkowski sum of each, then union the result. The Minkowski sum of two convex polygonal regions is a call to ConvexHullMesh after replacing each vertex of one region with all offset vertices of the other. A = BoundaryDiscretizeRegion[RegionDifference[Disk[{0, 0}, 2], Disk[{...

2

Kinda looks like a bug in DualPolyhedron. You should report it, and see what WRI says. Borrowing & adapting from my answer, https://mathematica.stackexchange.com/a/132920: ClearAll[dual, sortvertices, reciprocate]; sortvertices[coords_, normal_, face_] := With[{proj = DeleteCases[ Orthogonalize[Join[{normal}, N@IdentityMatrix]], {0., ...

2

Here's a way to get a random polyhedron with n faces by a slightly different method: take n random points on the sphere, then take the half-space bounded by the plane tangent to the sphere at each point, and intersect them all. First, though, we need to be aware that we might encounter a pitfall when randomly choosing our points on the sphere: namely, we ...

2

Minkovski sum is not substantial here. In fact, the $\frac 1 2$-neighborhood of RegionDifference[Disk[{0, 0}, 2], Disk[{2, 0}, 1]] is required. Following the documentation, this can be done as follows. First, we define d = RegionDistance[DiscretizeRegion[RegionDifference[Disk[{0, 0}, 2], Disk[{2, 0}, 1]]], {x, y}]; The above does not work without ...

2

You can't get an exact symbolic area of the intersection of two regular pentagons with parameters when the parameters are symbolic because Area is a computational function like NIntegrate and not symbolic expression manipulator like Integrate. Even the result you show isn't symbolic; it is just exact. The best we can do is define a numeric evaluator for the ...

2

Toward the problem in the comment. For arbitrary 4 points in Disk[],the 4 points not always construct a simple region. SeedRandom pts = RandomPoint[Disk[],4]; {{Graphics[{Point[pts], Circle[], Orange, Opacity[0.5], Polygon[pts]}], Perimeter[ Polygon[pts]]}, {Graphics[{Point[pts], Circle[], Orange, Opacity[0.5], DelaunayMesh[pts]...

2

DiscretizeGraphics seems work. pol = Polygon[{{1.073345506818552, 1.857637206027929, 3.0696499694419788}, {2.0716892525829143, 3.587975340418905, -0.00006534259886672701}, \ {4.1439268249396655, -0.000023855261707517, \ -0.00008236145274327066}, {2.146229106755889, \ -0.000009315675120787797, 3.0696499694419788}, {1.073345506818552`, ...

1

From the documentation, PolygonDecomposition gives a Polygon consisting of a union of polygons with disjoint interiors, but boundaries may overlap. Technically, the polygon in question has a decomposition into interior-disjoint polygons, but it happens not to be treated that way (Mathematica's documentation seems to mean that adjacent pieces in a ...

1

Your code works for concrete p,q in 12.2, e.g. p = -1/4; q = 1/2; Area[RegionIntersection[Polygon[{regulPen, regulPen, regulPen, regulPen,regulPen}],Polygon[{regulPenShif + {p, q}, regulPenShif +{p, q}, regulPenShif + {p, q}, regulPenShif +{p, q}, regulPenShif + {p, q}}]]] 1/2 (1/4 (1 - Sqrt) ((Sqrt[5 + Sqrt] (-4 Sqrt...

Only top voted, non community-wiki answers of a minimum length are eligible