matrix.h

00001 /*
00002  * matrix
00003  *
00004  * Copyright 2008 Dean Ferreyra <dferreyra@igc.org>, All rights reserved
00005  *
00006  * This file is part of Footprint-Update.
00007  * 
00008  * Footprint-Update is free software: you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation, either version 3 of the License, or
00011  * (at your option) any later version.
00012  * 
00013  * Footprint-Update is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  * 
00018  * You should have received a copy of the GNU General Public License
00019  * along with Footprint-Update.  If not, see <http://www.gnu.org/licenses/>.
00020  *
00021  * $Id: matrix.h,v 1.3 2008-05-22 04:52:13 dean Exp $
00022  */
00023 
00024 #ifndef MATRIX_H_INCLUDED
00025 #define MATRIX_H_INCLUDED 1
00026 
00027 #include "utilities.h"
00028 
00029 /*
00030  * 3x1 Vectors
00031  */
00032 
00033 typedef double Vector3x1[3][1]; /* [row][column] */
00034 
00035 void make_vec(Vector3x1 vec, double x, double y);
00036 CheapPointType vec_to_point(Vector3x1 vec);
00037 void point_to_vec(CheapPointType pt, Vector3x1 vec);
00038 
00039 /*
00040  * 3x3 Matrices
00041  */
00042 
00043 typedef double Matrix3x3[3][3]; /* [row][column] */
00044 
00045 void make_identity_matrix(Matrix3x3 mat);
00046 void make_translation_matrix(Matrix3x3 mat, double dx, double dy);
00047 void make_rotation_matrix(Matrix3x3 mat, double theta);
00048 void make_reflection_matrix_x_axis(Matrix3x3 mat);
00049 void make_reflection_matrix_y_axis(Matrix3x3 mat);
00050 void copy_matrix(Matrix3x3 src, Matrix3x3 dst);
00051 
00052 void multiply_matrix_vector(Matrix3x3 mat, Vector3x1 vec,
00053                             Vector3x1 result);
00054 void multiply_matrix_matrix(Matrix3x3 mat1, Matrix3x3 mat2,
00055                             Matrix3x3 result);
00056 void multiply_matrix_matrix_inplace(Matrix3x3 mat1, Matrix3x3 mat2);
00057 CheapPointType transform_point(Matrix3x3 mat, CheapPointType pt);
00058 
00059 /*
00060  * Logging
00061  */
00062 
00063 void log_vector(Vector3x1 vec);
00064 void debug_log_vector(Vector3x1 vec);
00065 void log_matrix(Matrix3x3 mat);
00066 void debug_log_matrix(Matrix3x3 mat);
00067 
00068 #endif

Generated on Tue Aug 17 15:28:04 2010 for pcb-plugins by  doxygen 1.4.6-NO