Generating Corner points of Rectangular Box using center point and forward vector

3DPat
Unregistered
 
Post: #1
Hi all.. Please help me with this!!!

I have a rectangular box, knwing its length,width n height, at origin with some forward vector. This box is translated and oriented in space.

Knowing the forward vector and the center of the cube, how can i calculate the 8 corner points ???

I tried using this... calculating the other 2 perpendicular vectors from the forward vector... then calculating the diagonal vector... but unable to proceed ne further to locate the points on this vector...

Eagerly awaiting some useful reponses

3DPat
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #2
You need to know either the box orientation in angles, or the up vector.

If you have the up vector, then you can grab the right vector too, as you said. From these, you can find the midpoints on the box's planes. (Just walk in the direction of all three vectors for the appropriate lengths, in both directions).

From the planes' center points, you can find its corners. For instance, if you use the "up" vector to find the top side, then you you can use the front and right vectors to find one corner. (center point + (front vector * length/2) + (right vector * length / 2). Then you can use different combinations of signs (┬▒front vector, ┬▒right vector) to find the other corners of that side. Then you can just give it a quick thought and see which corners are already calculated and remove any duplicates.
Quote this message in a reply
Sage
Posts: 1,199
Joined: 2004.10
Post: #3
Another approach -- which I take -- is if you know the transformation matrix that the box has in world space; you can create your eight corner points in untransformed space ( e.g., where the box would be with an identity transform ) and then transform those eight points by the box's actual transform.
Quote this message in a reply
3DPat
Unregistered
 
Post: #4
Thank you Fenris and TomorrowPlusX for this immediate response...

But i still hav some problems...

TomorrowPlusX .. ur suggestion wud wrk jst perfect in my case... but the problem im facing is tht ... i need to perform these calculations for mobile devices... in this i get the transformation matrix but i cant apply the orientation directly on it. So the problem of orientation still exists...

And Fenris similarly for ur suggestions the problem i face is calculating the angles... coz i want to avoid using Inverse Sine,Cosine calculations... so im still stuck up...

Both ur solutions were just perfect.. but somehow they dont meet the constraints im having... I wonder can it b done somehow just manuplating the Vectors tht i hav and using the length,width n height.

Please do give it a thought...

Thanks again..
3DPat
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #5
A center and a forward vector do not uniquely specify the orientation of your box. There must be another constraint. Once you decide what that constraint is, either of Fenris' or TomorrowPlusX's solutions will work just fine. Until you decide what that constraint is, you cannot solve this problem.
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #6
Also, just need to point out that my solution does not require any trigonometry. Smile Just simple vector adds and scalar multiplications.
Quote this message in a reply
3DPat
Unregistered
 
Post: #7
Hii Fenris,
Thanks for ur replies... using ur technique in the method suggested by TomorrowPlusX helped me solve my problem... it was possible only after calculating the 2nd vector along with the forward vector .

Thankyou all...

3DPat
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  finding a training center - Heeeelp Glauter 1 2,860 Dec 26, 2011 12:30 PM
Last Post: zenkimoto
  Generating an Index from a 3d Vector Oddity007 2 2,634 Aug 18, 2009 05:38 PM
Last Post: Oddity007
  Angle between two points? Graphic Ace 6 5,347 Nov 8, 2008 12:11 PM
Last Post: macnib
  Good collision points Skorche 7 4,582 Sep 22, 2005 09:09 PM
Last Post: Skorche
  Algorithm for moving between two points on a plane... WhatMeWorry 4 4,588 Aug 23, 2005 11:36 AM
Last Post: unknown