Community RSS Feed
https://community.wolfram.com
RSS Feed for Wolfram Community showing any discussions in tag Geometry sorted by activeAvoid issues using RegionCentroid on Polygon?
https://community.wolfram.com/groups/-/m/t/1593569
So I'm having an issue where the RegionCentroid operation does not compute even though I've used it successfully many times in the past.
Here are the coordinates of the shape I'm trying to determine the centroid for:
C1 = {-0.82998570, 0.39131282, 1.38566726}
C2 = {-0.01947705, -0.00824240, 2.45464906}
C3 = {1.21666293, -0.61144232, 2.04941022}
C4 = {1.35625427, -0.67525738, 0.64442667}
S = {-0.01598580, -0.00235848, -0.00262605}
Here I'm building the Polygon:
Plane= Polygon[{C1, C2, C3, C4, S}]
And here is what what I'm using to determine the centroid of the region:
OO=RegionCentroid[Plane]
This is an issue I'm experiencing in Mathematica 11.3. That exact line of commands worked fine in Mathematica 10. I'm getting the error message shown below.
![enter image description here][1]
[1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=asdasdasdasd.png&userId=1593555
Any ideas as to why this is happening and how to fix it?
Thanks!Victor Murcia2019-01-17T07:54:34ZImprove code for finding the coordinates of a triangular mesh?
https://community.wolfram.com/groups/-/m/t/1567948
Hello, The problem of finding the coordinates of a triangular (equilateral) mesh discussed earlier is solved. It also counts the number of equilateral triangles formed by the intersecting parallel lines. But the problem is that the code takes more time for larger values of n i.e. the size of the side of the triangle. Can the code be improved? The code is given here. Thanks for any suggestion.
n = 4;
Print["Number of lines/size of triangle = ", n]
h = Sqrt[3] /2;
Array[x, n];
Array[s, n];
x[0] = {{n/2, n h}};
For[i = 1, i <= n, i++,
x[i] = Table[{x[0][[1, 1]] - i/2 + j, n h - i h}, {j, 0, i}]];
set = Apply[Union, Table[x[i], {i, 0, n}]];
Print["Number of vertices = ", Length[set]]
cond := (EuclideanDistance[#[[1]], #[[2]]] ==
EuclideanDistance[#[[2]], #[[3]]] ==
EuclideanDistance[#[[1]], #[[3]]] && #[[1]] != #[[2]] != #[[
3]] && #[[1, 1]] < #[[2, 1]] < #[[3,
1]] && (#[[1, 2]] == #[[2, 2]] || #[[2, 2]] == #[[3, 2]] || #[[
3, 2]] == #[[1, 2]]) &)
tr0 = Tuples[set, 3];
tr1 = Select[tr0, cond];
Print["Number of Triangles = ", Length[tr1]]jagannath debata2018-12-09T07:39:12ZWhere is the oldest known (2400 years) intact shipwreck?
https://community.wolfram.com/groups/-/m/t/1537744
[**Open in Cloud**][1] | **Download to Desktop via Attachments Below**
*NOTE: Click on the image to zoom in. Click back browser button to return to reading. All omitted or hidden computations, data, and definitions are available in the attached notebooks.*
----------
[![enter image description here][4]][5]
Deep-sea treasure hunt... with a research team... discovering a time capsule from 400BC... it hardly gets better than this. Past week the media was abuzz about an extraordinary discovery made by the team of Black Sea Maritime Archaeology Project ([Black Sea MAP][6]). They found the oldest known **intact** shipwreck estimating its age as 2,400 years via radiocarbon dating. Remarkable preservation of the ship is due to unique feature of the Black Sea with 90% of water lacking oxygen below ~150 meters that makes up huge up to ~2km deep anoxic water layer. There are almost no life and no chemical or biological corrosion of the ships' materials and shipwrecks are often preserved very well, which is invaluable for archeology and history. All live creatures dwell in the top thin layer of oxygenated water fed from rivers. Anoxic layer is fed by the Mediterranean Sea via the Bosphorus Strait with two layers hardly mixing. Good summaries can be found at [ArsTechnica][7], [BBC][8], [NPR][9], [The Guardian][10], and many other sources. So far we know from the media:
- Shipwreck is more than 2 km deep under water
- Shipwreck is more than 80 km away from Burgas, Bulgaria
This piqued my curiosity. **Can the seabed drop so fast to 2 km depth just 80 km off shore? Can I visualize it?** Being a creature of the Black Sea shores myself, born and raised in gorgeous Odessa, Ukraine, I could not let the idea go. As you can see my **computed** chart above is pretty close to the vague one below reported by The Guardian (I could not find neither more precise location data nor maps, let me know if you did). This work is no more than an educated guess based on a few numbers and some fun data science ramble. The key is the [GeoElevationData][11] and [Geometric Computation][12]. I still struggle with a few inconsistencies, for instance, perhaps the units for the distance "80 off shore" mentioned by media are miles and not kilometers; or perhaps there are other blinders or/and my estimates are off. Let's just dive into it.
![enter image description here][13]
To get a better picture of where globally is the shipwreck, compute countries surrounding the Black Sea (`{All, 0}` means all countries at the zero distance from the sea):
![enter image description here][14]
I usually like to see two geo-scales - global and zoomed in - combined for better comprehension:
![enter image description here][15]
![enter image description here][16]
The quality of the very first visualization is achieved by assembling 3 main parts: **geo-objects** (points, circles) **relief map** obvious to an eye, and a fine **contour map** of GeoElevationData that looks separately like this (click to zoom):
[![enter image description here][17]][18]
The red contour marks the depth of 2 km and everything inside can mostly be flat or deeper, but not by much for the Black Sea with the maximum depth ~2.2 km. First of all we need location of the shipwreck, whose latitude and longitude I compute (quite roughly) at the very end of this post and now assign to variable `WRECK`:
![enter image description here][19]
The following definitions formulates the objects of interest in terms of geo- data and computations:
![enter image description here][20]
where `//sW` etc. are small style operators found in the attached notebook. The following creates high quality relief plot serving as the background:
![enter image description here][21]
The next interesting part is building fine contour lines of geo elevation or topographic map. From the relief map let's extract the projection, which Wolfram Language selects the best for a given geo-data automatically:
![enter image description here][22]
and projected ranges:
![enter image description here][23]
*`GeoGridRange` above and `GeoElevationData` taking a `GeoProjection` option are available only in Wolfram Language version 12 that will be coming soon.* Request geo elevation data for that exact same projection, projected region and units and resolution of interest (metric in this case):
![enter image description here][24]
Now we can define some sensible elevation levels for the contours and visualize quite stunning topography of the Black Sea region (see the **contour map** above):
![enter image description here][25]
To finally make the very first visual we merge the relief plot with the contour plot:
![enter image description here][26]
see the result at the top image at very beginning of this article. **But, so, how did I estimate the location of the shipwreck, a.k.a. the yellow dot?** I simply assumed that the expedition seeking deeper waters would move towards the nearest place where the seabed descends to much deeper levels. **The point on 2km-depth contour nearest to the expedition's port of origin might serve as a good guess.** As some media mentioned Burgas, Bulgaria as the city within ~80km from shipwreck I assumed Burgas, having a port, was the origin of the expedition. One can extract the 2km-depth contour and turn it into a geometric region to perform [RegionNearest][27] computation. But there are a subtleties to watch out. Let's first get our 200km-depth contour:
![enter image description here][28]
![enter image description here][29]
`DiscretizeGraphics` transformed a `Graphics` object into a geometric region. `RegionNearest` finds a point in the region (contour) nearest to a given point (city location). The thing is to perform the RegionNearest computation in projected space, and then go back to GeoPosition:
![enter image description here][30]
*"GridXY" is also version 12 feature.* Now we can compute the distance from Burgas to the shipwreck. Interestingly, the distance in miles is much closer to media-stated "80" than the distance in kilometers. So maybe the units are where confused in the interviews.
![enter image description here][31]
[1]: https://www.wolframcloud.com/objects/wolfram-community/Shipwreck-400BC
[2]: https://wolfr.am/yMpLwXnl
[3]: https://wolfr.am/yMpNU8jw
[4]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2018-10-31at12.11.35AM.jpg&userId=11733
[5]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2018-10-31at12.11.35AM.jpg&userId=11733
[6]: http://blackseamap.com
[7]: https://arstechnica.com/science/2018/10/this-ancient-greek-ship-is-the-oldest-intact-shipwreck-ever-discovered/
[8]: https://www.bbc.com/news/world-europe-45951132
[9]: https://www.npr.org/2018/10/23/659808976/oldest-intact-shipwreck-known-to-mankind-found-in-depths-of-black-sea
[10]: https://www.theguardian.com/science/2018/oct/23/oldest-intact-shipwreck-thought-to-be-ancient-greek-discovered-at-bottom-of-black-sea
[11]: http://reference.wolfram.com/language/ref/GeoElevationData.html
[12]: http://reference.wolfram.com/language/guide/GeometricComputation.html
[13]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2018-10-29at10.46.05PM.jpg&userId=11733
[14]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2018-10-30at3.25.31AM.png&userId=11733
[15]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2018-10-30at3.28.23AM.png&userId=11733
[16]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2018-10-30at12.10.04AM.jpg&userId=11733
[17]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2018-10-31at12.15.30AM.jpg&userId=11733
[18]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2018-10-31at12.15.30AM.jpg&userId=11733
[19]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2018-10-31at10.05.47AM.png&userId=11733
[20]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2018-10-31at12.36.57AM.png&userId=11733
[21]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2018-10-30at10.32.33.png&userId=20103
[22]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2018-10-30at10.33.38.png&userId=20103
[23]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2018-10-31at12.40.53AM.png&userId=11733
[24]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2018-10-31at12.45.07AM.png&userId=11733
[25]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2018-10-31at12.47.05AM.png&userId=11733
[26]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2018-10-30at12.40.58.png&userId=20103
[27]: http://reference.wolfram.com/language/ref/RegionNearest.html
[28]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2018-10-31at12.53.07AM.png&userId=11733
[29]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2018-10-31at12.55.32AM.jpg&userId=11733
[30]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2018-10-31at12.59.43AM.png&userId=11733
[31]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2018-10-31at1.05.38AM.png&userId=11733Vitaliy Kaurov2018-10-30T08:55:44Z