Convert 3D polygon into homogeneous matrix
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi. I have defined a 3D polygon creating a vertice and a face matrix to use the function Patch. Now i would like to know: how do i transform my 3D polygon in an homogeneous matrix.
Any clues ?
Thanks for the help.
댓글 수: 2
Walter Roberson
2012년 10월 13일
What would the homogenous matrix consist of? For example are you looking to render it into a matrix? If so what value do you want at each location, taking into account that the polygon would in general be colored ?
채택된 답변
Walter Roberson
2012년 10월 13일
The matrix "vert" in your code is your homogenous matrix for your purposes described in your comment.
추가 답변 (2개)
Matt J
2012년 10월 13일
Couldn't you just transform all of the vertices and recreate the patch? E.g.,
vert_translated=bsxfun(@plus, vert, [3,0,0]);
P=patch('Faces',faces,'Vertices',vert_translated,'FaceColor','r');
Note that invertible linear/affine transformations don't change the faces.
Matt J
2012년 10월 13일
Instead of using PATCH, you could also consider using these 2 FEX files,
So first, this willl let you obtain your polyhedron as a set of inequalities A*x<=b
[A,b]=lcon2vert(vert);
Now you can transform the polyhedron as you like by appropriately transforming A and b. In the case of your translation, this would be
Anew=A;
bnew=b-A*[3;0;0];
Finally, you can plot using the plotregion() tool
plotregion(-Anew,-bnew);
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Elementary Polygons에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!