line intersect node (using equations)

Get answers to all your basic programming questions. No Ogre questions, please!
robel
Halfling
Posts: 97
Joined: Fri Sep 28, 2012 4:12 pm

line intersect node (using equations)

Post by robel »

Hi,
as in the definition of the this section"back to basics" no ogre question so i have mathematic question :
i have two nodes they are not attached one to the other , and i can"t attach them .
i have these situation :
Image
i want to change the node2 posistion , to avoide the intersection beteen the line and the cube

so , my idea is to
1-get the line equation gived by two position point (node1 position and node2 position )
2-get the cube equation ( maybe i will use the bounding box of the cube because i know the dimention of the boundingbox)

3-make the intersection =0 , and i will get the x,y,z of the node2

can you help to aplicate that, even just by give me links to how calculate the eqations