方向向量与原始向量做乘法会将原始向量旋转并做一个缩放。
以下使用matlab固定方向向量长度不变,探究其长度对乘积结果的影响
close all;clc;clear all;
for i=1:5
subplot(1,5,i)
plotDir( i)
end
function [ ] = plotDir( Dirlen )
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
testpoint=[2 0];
original=[0 0];
% plot
dirextion=[sqrt(Dirlen),sqrt(Dirlen)];
axis([0 5 0 5])
quiver(0,0,testpoint(1),testpoint(2),'g','LineWidth',2);
hold on;
quiver(0,0,dirextion(1),dirextion(2),'r','LineWidth',2);
hold on;
afterMul=dirextion'*testpoint;
quiver(0,0,afterMul(1),afterMul(2),'b-','LineWidth',1);
grid on;
axis([0 5 0 5])
legend('Original','Direction','Original^T*Direction')
end