Draw a line of length X defined by a point in space and a vector

Before everyone jumps on me to outsource my homework, my question is not a question of my homework. I just have a problem getting some things to draw correctly.

I try to draw lines perpendicular to the plane. I know that three points in space make up an airplane. From these coordinates, I can calculate the vectors and get the normal plane vector. Using the coordinates from the center of three points and the normal vector, I can draw a line perpendicular to the plane.

My problem is that the length of this line is tied to a normal vector, because I just add a vector to the coordinates to get two points to draw a line. Without using some disgusting code of brute force, how to draw a line of a fixed length given by any point in three-dimensional space and any vector.

(I ask here because I don’t know the terms that can be used to search on google, my tutorial has nothing about this, and my professor will not be available before this happens.)

+3
source share
1 answer

You need to "normalize" your normal vector.

divide the vector by its size.

the length or magnitude of the vector r is determined as follows:


                  
l = √ x2 + y2 + z2

r (.. )


n = { x/l, y/l, z/l }

1.

, ..

+7

Source: https://habr.com/ru/post/1707765/


All Articles