how to find out the point is between two parallel vectors?

This topic is 3956 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

for example i have two vectors v1(x1,y1,z1),v2(x2,y2,z2) and a point p(x3,y3,z3).how can i learn where the point is? between the vectors or not? (in 3d).it is not important that the point is at the same level with vectors.for example v1=(0,0,1) v2=(2,0,4) p=(1,5,6) p is between the vectors' directions but not at the same level because y=5 and z=6.(this is simple because the direction is through z axis) i wish i could explained the problem

Share on other sites
I have no idea what you just asked. Especially why you would consider p to between v1 and v2. Also, v1 and v2 aren't parallel.

Share on other sites
Just a guess but first get new vectors from the bases of the old vector to the new point. Now project the new vectors on to the old vectors. if the projection is shorter than the old vector the point could be between the vectors. You will also need to check that the angle between the new vector and the original vector points in the "right" direction.

Share on other sites
Vectors are either a direction, in which case their 'position' is meaningless, or they represent a point and 'direction' is meaningless.

Trying to find a position relating to vectors assumes that at least one vector is a position representation, yet you say the vectors must be parallel (which is meaningless).

Can you draw us a picture instead?

Share on other sites
part of cube-sphere collision detector.sphere is randomly producing because of this i want to learn where the sphere is according to cube (upper surface,bottom surface,corner.....?)

Share on other sites
Are you asking how to determine if a point lies within a 'wedge' formed by two vectors, with the point and the vectors projected to a cardinal plane? Something like:
\          / \ * (in) /  \      /   \    /    * (out)    \  /     \/
?

Share on other sites
Quote:
 Original post by nkjsat2part of cube-sphere collision detector.sphere is randomly producing because of this i want to learn where the sphere is according to cube (upper surface,bottom surface,corner.....?)
There are established algorithms for performing this sort of test. For a simple Boolean test, compute the point on the cube closest to the sphere center and compare the distance from the sphere center to this point to the sphere radius. (It's also possible to compute collision information - i.e. contact manifold and normal - using this method.)

Share on other sites
if you look Square-sphere collision section at
http://petesqbsite.com/sections/express/issue24/Time_based_motion_&_Collision_detection.htm

we can learn the position of the point with
/////////////////////
IF spherex < squarex1 THEN

xc = 1

ELSEIF spherex < squarex2 THEN

xc = 2

ELSE

xc = 3

END IF
/////////////////////
but in 3d comparing points is not working because of this i want to use vectors

Share on other sites
Quote:
 Original post by nkjsat2if you look Square-sphere collision section athttp://petesqbsite.com/sections/express/issue24/Time_based_motion_&_Collision_detection.htmwe can learn the position of the point with /////////////////////IF spherex < squarex1 THEN xc = 1ELSEIF spherex < squarex2 THEN xc = 2ELSE xc = 3END IF/////////////////////but in 3d comparing points is not working because of this i want to use vectors
The algorithm is the same in 3-d as it is in 2-d.

I see what you're trying to do (classify the point with respect to two edges that meet at a corner), but this is the wrong way to think about it. What you're really doing is classifying the point with respect to the hyperplanes (lines in 2-d, planes in 3-d) that define the box. Classifying the point with respect to each of these hyperplanes tells you in which Voronoi region (the differently colored areas in the diagrams in the article you linked to) the point falls.

That said, I think the method presented in the article is a bit overly complicated. Here's a more straightforward method:
bool IntersectSphereBox(vector3 center, float radius, vector3 min, vector3 max){    vector3 closest = center;    for (int i = 0; i < 3; ++i) {        closest = min(max(closest, min), max));    }    return length(closest - center) < radius;}

1. 1
2. 2
Rutin
17
3. 3
4. 4
5. 5

• 26
• 11
• 9
• 9
• 11
• Forum Statistics

• Total Topics
633702
• Total Posts
3013449
×