-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added global-to-local and local-to-global transforms
- Loading branch information
Showing
3 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include "transforms.h" | ||
|
||
using namespace argos; | ||
|
||
/****************************************/ | ||
/****************************************/ | ||
|
||
CVector3 GlobalToLocal(const CVector3& c_global, | ||
const CVector3& c_translation, | ||
const CQuaternion& c_orientation) { | ||
CVector3 cLocal = c_global - c_translation; | ||
cLocal.Rotate(c_orientation.Inverse()); | ||
return cLocal; | ||
} | ||
|
||
/****************************************/ | ||
/****************************************/ | ||
|
||
CVector3 LocalToGlobal(const CVector3& c_local, | ||
const CVector3& c_translation, | ||
const CQuaternion& c_orientation) { | ||
CVector cGlobal = c_local.Rotate(c_orientation); | ||
cGlobal += c_translation; | ||
return cGlobal; | ||
} | ||
|
||
/****************************************/ | ||
/****************************************/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#ifndef TRANSFORMS_H | ||
#define TRANSFORMS_H | ||
|
||
namespace argos { | ||
|
||
CVector3 GlobalToLocal(const CVector3& c_global, | ||
const CVector3& c_translation, | ||
const CQuaternion& c_orientation); | ||
|
||
CVector3 LocalToGlobal(const CVector3& c_local, | ||
const CVector3& c_translation, | ||
const CQuaternion& c_orientation); | ||
|
||
} | ||
|
||
#endif // TRANSFORMS_H |