C언어, 벡터(Vector) 연산, 행렬(Matrix) 연산 소스
- 최초 등록일
- 2007.04.07
- 최종 저작일
- 2003.12
- 압축파일
- 가격 무료
다운로드
소개글
벡터와 행렬 연산 소스입니다. 클래스로 작성되어 있고요, 분량이 꽤 많습니다.
기본적인 벡터, 행렬 연산은 다 들어 있고요. 벡터 내적, 벡터 외적, 벡터 길이 구하는 함수가 들어 있습니다.
벡터는 종류는 v(x,y), v(x,y,z), v(x,y,z,w) 3가지의 클래스가 있습니다.
행렬도 역시 기본 연산과 함께 전치행렬, 행렬식, 역행렬 구하는 함수가 들어 있습니다.
행렬 종류는 2x2, 3x3, 4x4 클래스가 있습니다.
참고로~
오래전에 OPENGL 처음 배울때 작성한 코드라 틀린 부분도 있을 수 있으니 참고, 수정용으로 쓰시면 좋을 듯 합니다. 틀린 부분이 있으면 고쳐서 쓰세요 ^^;;
컴파일 실행환경
VC++
본문내용
<b>ML_Matrix.cpp
ML_Matrix.h
ML_Vector.cpp
ML_Vector.h</b>
#include "Matrix.h"
CMatrix22::CMatrix22()
{
IdenCMatrix();
}
CMatrix22::CMatrix22(float m11, float m12,
float m21, float m22)
{
_11 = m11; _12 = m12;
_21 = m21; _22 = m22;
}
void CMatrix22::IdentMatrix()
{
_11 = 1.0f; _12 = 0.0f;
_21 = 0.0f; _22 = 1.0f;
}
void CMatrix22::ZeroMatrix()
{
_11 = 0.0f; _12 = 0.0f;
_21 = 0.0f; _22 = 0.0f;
}
CMatrix22 CMatrix22::operator +(const CMatrix22 &mat) const
{
CMatrix22 result;
result._11=_11+mat._11; result._12=_12+mat._12;
result._21=_21+mat._21; result._22=_22+mat._22;
return result;
}
CMatrix22 CMatrix22::operator -(const CMatrix22 &mat) const
{
CMatrix22 result;
result._11=_11-mat._11; result._12=_12-mat._12;
result._21=_21-mat._21; result._22=_22-mat._22;
return result;
}
CMatrix22 CMatrix22::operator *(const CMatrix22 &mat) const
압축파일 내 파일목록
ML_Matrix.h
ML_Vector.h
ML_Vector.cpp
ML_Matrix.cpp
참고 자료
없음