Coordinates of a unit vector

조회 수: 9 (최근 30일)
DC
DC 2018년 11월 5일
댓글: DC 2018년 11월 5일
I have a 3D unit vector normal to a calculated plane and therefore have the unit vector's origin (X= 0.284010498396800, Y= -162.702853347011, Z= -892.534290438801) and it's normalised direction in 3D space (X= 0.938454081657572, Y= -0.341825009912055, Z= 0.0495943466421873). Is it possible to either find it's end point as defined by XYZ coordinates or to find 'n' number of XYZ points that would coincide with it's trajectory, assuming it's magnitude was greater than 1 (i.e. it was not normalised)? Currently the vector is defining the orientation of an axis through a structure of interest (a bone) and I am interested in transforming this vector into a set of evenly spaced 3D coordinate data that would define the axis path through 3D space. Any help would be greatly appreciated.

채택된 답변

James Tursa
James Tursa 2018년 11월 5일
편집: James Tursa 2018년 11월 5일
If I understand you correctly, simply this:
point_origin = [0.284010498396800,-162.702853347011,-892.534290438801];
point_direction = [0.938454081657572, -0.341825009912055, 0.0495943466421873];
f = any real scalar
point_on_normal_line = point_origin + f * point_direction;
  댓글 수: 1
DC
DC 2018년 11월 5일
Perfect, thank you! The code works perfectly. I've incorporated it into a for loop so that the 3D coordinate data describing the unit vector can be extended for a user defined length and then plotted on to the vector/bone figure plot e.g. if a = point origin, ij defines evenly spaced intervals and n = point direction:
for ij = 1:10:100
point_on_normal_line{ij} = a + ij * n;
end
axis = cell2mat(point_on_normal_line);
axis = reshape(axis,3,[]);
axis = axis';
hold on
scatter3(axis(:,1),axis(:,2),axis(:,3));

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Interactions, Camera Views, and Lighting에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by