B
B
BitNeBolt2020-10-23 15:21:16
Mathematics
BitNeBolt, 2020-10-23 15:21:16

How to determine that the vector is not directed towards the center of coordinates?

I have a polygon structure, for which I need to calculate the normal. To do this, I choose 2 random vectors and vector multiply them. Since I choose 2 vectors randomly, the resulting vector can be directed in one direction or opposite to it.

The point (0; 0; 0) does not lie in this polygon.

I need to choose such a normal, a ray (from a polygon), in the direction of which it does not intersect a plane parallel to the given polygon and containing (0; 0; 0).

How can I do this? How in theory (good or bad) will the solution with equations work?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
Wataru, 2020-10-23
@BitNeBolt

First, take two adjacent sides of the polygon. If they are collinear, then take the other 2 adjacent ones. But for good, you should not have collinear neighboring lines and they can be combined when entering a polygon.
But all the same, the question remains, what if the normal looks towards the offset (0,0,0).
Construct the equation of the plane ax+by+cz+d=0. (a,b,c) is your found normal vector. d is calculated by substituting any one point of the polygon.
Now, if d is positive, then the point (0,0,0) lies in the half-space where the vector is looking and you need to reverse the normal.
This is where the signed distance property comes into play. You can substitute any point into the equation of the plane. You'll get 0 for the plane, positive numbers for one half space, and negative numbers for the other. Positive in the part where the normal vector sticks out (after all, if you postpone this normal from a point on the plane and calculate the sign distance, you will get the length of the normal vector stupidly).

D
Developer, 2020-10-23
@samodum

We need to take two adjacent vectors, not random ones. And then the problem will disappear.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question