reflection of a curve with respect to a plane
6 次查看(过去 30 天)
显示 更早的评论
Hi, given a curve, i have to plot it's reflection respect a plane defined by a point and a vector.
The curve is: x=-1:0.2:10 and y=x.^2+2, the point and the vector that define the space are P=[2 2 2] and V=[0 0 1].
This is my code by now:
clc;
clear all;
x=-1:0.2:10;
y=x.^2+2;
P=[2 2 2];
V=[0 0 1];
z=zeros(1,56);
ONE=ones(1,56)
A=[x.',y.',z.',ONE.'];
I know that i have to find the distance of each point of the curve from the plane, but i can't find the right way to use the for cycle, i want to use the dot function for each row and than create the reflection matrix.Use this matrix to calculate the new coordinate for each point and create the new matrix made with the coordinate of the reflect curve.This is my cycle for,it's not right but i write for make my self clear about my idea:
for i=1:length(x)
A2{i}=A(i,:);
A2t=A2'
C=cell2mat(A2t)
dist=dot(C-P,V);
d=abs(dist);
T=[1 0 0 (2*d*0);0 1 0 (2*d*0);0 0 1 (2*d*1);0 0 0 1];
B=T*C'
F=[B 56]
end
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Curve Fitting Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!