geometry - Define a function for a circle caps the end of a line segment -


I need a function that points to a circle in three dimensions.

A line segment defined by circle "A" and "B" should be "cap" and this is the radius. Each cap line is vertical for the segment. And focuses on one of the end points.

Let's move into the direction of the unit vector A to B, that is, N = (BA) / Length (AB). The first step is to find two more vectors X and Y, as if {N, X, Y} form a base, that means that you want two more vectors so that all pairs of {N, X, Y} And they are also all unit vectors. Another way to think about this is to create a new coordinate system, whose X-axis lines line up with the Segment. You need to find vectors pointing in the direction of the y-axis and z-axis.

Note that there are infinitely many options for X and Y. You just need to do two things to do something.

One way to do this is to find the vector first (N, W, V) where N is from above and W and V two (1,0,0), (0,1,0), and (0,0,1). Choose two vectors for W and V, which correspond to the smallest number of N If you select N = (.31, .95, 0) then you (1.00) and (0,0,1) W and V. (Math Geek Note: This method of choosing W and V ensures that {N, W, V} extends R ^ 3) after that you get the vectors (N, X, Y) as above For {N, W, V}, apply. Note that you need vector n to get the first vector so that it does not change with this process.

So now you have two vectors that are straightforward for the line segment and are perpendicular to each other. This means that the points of the circle around A are X * cos t + y * sin t + A where 0 & lt; = T & lt; 2 * pie is a general description of a circle in two dimensions; It is written only in the new coordinate system described above.


Comments