So at this point we'll simplify things by flipping all of the 1-out triangles around so that they look like 2-out triangles. The math for calculating the intersection actually involves terms which cancel out so that the calculation for the 1-out and 2-out triangles look the same. Now we need to take each of those triangles and turn it into a line segment which shows the intersection. If we zoom in we can see that we have a thin band of triangles which go around the part of the surface which crosses the cylinder. claĬt = patch( 'Vertices',hel.vertices, 'Faces',crossing_tris, 'EdgeColor', 'FaceColor',) ![]() Let's take a quicky look at those triangles. These are the triangles we're interested in. If the number of outside vertices is 1 or 2, then the triangle crosses the cylinder. This means that they can't contribute to the intersection curve. That's because those triangles are completely inside or completely outside the cylinder. ![]() If the number of outside vertices is 0 or 3, then we don't care about the triangle. ![]() r = sqrt(hel.vertices(:,1).^2 + hel.vertices(:,2).^2) įor each triangle, count the number of vertices which are outside the cylinder. To do that, we just need to compute the radius for each vertex, and then compare that to 1. Let's walk through that approach in detail.įirst we take the vertices we got from the isosurface, and create a logical mask of all of the vertices which are outside the cylinder. The first two approaches can be fairly involved in some cases, but the third approach generally isn't too hard to implement. Calculate the intersection on the grid we're using to draw the surfaces.Find an intersection point, and then use a tracing scheme to generate the curve.Find an analytic solution for the intersection.In general, computing the interestion of implicit surfaces is a fairly challenging problem. Set(ax, 'XLim', 'YLim', 'ZLim', 'DataAspectRatio',)īut now he wants to compute the interesection of that surface and the cylinder defined by this equation: patch(hel, 'FaceColor', 'EdgeColor', 'none') and draw it using the technique we talked about in that blog post. He has already figured out how to compute the surface. It apparently comes from a problem involving polarization of light by crystals. Vyas has a surface which is defined by the following equation. Recently, there was an interesting question about them on MATLAB Answers.ĭr. There cannot exist a finite number of distinct minimizers that are not connected.Ģ) Polynomials have a distinct number of roots that we can uniquely determine.We talked about implicit surfaces here back in March. The exception is that technically, there can exist an infinite number of solutions, but they will all be connected (like on a specific plane). Furthermore, this minimizer is almost always unique. So anything returned by fsolve will be a global minimizer. So basically, there is no way of doing what you want except for 2 well known cases:ġ) If the problem is convex, then there are no local minimizers that are not global minimizers. On the hand, almost all other optimization solvers are local, meaning that they will only guarantee that a local minimizer is returned.įurthermore, in addition to not knowing whether the returned solution is a global or local minimizer, there is, in general, no way of determining how many roots a problem has. There are global solvers (like genetic algorithms and simulated annealing), but they have to run for an infinite amount of time to guarantee that the returned solutions comprise all of the minimizers.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |