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
When initiating a prism in meep i was getting the following error:
-----------
Initializing structure...
non-coplanar vertices in init_prism
even though all the prism vertices were such that vertices[i].z = 0.0. I guess this is the error raised at line 2598 in the file utils/geom.c.
I then noticed that, for checking the prism plane, init_prism() checks the normals of all the triangles composed of two consecutive vertices and the centroid of the prism face.
Could it be that having consecutive vertices aligned with the centroid would give rise to an error exactly because the resulting triangle would have null area? (thus the normal might be affected by numerical error).
change the y-array to vy = [0,1,1,-1,-1, 0, 0.001,-2,-2,2,2,0]; in this way there are no consecutive points aligned with the centroid
comment the line relative to the center assignment in the Prism() block.
weirdly so, some velues of thickness make the error disappear. For instance:
-- 0.1, 0.2, 0.3, 0.4, 0.6, 0.8, 0.9, 0.03, 0.02, 0.01, ... in general, decimals do not work
-- 0.7 works
-- any number in the form 2**N or 1+2**N, with N negative integer number, works.
-- integer number work
Although my explanation seem reasonable, i really do not understand why changing the thickness should affect the raising of the error.
I'm unable to explore further.
Would it be possible to solve the problem by checking the area of the triangle, or checking for aligned vertices before computing the normal?
The text was updated successfully, but these errors were encountered:
In geometry you have following setup:
Where point 1 is centroid (automaticaly calculated) and then points 2 and 3, during prism initialization normal vector of the triangle that a created from two vectors (1-2) and (1-3) highly sensible to numerical innacurecy of arithmetic operations and strictly speeking this two vector are parallel, this is the reason why such prism is not initilized properly and has weird beheviour while changing some numbers.
When initiating a prism in meep i was getting the following error:
even though all the prism vertices were such that
vertices[i].z = 0.0
. I guess this is the error raised at line2598
in the fileutils/geom.c
.I then noticed that, for checking the prism plane,
init_prism()
checks the normals of all the triangles composed of two consecutive vertices and the centroid of the prism face.Could it be that having consecutive vertices aligned with the centroid would give rise to an error exactly because the resulting triangle would have null area? (thus the normal might be affected by numerical error).
Steps to reproduce the bug:
Things that make the error message disappear
vy = [0,1,1,-1,-1, 0, 0.001,-2,-2,2,2,0]
; in this way there are no consecutive points aligned with the centroidPrism()
block.--
0.1, 0.2, 0.3, 0.4, 0.6, 0.8, 0.9, 0.03, 0.02, 0.01, ...
in general, decimals do not work--
0.7
works-- any number in the form
2**N
or1+2**N
, with N negative integer number, works.-- integer number work
Although my explanation seem reasonable, i really do not understand why changing the thickness should affect the raising of the error.
I'm unable to explore further.
Would it be possible to solve the problem by checking the area of the triangle, or checking for aligned vertices before computing the normal?
The text was updated successfully, but these errors were encountered: