princetonpku / hccl-archive

Automatically exported from code.google.com/p/hccl-archive
0 stars 0 forks source link

Vector-Vector간 Vector-Quaternion간, Quaternion-Quaternion간 Typecast 연산자 정의 #11

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
typecast용 static 함수가 필요할 것 같네요. C에서도 double에서 
float으로 강제형변환을 한다든가, double에서 int로 
강제형변환을 한다든가 하는 것이 있는데, 이를 위한 typecast 
함수도 구현해야할 것 같습니다. 기본적으로 C++의 
static_cast<>를 따라했으면 싶은데... 기존에 구현되어 있는 
static_cast를 Vector## 시리즈들에 대해서도 overloading하는 
방식으로 구현했으면 합니다. 예를들어

Vector3d a;
// Assign some values to a
Vector3f b = static_cast<Vector3d>(a);

요런식의 변환이 가능하면 좋겠네요. (Vector 뿐만 아니라 
Quaternion도)

마찬가지로 단순히 double에서 float으로 변환하고 이런 문제 
뿐만 아니라 아에 다른 성질의 변수들, 즉 벡터에서 
쿼터니언으로의 변환 등이 가능해야 할 것입니다.
Vector (x, y, z) --> Quaternion (0, x, y, z)
Quaternion (0, x, y, z) --> Vector (x, y, z)
로 변경이 가능해야 합니다. 그래야 point의 rotation 등을 좀 
더 수월하게 계산할 수 있습니다.
이 역시도 static_cast<> 연산자를 오버로딩하는 방식으로 
구현되었으면 합니다.

Original issue reported on code.google.com by mec...@gmail.com on 24 Jul 2012 at 6:27

GoogleCodeExporter commented 9 years ago
이 부분은 어느 정도 프로그래밍 자신있는 분들이 
맡아주시는 게 젤 좋겠습니다. 그리고 accept하실 분들은 
저와 개인적으로 상의 후 작업 들어갔으면 좋겠네요.

Original comment by mec...@gmail.com on 24 Jul 2012 at 6:31

GoogleCodeExporter commented 9 years ago
이건 그냥 제가 짤께요~

Original comment by mec...@gmail.com on 24 Jul 2012 at 8:16

GoogleCodeExporter commented 9 years ago

Original comment by mec...@gmail.com on 24 Jul 2012 at 9:27