필터 지우기
필터 지우기

How do I create an image of a 3d polygon that is always orthogonal to the polygon?

조회 수: 3 (최근 30일)
I need to create a series of bitmap images to be analyzed by an external program. Each of these images has a 3d polygon at some random orientation. I want an automatic way to create the image in matlab so that the point of view of the image is orthogonal to the polygon.
Is there a way to do this is matlab?
I have the vertices of the polygon and the normal to it.
  댓글 수: 1
Richard Brown
Richard Brown 2013년 6월 24일
Are you wanting a way of transforming the polygon coordinates, or a way of setting the camera viewpoint?

댓글을 달려면 로그인하십시오.

답변 (1개)

Roger Stafford
Roger Stafford 2013년 6월 24일
편집: Roger Stafford 2013년 6월 24일
Let P be a 3 by n matrix containing the coordinates of n vertices as three-element columns. Assume they are in counterclockwise order as viewed from the direction of the desired image.
vx = P(:,2)-P(:,1);
vy = cross(cross(vx,P(:,end)-P(:,1)),vx);
vx = vx/norm(vx); vy = vy/norm(vy);
P2 = [vx,vy]'*P;
Then translate P2 in the x and y directions as desired for the proper image.
P2 will be a 2 by n matrix of x-y coordinates as viewed from an orthogonal direction. The P(:,1) to P(:,2) edge will be along the x-axis. It is assumed here that P is a planar polygon.
Note: If two successive edges do not give a reliable normal direction, you may want to take the mean of all the cross products of successive edges.
Note 2: It was assumed above that vertices P(:,1) and P(:,end) were distinct vertices.
(Corrected)

카테고리

Help CenterFile Exchange에서 Elementary Polygons에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by