Permalink
Browse files

Able to Traingulate the points during the eye calibration.

  • Loading branch information...
mdfeist committed Jun 12, 2013
1 parent 8505d2f commit 395728a5b876fc160a40cbd045fab5cba1c0efa2
@@ -173,6 +173,7 @@
<FileType>CppForm</FileType>
</ClInclude>
<ClInclude Include="MainFormController.h" />
+ <ClInclude Include="Marcos.h" />
<ClInclude Include="Marker.h" />
<ClInclude Include="NatNetClientSetup.h" />
<ClInclude Include="Objects.h" />
@@ -165,6 +165,9 @@
<ClInclude Include="FormController.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="Marcos.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="app.rc">
@@ -5,8 +5,7 @@
#include <osg/Matrix>
#include "Marker.h"
-
-#define EPSILON 0.00001
+#include "Marcos.h"
class CaptureObjectUtil
{
@@ -14,12 +14,12 @@
using namespace std;
// Dikablis
-int ClientHandler::DikablisViewingWidth = 768;
-int ClientHandler::DikablisViewingHeight = 576;
+unsigned long ClientHandler::DikablisViewingWidth = 768;
+unsigned long ClientHandler::DikablisViewingHeight = 576;
-int ClientHandler::DikablisViewingMargin = 100;
+unsigned long ClientHandler::DikablisViewingMargin = 100;
-int ClientHandler::DikablisViewingSize = 3 * ((DikablisViewingWidth + 2*DikablisViewingMargin) * (DikablisViewingHeight + 2*DikablisViewingMargin));
+unsigned long ClientHandler::DikablisViewingSize = 3 * ((DikablisViewingWidth + 2*DikablisViewingMargin) * (DikablisViewingHeight + 2*DikablisViewingMargin));
// Constructor: Sets the default values for the ClientHandler
ClientHandler::ClientHandler(void)
@@ -56,20 +56,6 @@ ClientHandler::~ClientHandler(void)
free(this->dikablisEyeVectorArray);
}
-void ClientHandler::setRay(osg::Vec3 ray, int x, int y) {
- if (this->dikablisEyeVectorArray != NULL) {
- int i = x + DikablisViewingMargin;
- int j = y + DikablisViewingMargin;
-
- int loc = (j*DikablisViewingWidth*2*DikablisViewingMargin) + i;
- loc *= 3;
- if (loc >= 0 && loc < DikablisViewingSize - 3) {
- this->dikablisEyeVectorArray[loc + 0] = ray.x();
- this->dikablisEyeVectorArray[loc + 1] = ray.y();
- this->dikablisEyeVectorArray[loc + 2] = ray.z();
- }
- }
-}
osg::Vec3 ClientHandler::getRay(int x, int y) {
osg::Vec3 ray;
@@ -78,7 +64,7 @@ osg::Vec3 ClientHandler::getRay(int x, int y) {
int i = x + DikablisViewingMargin;
int j = y + DikablisViewingMargin;
- int loc = (3*j*DikablisViewingWidth*2*DikablisViewingMargin) + i;
+ int loc = 3*((j*DikablisViewingWidth+2*DikablisViewingMargin) + i);
ray.x() = this->dikablisEyeVectorArray[loc + 0];
ray.y() = this->dikablisEyeVectorArray[loc + 1];
@@ -88,66 +74,6 @@ osg::Vec3 ClientHandler::getRay(int x, int y) {
return ray;
}
-void ClientHandler::save() {
- int width = 512;
- int height = 512;
-
- HANDLE file;
- BITMAPFILEHEADER fileHeader;
- BITMAPINFOHEADER fileInfo;
- RGBTRIPLE *image;
- DWORD write = 0;
- image = new RGBTRIPLE[width*height*24];
-
- file = CreateFile(L"C:\\Users\\mdfeist\\Desktop\\rayMap.bmp",GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL); //Sets up the new bmp to be written to
-
- fileHeader.bfType = 19778; //Sets our type to BM or bmp
- fileHeader.bfSize = sizeof(fileHeader.bfOffBits) + sizeof(RGBTRIPLE); //Sets the size equal to the size of the header struct
- fileHeader.bfReserved1 = 0; //sets the reserves to 0
- fileHeader.bfReserved2 = 0;
- fileHeader.bfOffBits = sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER); //Sets offbits equal to the size of file and info header
-
- fileInfo.biSize = sizeof(BITMAPINFOHEADER);
- fileInfo.biWidth = width;
- fileInfo.biHeight = height;
- fileInfo.biPlanes = 1;
- fileInfo.biBitCount = 24;
- fileInfo.biCompression = BI_RGB;
- fileInfo.biSizeImage = width * height * (24/8);
- fileInfo.biXPelsPerMeter = 2400;
- fileInfo.biYPelsPerMeter = 2400;
- fileInfo.biClrImportant = 0;
- fileInfo.biClrUsed = 0;
-
- WriteFile(file,&fileHeader,sizeof(fileHeader),&write,NULL);
- WriteFile(file,&fileInfo,sizeof(fileInfo),&write,NULL);
-
- for (int i = 0; i < width*height*24; i++)
- {
- int index = i / 24;
-
- if (index >= 0 && index < DikablisViewingSize - 3) {
- int b = 10*(this->dikablisEyeVectorArray[3*index + 0] + 20);
- int g = 10*(this->dikablisEyeVectorArray[3*index + 1] + 20);
- int r = 10*(this->dikablisEyeVectorArray[3*index + 2] + 20);
-
-
- image[i].rgbtBlue = b;
- image[i].rgbtGreen = g;
- image[i].rgbtRed = r;
- } else {
- image[i].rgbtBlue = 255;
- image[i].rgbtGreen = 255;
- image[i].rgbtRed = 255;
- }
- }
-
- WriteFile(file, image, fileInfo.biSizeImage, &write, NULL);
-
- CloseHandle(file);
-}
-
-
// Add a Rigid Body to the ClientHandler
bool ClientHandler::addRigidBody(int id, RigidBody* rigidBody)
{
@@ -52,10 +52,10 @@ class ClientHandler
// Dikablis
// Width and Height of the Field of View for the Dikablis
- static int DikablisViewingWidth;
- static int DikablisViewingHeight;
- static int DikablisViewingMargin;
- static int DikablisViewingSize;
+ static unsigned long DikablisViewingWidth;
+ static unsigned long DikablisViewingHeight;
+ static unsigned long DikablisViewingMargin;
+ static unsigned long DikablisViewingSize;
// Used to store the calibrated eye vectors
float *dikablisEyeVectorArray;
@@ -147,13 +147,12 @@ class ClientHandler
int getRigidBodyTool() { return rigidBodyTool; }
// Dikablis
- static int getDikablisViewingWidth() { return DikablisViewingWidth; }
- static int getDikablisViewingHeight() { return DikablisViewingHeight; }
- static int getDikablisViewingMargin() { return DikablisViewingMargin; }
- static int getDikablisViewingSize() { return DikablisViewingSize; }
+ static unsigned long getDikablisViewingWidth() { return DikablisViewingWidth; }
+ static unsigned long getDikablisViewingHeight() { return DikablisViewingHeight; }
+ static unsigned long getDikablisViewingMargin() { return DikablisViewingMargin; }
+ static unsigned long getDikablisViewingSize() { return DikablisViewingSize; }
- void setRay(osg::Vec3 ray, int x, int y);
+ //void setRay(osg::Vec3 ray, int x, int y);
osg::Vec3 getRay(int x, int y);
- void save();
};
Oops, something went wrong.

0 comments on commit 395728a

Please sign in to comment.