//// 최종 수정일 : 2014년 3월 1일
//// 최종 작정자 : 캠캡
//// 소스 설명 : 2차원 벡터의 클래스화 및 인공지능 공부에 필요한 연산 구현
//// 에러 : 현재까지 없음.
#pragma once
template <typename T = float>
class Vector2D
{
private:
T x;
T y;
public:
explicit Vector2D();
explicit Vector2D(T _x, T _y);
template <typename Y>
explicit Vector2D(const Vector2D<Y>& other);
virtual ~Vector2D(void);
inline void Zero();
//벡터의 요소를 0으로 설정
inline bool isZeor() const;
//벡터의 요소가 모두 0인지 확인
inline double Length() const;
//벡터의 길이를 반환
inline double LengthSq() const;
//벡터의 길이를 제곱으로 반환
inline void Normalize();
//정규화 벡터를 반환
inline double dot(const Vector2D& v2) const;
//내적
//내적을 이용하여 매개변수 벡터의 방향을 판별
//시계 방향에 있으면 양의 값을 반환
//시계 반대방향에 있으면 음의 값을 반환
inline int sign(const Vector2D& v2) const;
inline Vector2D& Perp() const;
//현재 벡터에 수직인 벡터를 반환
inline void Truncate(T max);
//벡터 길이가 최대값을 넘지 않도록 x,y를 조정
inline double Distance(const Vector2D& v2) const;
//두 벡터의 길이를 반환
inline double DistanceSq(const Vector2D& v2) const;
//두 벡터의 길이를 제곱하여 반환
inline Vector2D& GetReverse() const;
//두 벡터의 반대 방향을 반환
const Vector2D& operator+= (const Vector2D& rhs);
const Vector2D& operator-= (const Vector2D& rhs);
template <typename Y>
const Vector2D& operator*= (const T& ths);
template <typename Y>
const Vector2D& operator/= (const T& ths);
bool operator== (const Vector2D& rhs);
bool operator!= (const Vector2D& rhs);
T GetX() const;
T GetY() const;
};
IOCP란.. (0) | 2014.04.17 |
---|---|
클라이언트 서버 환경에서 통신 (0) | 2014.03.27 |
fork()와 exec() (2) | 2014.03.20 |
WSAGetLastError함수 -에러목록- (0) | 2014.03.03 |
두 직선, 벡터 사이의 관계 (사이각, 회전각) 구하기. (0) | 2014.03.01 |
댓글,
Lowpoly
게임 서버 프로그래머 지망생