Rotate Normal Around Tangent
4 ビュー (過去 30 日間)
古いコメントを表示
I want to rotate a normal vector around a tangent vector to create a circle. I have not been able to find anything to do this. Does such a function exist? Or how would I generate one?
Thanks.
2 件のコメント
Matt J
2012 年 10 月 5 日
Clarify what this is supposed to do. What data are you given and in what form? What will the output data be, and in what form?
採用された回答
Matt J
2012 年 10 月 6 日
編集済み: Matt J
2012 年 10 月 6 日
I'm assuming you're choosing the radius, R, of this circle. Then if T and N are the tangent and normal vectors at point P on the curve (all in column vector form):
n=1000;
theta=linspace(0,2*pi,n+1);
theta(end)=[];
refcircle = [R*cos(theta);R*sin(theta);zeros(1,n);ones(1,n)] ;
T=T/norm(T);
N=N/norm(N);
E=cross(N,T);
A=[0 0 0; R 0 0; 0 R 0].';
B=[P,P+R*N,P+R*E];
params=absor(A,B); %get this function from FEX
C = params.M*refcircle; %circle points at 3D curve
plot3(C(1,:), C(2,:), C(3,:)) %plot the circle
The above uses ABSOR, available here
8 件のコメント
Matt J
2012 年 10 月 7 日
編集済み: Matt J
2012 年 10 月 7 日
Clarify whether the plot you're talking about is from the code as I gave it to you, or the result of you adapting/inserting it into your larger problem. If the latter, I'd have to see what you did.
However, when I run it in isolation with the sample data P,T,N,R data below, I definitely get a plot of a circle floating in 3D space. Verify first that you can reproduce this.
P=[1;1;1];
T=[1;1;1];
N=[-1;2;-1];
R=3;
n=1000;
theta=linspace(0,2*pi,n+1);
theta(end)=[];
refcircle = [R*cos(theta);R*sin(theta)] ;
T=T/norm(T);
N=N/norm(N);
E=cross(N,T);
C=bsxfun(@plus, [N,E]*refcircle, P);
plot3(C(1,:), C(2,:), C(3,:)) %plot the circle
その他の回答 (2 件)
Muthu Annamalai
2012 年 10 月 5 日
Paul, You need to find the points of a 2D rotation transform using the equations, for example affine transformation http://en.wikipedia.org/wiki/Rotation_(mathematics), and then you may visualize it using plot() commands. HTH, -Muthu
Image Analyst
2012 年 10 月 6 日
編集済み: Image Analyst
2012 年 10 月 6 日
Sounds like the streamtube() function. Could that be used? Or maybe morphological dilation, imdilate(). For morphological dilation, imagine a sphere whose center is tracing out your 3D curve. The dilated volumetric image is the volume swept out by that sphere as it travels along your curve.
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!