Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Calculating the vector normal to a plane. Three points in a 3D space define a pl

ID: 3028379 • Letter: C

Question

Calculating the vector normal to a plane.

Three points in a 3D space define a plane. A vector perpendicular to any vector lying in that plane is called a normal vector.

Assign planeNormal with the normal vector to the plane defined by the point1, point2, and point3. To find the normal vector,

A vector lying in the plane is found by subtracting the first point's coordinates from the second point.

A second vector lying in the plane is found by subtracting the first point's coordinates from the third point.

The normal vector is found by calculating the cross product of two vectors lying in the plane.

Ex: If point1, point2, and point3 are [ 0, 0, 1 ], [ 2, 2, 3 ], and [ 0, 3, 1 ], respectively, then planeNormal is [ -6, 0, 6 ].

function planeNormal = getPlaneNormal (point1, point2, point3)

% Calculate first vector in plane by subtracting the first point's coordinates from the second point

inPlaneVec1 = point2- point1;

%Calculate second vector in plane by subtracting the first point's coordinates from the third point

inPlaneVec2 = [0,0,0]; %FIXME

%Calculate vector normal to the plane by calculating the cross product of the two vectors lying in the plane

planeNormal= [0,0,0]; %FIXME

end

Explanation / Answer

% MATLAB code

P=zeros(1:3); Q=zeros(1:3);R=zeros(1:3);

inPlaneVec1=zeros(1:3); inPlaneVec2=zeros(1:3); planeNormal=zeros(1:3);

% Taking input from user of the points P Q and R.

P(1)= input('x-coordinate of point P');

P(2)=input('y-coordinate of point P');

P(3)=input('z-coordinate of point P');

Q(1)=input('x-coordinate of point Q');
Q(2)=input('y-coordinate of point Q');
Q(3)=input('z-coordinate of point Q');

R(1)=input('x-coordinate of point R');
R(2)=input('y-coordinate of point R');
R(3)=input('z-coordinate of point R');


inPlaneVec1 = Q-P; % Vector along P and Q
inPlaneVec2 = R-P; % Vector along P and R

planeNormal = cross(inPlaneVec1,inPlaneVec2); %Cross product Vec1xVec2

disp(planeNormal); % Displaying vector perpendicular to the plane of PQR


Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote