Intersection of squares with curve
2 ビュー (過去 30 日間)
古いコメントを表示
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?
0 件のコメント
回答 (1 件)
Matt J
2013 年 3 月 1 日
編集済み: Matt J
2013 年 3 月 1 日
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.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Surface and Mesh Plots についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!