Search Results for 'Geometry'

ATOM Icon

1 POSTS

  1. 2009/07/23 Declare Point Class by chungki

Declare Point Class

Point는 기본적으로 쓰이는 기능이다. 모든 Cartesian에서 Point는 반드시 필요하다.
Point는 다음과 같이 정의한다.
Declare 2D Point Template Class
 template < typename _tx >
 class Point2
 {
 public:
 typedef _tx valuetype;
 union { struct {_tx x,y;} _tx _m[2]; }
 public:
 Point2() : x(0),y(0)
 Point2(IN _tx _x, IN _tx _y) : x(_x),y(_y)
 } ;
Declare 3D Point Template Class
 template < typename _tx > class Point3 { public: union { struct {_tx x,y,z;} _tx _m[3]; } public: Point3() : x(0),y(0),z(0) Point3(IN _tx _x, IN _tx _y,IN _tx _z) : x(_x),y(_y),z(_z) } 
union을 사용한 이유는 Point를 사용할 때 x,y성분을 따로 쓰긴 하지만, 배열 형태로 사용할 수도 있다. 그래서 사용의 유연성을 확보하기 위하여 union을 기능을 사용한다.>

Posted by chungki

2009/07/23 11:18 2009/07/23 11:18
,
Response
No Trackback , No Comment
RSS :
http://www.chungki.net/tc/rss/response/278


블로그 이미지

Nice !!!!!!!!

- chungki

Notices

Archives

Authors

  1. chungki

Calendar

«   2012/05   »
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    

Site Stats

Total hits:
73375
Today:
6
Yesterday:
20