PDA

View Full Version : 4 point tracking orientation


darkmoon3d
09-17-2009, 01:04 AM
I'm working on a project involving tracking several boxes from two video cameras. Am tracing with 4 points the top of every box and would like to obtain position and orientation from this.

a------b
| \.... / |
| . \ / ..|
| ...e .. |
| . / \ ..|
| /.... \ |
d------c

Have figured that I could simply find midpoint between two points such as (a and c) or (b and d) and then take midpoint from those. For orientation am trying to find how to calculate angle from (a to d). Is there a particular formula to find these?

magicm
09-17-2009, 01:20 AM
For orientation am trying to find how to calculate angle from (a to d). Is there a particular formula to find these?
To find the angle between 2 (2d) points you can use
n = normalize (d - a)
atan2 n.y n.x
Martijn

darkmoon3d
09-18-2009, 07:22 PM
Thanks for solution. I ended up finding an answer with this script: http://www.scriptspot.com/3ds-max/three-point-orientation which runs based on 3 points rather than 4 which in the end was simpler to use. Modified much of code to work to work with mine such as position is set to midpiont rather than setting position at one of the points.

CGTalk Moderation
09-18-2009, 07:22 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.