You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Detecting & Splitting Faces that cross the Antemeridian #171
The connectivity used to described unstructured grids typically assumes that the grid resides on a sphere. When you connect two nodes together to form an edge across the antimeridian, attempting to project them onto a 2D projection (as is the case with many visualizations) leads to an incorrect representation, where the edge spans across the projection when it should instead directly "wrap" to the other node.
Hi, @philipc2@ifranda as mentioned in the meeting, here's the sudo codes that you can refer to so as to find the anti-meridian face
Please keep in mind that we made a rule here: the span of the edge cannot be larger than 180 degree: We will always pick the direction of the edge that's less than 180 degree
Helper Function sudo codes to detect if an edge is across the anti-meridian (longitude 0 in this case)
This function summarizes each anti-meridian scenario that you can refer to (If you want to do a more detailed operation on the antimeridian case)
defedge_antimeridian_case(gcr_cart)
# Special case: when the gcr and the point are all on the same longitude line:ifgcr_lonlat_rad[0][0] ==gcr_lonlat_rad[1][0] ==0:
passGCR0_lonlat=node_xyz_to_lonlat_rad(gcr_cart[0])
GCR1_lonlat=node_xyz_to_lonlat_rad(gcr_cart[1])
# The anti-meridian case Sufficient condition: absolute difference between the longitudes of the two# vertices is greater than 180 degrees (π radians): abs(GCRv1_lon - GCRv0_lon) > πifabs(GCRv1_lonlat[0] -GCRv0_lonlat[0]) >np.pi:
# The necessary condition: the pt longitude is on the opposite side of the anti-meridian# Case 1: where 0 --> x0--> 180 -->x1 -->0 case is lager than the 180degrees (pi radians)# Need to redirect such that 180 --> x0 --> 0 --> x1 --> 180ifGCRv0_lonlat[0] <=np.pi<=GCRv1_lonlat[0]:
pass# The necessary condition: the pt longitude is on the opposite side of the anti-meridian# Case 2: The anti-meridian case where 180 -->x0 --> 0 lon --> x1 --> 180 that doesn't require redirection.elif2*np.pi>GCRv0_lonlat[0] >np.pi>GCRv1_lonlat[0] >0:
pass
If all you want to do is to find out if this edge is anti-meridian or not, use the following branching:
The final function sudo codes that can help you detect if the face goes across the antimeridian
for each face, loop over each edge and use the above function to test if this edge is anti-meridian, if any of the edges is True(across the meridian), then the entire face is antimeridian.
Please let me know if you have any question about this
changed the title [-]Function for detecting faces that cross the Antimeridian [/-][+]Detecting & Splitting Faces that cross the Antemeridian [/+]on Jun 25, 2023
Hi @philipc2
some update related to the issue I just posted #392 , we need to add the exception for edge larger or equal to 180 degree here.
defedge_antimeridian_case(gcr_cart)
# Special case: when the gcr and the point are all on the same longitude line:ifgcr_lonlat_rad[0][0] ==gcr_lonlat_rad[1][0] ==0:
passGCR0_lonlat=node_xyz_to_lonlat_rad(gcr_cart[0])
GCR1_lonlat=node_xyz_to_lonlat_rad(gcr_cart[1])
# The anti-meridian case Sufficient condition: absolute difference between the longitudes of the two# vertices is greater than 180 degrees (π radians): abs(GCRv1_lon - GCRv0_lon) > πifabs(GCRv1_lonlat[0] -GCRv0_lonlat[0]) >=np.pi:
# The necessary condition: the pt longitude is on the opposite side of the anti-meridian# Case 1: where 0 --> x0--> 180 -->x1 -->0 case is not less than the 180degrees (pi radians)# ifGCRv0_lonlat[0] <=np.pi<=GCRv1_lonlat[0]:
raiseValueError("All edge span should be less than 180 degree")
# The necessary condition: the pt longitude is on the opposite side of the anti-meridian# Case 2: The anti-meridian case where 180 -->x0 --> 0 lon --> x1 --> 180 elif2*np.pi>GCRv0_lonlat[0] >np.pi>GCRv1_lonlat[0] >0:
pass
If all you want to do is to find out if this edge is anti-meridian or not, use the following branching:
Thank you for this! I've been using the antimeridian package for my visualization work, and possibly for future analysis work if it's applicable.
Here's a great example from their documentation outlining the algorithm, which appears to be similar to what was outlined here.
I took a look at their algorithm. Yes, they basically employ the same steps we're doing here. I think it should be compatible with our future implementation
Activity
[-]Function to detect cyclic faces[/-][+]Function for detecting faces that cross the Antimeridian [/+]hongyuchen1030 commentedon Jun 8, 2023
Hi, @philipc2 @ifranda as mentioned in the meeting, here's the sudo codes that you can refer to so as to find the anti-meridian face
Please keep in mind that we made a rule here: the span of the edge cannot be larger than 180 degree: We will always pick the direction of the edge that's less than 180 degree
This function summarizes each anti-meridian scenario that you can refer to (If you want to do a more detailed operation on the antimeridian case)
If all you want to do is to find out if this edge is anti-meridian or not, use the following branching:
for each face, loop over each edge and use the above function to test if this edge is anti-meridian, if any of the edges is
True(across the meridian), then the entire face is antimeridian.Please let me know if you have any question about this
philipc2 commentedon Jun 8, 2023
Thank you so much for this! This is extremely helpful!
[-]Function for detecting faces that cross the Antimeridian [/-][+]Detecting & Splitting Faces that cross the Antemeridian [/+]hongyuchen1030 commentedon Jul 21, 2023
Hi @philipc2
some update related to the issue I just posted #392 , we need to add the exception for edge larger or equal to 180 degree here.
If all you want to do is to find out if this edge is anti-meridian or not, use the following branching:
philipc2 commentedon Jul 21, 2023
@hongyuchen1030
Thank you for this! I've been using the antimeridian package for my visualization work, and possibly for future analysis work if it's applicable.
Here's a great example from their documentation outlining the algorithm, which appears to be similar to what was outlined here.
hongyuchen1030 commentedon Jul 21, 2023
I took a look at their algorithm. Yes, they basically employ the same steps we're doing here. I think it should be compatible with our future implementation