Smoothing the Region?

There is a 2D Pi

enter image description here

I successed transformed it to 3D.

extrudeImage[image_] := 
  Block[{res, img}, 
  img = DeleteSmallComponents[Binarize[image, 0.9], 500];
  res = ImageMesh[img];
  RegionProduct[res, Line[{{0.}, {10.}}]]]

img = DeleteBorderComponents@
        ImageResize[Import["https://i.stack.imgur.com/AM0gC.png"], 100];
r = Region[extrudeImage@img, Axes -> True, 
        AxesLabel -> {"X", "Y", "Z"}];
r = TransformedRegion[r, TranslationTransform[-RegionCentroid@r]]

enter image description here

I tried to rotate it to create a more 3D Pi, but the surface seemed to be too rough, MMA throwed a warning…

RegionUnion@
 Table[TransformedRegion[r, RotationTransform[i, {0, 1, 0}]], {i, 0, 
 Pi/3, Pi/10}]

enter image description here

How to make the surface smooth so that 3D printing can be used?

graphics – Colour region by some property based on stochastic geometry

I have some circles placed at random within a region (here, the region is a circle-circle intersection).

pts1 = RandomPoint(
   ImplicitRegion(
    EuclideanDistance({x, y}, 0) < 1 && 
     EuclideanDistance({x, y}, {2.5, 0}) < 2, {x, y}), 3);
pts2 = RandomPoint(
   ImplicitRegion(
    EuclideanDistance({x, y}, 0) < 2 && 
     EuclideanDistance({x, y}, {2.5, 0}) < 1, {x, y}), 3);
Graphics(Prepend(
  Join(Circle(#, 1) & /@ pts1, Disk(#, 0.01) & /@ pts1, 
   Disk(#, 0.01) & /@ pts2), {Circle({0, 0}, 1), Circle({2.5, 0}, 1), 
   Circle({0, 0}, 2), Circle({2.5, 0}, 2), Opacity(0.4)}), 
 ImageSize -> Full)

Each circle covers some portion of another circle-circle intersection, as in this picture:

enter image description here

The regions in the right “lens” (circle-circle intersection) which are covered by 3 circles are in deep blue, by 2 circles in light blue and by 1 in yellow. The remaining region is left white.
This is done with Paintbrush.

Can I get Mathematica to colour the continuum of points automatically, like this, with $n$ colours if there are $n$ points in pts1?

It appears easy to do this with a Plot of function, and then ColorFunction, but with some property of a set of points in Graphics?

trigonometry – Eccentricity of a region

I would like to calculate the eccentricity of the intersection between a cylinder and a plane when I change their relative orientation.

reg1 = RegionIntersection[Cylinder[{{0, 0, 1}, {0, 0, -1}}, 1/2],InfinitePlane[{{1, 0, 0}, {0, 1, 0}, {0, 0, 0}}]];
reg2 = RegionIntersection[Cylinder[{{0, 0, 1}, {0, 0, -1}}, 1/2],InfinitePlane[{{1, 0, 1}, {0, 1, 0}, {0, 0, 0}}]];

Show[Region[reg1],Region[reg2],Graphics3D[{{Opacity[0.2], Cylinder[{{0, 0, 1}, {0, 0, -1}}, 1/2]}}]]

However, when I try:

 ComponentMeasurements[Graphics[Graphics[reg1]], "Eccentricity"]
 ComponentMeasurements[Graphics[Graphics[reg2]], "Eccentricity"]

I get in both cases ‘0.0744841’ answer.
I am open to alternative ways of doing this calculation.

architecture – Enforce collocation of data in the region where it is used

How to make sure that data specific to particular region remains in the closest data center to ensure low latency?

Lets consider Amazon e-commerce as an example . It sells products all over the world and not every product and product’s seller is available in every region. So there is no point in showing , lets say ABC speakers which are not sold in Australia, to customers in Europe.

So if the user in Australia wants to list all the speakers , a simple query where country='AUSTRALIA' will work ( in the simplest case)

Question 1:

Next comes how to resolve the latency part ( where my question is). How do we ensure that products sold in Australia are the only one that are present in Australian data center’s database. Because, if we fire the above query the partition ( or even the replica of the partition ) that carry the information about product =Speaker and country =Australia might be present in Japan.

As per my understanding, Amazon or such eCommerce will probably have elastic search DB cluster which is geographically spread and partitioning on key = country will not answer the question.

Question 2:

Is it a good idea to maintain separate database for each country to solve above issue?

This question even extends to Uber. Uber keeps track of all the rides that are available within all the regions of the world ( where Uber is actually available) in its Redis cluster. Now when a user wants to search for a ride in region-1 it will not be a good idea to send this request to USA because the partition that is handling the region of Australia is actually present in USA.

Can you please give some idea of how to make sure data is collocated with the region it is used in?

Flutter: Show custom region of a fixed size container

I have a large image to put as a background in a flutter application. The UI demands that the center of the large widget to be aligned with the mobile view and fixed(not scrolling up and down).

So for the use case, the height of the image is 3 times(jpg with 3 images one after the another) the height of the mobile view and I have to show only the second image to the screen and not allowing the user to scroll.

I have tried stack with the background as second element in the list with alignment as center (didn’t worked).

What would be the best widget configuration to achieve this ?

enter image description here

geometry – How do I properly define and work with region unions?

Suppose I have two regions defined by two hexahedrons (slightly adapted from this question):

hexpts = {{1.7, 1.5, 0}, {1.7, 10.8, 0}, {20.3, 10.8, 0.01}, {20.3, 
    1.5, 0}, {1.7, 1.5, 0.6}, {1.7, 10.8, 0.6}, {20.3, 10.8, 
    0.6}, {20.3, 1.5, 0.6}};
reg = Hexahedron(Rationalize(hexpts));
hexpts2 = {{1.7, 1.5, 0}, {1.7, 10.8, 0}, {20.3, 10.8, 0.01}, {20.3, 
     1.5, 0}, {1.7, 1.5, 0.6}, {1.7, 10.8, 0.6}, {20.3, 10.8, 
     0.6}, {20.3, 1.5, 0.6}} + 0.1;
reg2 = Hexahedron(Rationalize(hexpts2));
Region@reg

enter image description here

Now I am interested in the RegionUnion of both:

myreg = RegionUnion(reg, reg2)
Region@myreg 

enter image description here

Then all 3 regions are Regions and also bounded regions:

list = {reg, reg2, myreg};
RegionQ(#) & /@ list
BoundedRegionQ(#) & /@ list
RegionCentroid(#) &(myreg)

{True, True, True}

{True, True, True}

But I cannot calculate the volume nor other region parameters for the region union:

Volume(#) & /@ list

{103.211, 103.211,
Volume(BooleanRegion(#1 || #2 &, {Hexahedron({{17/10, 3/2, 0}, {17/
10, 54/5, 0}, {203/10, 54/5, 1/100}, {203/10, 3/2, 0}, {17/10,
3/2, 3/5}, {17/10, 54/5, 3/5}, {203/10, 54/5, 3/5}, {203/10, 3/
2, 3/5}}),
Hexahedron({{9/5, 8/5, 1/10}, {9/5, 109/10, 1/10}, {102/5, 109/10,
11/100}, {102/5, 8/5, 1/10}, {9/5, 8/5, 7/10}, {9/5, 109/10,
7/10}, {102/5, 109/10, 7/10}, {102/5, 8/5, 7/10}})}))}

I tried discretizing the region union but it failed with:

 DiscretizeRegion@myreg

DiscretizeRegion::regpnd: A non-degenerate region is expected at position 1 of DiscretizeRegion(BooleanRegion(#1||#2&,{Hexahedron({{17/10,3/2,0},{17/10,54/5,0},{203/10,54/5,1/100},{203/10,3/2,0},{17/10,3/2,3/5},{17/10,54/5,3/5},{203/10,54/5,3/5},{203/10,3/2,3/5}}),Hexahedron({{9/5,8/5,1/10},{9/5,109/10,1/10},{102/5,109/10,11/100},{102/5,8/5,1/10},{9/5,8/5,7/10},{9/5,109/10,7/10},{102/5,109/10,7/10},{102/5,8/5,7/10}})})).

An error message that was raised in this question but the proposed solution (using Rationalize) isn’t applicable for general Hexahedrons as it seems (note that I changed 0 to 0.01 in hexpts((3,3)))

How do I properly define the RegionUnion of reg and reg2 so I can use Volume, RegionCentroid etc on it?

calculus – Base of parabolic region

I have a base $S$ that describes the parabolic region ${(x,y)vert x le y le 1}$. I’m asked to take cross-sections perpdendicular to the y-axis in the form of equilateral triangles.

I’m struggling visualizing such a cross section. I took some general equilateral triangle with side lengths $s$ and height $h$. I used Pythagorean’s theorem to find $h$, which for me ended up being $$(s/2)^2+h^2=s^2 \ h^2=s^2-s^2/4 \ h=sqrt{s^2(1-1/4)} \ h=ssqrt{3/4} \ h = cfrac{ssqrt3}{2}$$

So now I have the height of my cross section. I imagine the thickness of it will be $dy$ since I’m slicing perpendicular to the y-axis. And since the cross sections are squared, volume is going to be the side length, $s/2$ which is length on one quadrant, squared, times its height. So then volume of an infinitesimal slice must be
$$dV=cfrac{s^2sqrt3}{4}dy$$
Then $$V=int_0^1{s^2cfrac{sqrt3}{4}}dy$$

But this is where I’m stuck. I don’t know how to express $s$ in terms of $y$.

plotting – Why does Mathematica shade a region when this code is inputted?

Thanks for contributing an answer to Mathematica Stack Exchange!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

Use MathJax to format equations. MathJax reference.

To learn more, see our tips on writing great answers.

apex – refrescar una region luego de seleccionar un valor desde una lista de valores

Como hago para que después de haber seleccionado un valor en una lista de valores se refresque solo la región donde se encuentra la lista de valores y no toda la pagina, actualmente si selecciono un valor inmediatamente se actualiza la región pero se dirige al inicio de la pagina en uso.

legal – Are the airports of Abu Dhabi (AUH) and Dubai (DWC/DXB) considered to be serving the same region?

This question relates to the definition of flight cancellation, following the following statement on the European Union’s official information page for air passenger rights:

Cancellation occurs when:

  • your original flight schedule is abandoned and you are transferred to
    another scheduled flight
  • the aircraft took off but, was forced to
    return to the airport of departure and you were transferred to
    another flight
  • your flight arrives at an airport which is not the final destination indicated on your ticket, unless:
    • You accepted re-routing (under comparable transport conditions at
      the earliest opportunity) to the airport of your original final
      destination or to any other destination agreed by you. In this case it is considered as a delay and not a cancellation.
    • The airport of
      arrival and the airport of the original final destination serve the
      same town, city or region. In this case it is considered as a delay
      and not a cancellation.

Furthermore, it is stated that:

If your flight is cancelled you have the right to choose between reimbursement, re-routing or return.

(Source: https://www.google.com/amp/s/europa.eu/youreurope/citizens/travel/passenger-rights/air/indexamp_en.htm)

I am wondering whether AUH and DWC are generally considered to be serving the same region, and if a passenger whose flight destination was changed from DWC to AUH has the right to reimbursement.

My guess would be that AUH and DWC are serving seperate regions, as the United Arab Emirates are an agglomerate of different regions, each having their own laws which generally go further in differences among each other, than differences in laws between provinces in other countries (for example, between Bundesländern in Germany). AUH and DWC are in different emirates.