Intersection of squares with curve

2 visualizaciones (últimos 30 días)
Jim
Jim el 1 de Mzo. de 2013
Say that you have a collection of squares in 2D, defined by their corner points (A,B,C,D) and having a unique identifying number ID. You also have a 2D curve defined implicitly as the zero level of a levelset function.
The first task is to find which squares intersect the curve. The second is to find what are the intersection points.
Can someone point out how should one go on to solve this problem?

Respuestas (1)

Matt J
Matt J el 1 de Mzo. de 2013
Editada: Matt J el 1 de Mzo. de 2013
Denoting the level set function by L(x,y), you could use LSQNONLIN (if you have it) to minimize L^2(x,y) subject to the constraint that x,y lie in a particular square. If the minimum is achieved at an L^2 value close to zero, you know it intersects that square.
To find the intersection points, you can then minimize L^2 subject to the constraint that it lie a line segment bounding the square and, similarly, see if you get a minimum L^2 close to zero. If so, the solution is an intersection point on that edge. This scheme works if the curve can only intersect an edge of a square at most once. There is no way, other than perhaps graphically, to determine multiple intersection points at an edge with any reliability.

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by