Beispiel #1
0
void OpenGL::DrawLine(const Matrix& p, const Matrix& q, double width)
{
	if ( (p.GetRow() != 3) || (p.GetCol() != 1) || (q.GetRow() != 3) || (q.GetCol() != 1) )
	{
		fprintf(stderr, "OpenGL::DrawLine Invalid Matrix");
		return;
	}

	DrawLine( p(1), p(2), p(3), q(1), q(2), q(3), width );

	return;
}
Beispiel #2
0
void OpenGL::DrawFrame(const Matrix& p, const Matrix& q)
{
	if ( (p.GetRow() != 3) || (p.GetCol() != 1) || (q.GetRow() != 3) || (q.GetCol() != 1) )
	{
		fprintf(stderr, "OpenGL::DrawFrame Invalid Matrix");
		return;
	}

	DrawFrame( p(1), p(2), p(3), q(1), q(2), q(3) );

	return;

}
Beispiel #3
0
void OpenGL::DrawPolygonSurface(const Matrix& p, const Matrix& q, const Matrix& r)
{
	if ( (p.GetRow() != 3) || (p.GetCol() != 1) ||
		 (q.GetRow() != 3) || (q.GetCol() != 1) ||
		 (r.GetRow() != 3) || (r.GetCol() != 1) )
	{
		fprintf(stderr, "OpenGL::DrawPolygonSurface Invalid Matrix\n\n");
		return;
	}

	DrawPolygonSurface( p(1), p(2), p(3), q(1), q(2), q(3), r(1), r(2), r(3) );

	return;
}
Beispiel #4
0
void Draw::Correspond(const Matrix &Img1, const Matrix &Img2,
                      const vector<Point2D> &feature1, const vector<Point2D> &feature2,S32 FeatureNum,
                      Matrix &Result)
{
    Result.Init(Img1.GetRow() , Img1.GetCol()* 2 + 10);
    int offset = Img1.GetCol() + 10;
    for (int i = 0; i < Img1.GetCol(); i++)
        for (int j = 0; j < Img1.GetRow(); j++)
        {
            Result(j, i) = Img1(j, i);
            Result(j, i + offset) = Img2(j, i);
        }
    for (int i = 0; i < FeatureNum; i++)
    {
        Line(Result, feature1[i].X, feature1[i].Y, feature2[i].X + offset, feature2[i].Y,
             255);
        Circle(Result,feature1[i].X, feature1[i].Y,2,255);
        Circle(Result,feature2[i].X + offset, feature2[i].Y,2,255);
    }
}
Beispiel #5
0
static void printMatrix(Matrix a)
{
    for (int i = 0; i < a.GetRow(); ++i)
    {
        for (int j = 0; j < a.GetCol(); ++j)
        {
            printf("%f ", a(i, j));
        }
        printf("\n");
    }
    printf("\n");
}
Beispiel #6
0
// Encoder
int DetailEncoder(int res[], Matrix key, int result[], int length) {
	// Initialization
	for (int i = 0; i < length; i++)
		result[i] = 0;
	// Start encoding
	for (int i = 0; i < key.GetCol(); i++) {
		for (int j = 0; j < key.GetRow(); j++)
			result[i] = result[i] + res[j] * key.GetValue(j, i);
	}
	for (int i = 0; i < length; i++)
		result[i] = result[i] % 26;
}
Beispiel #7
0
// Matrix Multiply
Matrix Matrix::operator* (Matrix& other)
{
	float fNewMatrix[16];
	memcpy (fNewMatrix, fMatrix, 64);

	#define Mat(r,c) (fNewMatrix[r+4*c])
	for (int r=0; r<3; r++)
	{
		for (int c=0; c<3; c++)
			Mat(r,c) = GetRow(r) * other.GetCol(c);
	}
	#undef Mat

	return Matrix (fNewMatrix);
}