1

i have an object and a 3d direction vector and position for it . I would like to know how do i determine if a certain point X is in the space below the plan determined by my direction ?

Here is an image that i have drawn to make it more clear . In this image i've made the vector 2d

enter image description here

Please Help!

Regards, Aleandru Badescu

vadim123
  • 82,796
Alex
  • 391
  • draw a vector from x to the start of the arrow and ask what the cross product of the two vectors tells you. –  Oct 25 '10 at 08:46
  • the cross product returns an vector that is perpendicular to both my first vectors. How could i use this information to solve my problem? – Alex Oct 25 '10 at 08:54
  • *to both vectors – Alex Oct 25 '10 at 09:00
  • I'm not sure I'm understanding your question: a "direction" (straight line) in the space doesn't determine a plane: you need two straight lines. – Agustí Roig Oct 25 '10 at 09:02
  • i didn't quite explain right; let me tell you exactly what i want : i have a spaceship A that has a position and a direction, it can be rotated up/down, left/right. If another spaceship B is below Ai would like my spaceship A to rotate down ( so that i may move to it ) . The same think must be done if spaceship B is in A's left or right : if B on my left, rotate left, if B on right, rotate right . – Alex Oct 25 '10 at 09:12
  • What do you mean by "below"? In the negative $z$ direction? – Hans Lundmark Oct 25 '10 at 09:15
  • if you imagine a spaceship rotated up/down right/left , 'below' if under the plane determined by the spaceship's deck – Alex Oct 25 '10 at 09:27
  • correction : *plain – Alex Oct 25 '10 at 09:40
  • "Plane" is the right word here. – Hans Lundmark Oct 25 '10 at 10:49
  • If the spaceship can be rotated arbitrarily in 3d space, a single direction isn't enough to specify its orientation. If, for example, your vector describes which way the nose of the ship is pointing, you still have the freedom to do a "roll". So from just the vector it's impossible to tell what is "below" the ship. – Hans Lundmark Oct 25 '10 at 10:53
  • in my example rolls are not possible. That is why i've specified that it can rotate only up/down left/right – Alex Oct 25 '10 at 16:13

1 Answers1

1

You have a point $x$, vector $v$, and also some vertical vector, pointing down. Lets call it $g$. If I have understood your problem correctly, your plane contains $(0,0,0)$ (or otherwise you can write $x$ in the coordinate system with origin on the plane), vector $v$, and a vector $w=v\times g$ --- horizontal vector, orthogonal to $v$. I want to interpret $x$ as a vector (from the origin to the point $x$). Then for some $\alpha\in\mathbb{R}$ vector $x-\alpha g$ is on the plane and $x$ is below the plane if and only if $\alpha>0$. We have $$(x-\alpha g, v\times w)=0,$$ $$(x-\alpha g, v\times[v\times g])=0,$$ $$(x-\alpha g, v(v,g)-g(v,v))=0,$$ $$(x, v)(v,g)-(x,g)(v,v)=\alpha\bigl((g,v)(g,v)-(g,g)(v,v)\bigr),$$ $$\alpha=\bigl((x, v)(v,g)-(x,g)(v,v)\bigr)/\bigl((g,v)(g,v)-(g,g)(v,v)\bigr).$$

Fiktor
  • 3,112
  • the vector v is pointing down relative to the objects rotation or parallel to the 0y axis ? – Alex Oct 25 '10 at 10:01
  • If Oz is the vertical axis then g=(0,0,-1) and $v$ is the given vector (in the problem you have asked you have a vector and a point). I haven't written anything about rotation. – Fiktor Oct 25 '10 at 10:05
  • ah yes, i got lost in my head. If i would want to find out if an object is in my right, what would i have to change? the g vector ? – Alex Oct 25 '10 at 10:11
  • You should find a vector $r$ pointing right and check if $(x,r)>0$. In my notation you can take $r=w=v\times g$. – Fiktor Oct 25 '10 at 10:14
  • Sorry, it should be $r=-w=-v\times g$ – Fiktor Oct 25 '10 at 12:19
  • thanks for the edit. i'll try the code and let you know how it went – Alex Oct 25 '10 at 16:07
  • the code doesn't quite work. i'm going to insert the code (in more comments because it doesn't all fit in ) and if it's not that much of a bother, maybe you could look at it . – Alex Oct 25 '10 at 16:50
  • http://snipt.org/llono/ – Alex Oct 25 '10 at 17:04
  • I think in your code the pitch axis is not necessarily horizontal. I am not sure I have understood the meaning of your code, but I think you should take $r=ship.orientation.Right$, $\alpha=\pm (x, v\times r)$ in the case of vertical rotation and $\alpha=(x,r)$ in the case of horizontal one. – Fiktor Oct 25 '10 at 17:56