NANA
geometrytypes.hpp
浏览该文件的文档.
1#pragma once
2
21namespace NANA {
22namespace ComputerGeometry {
25
28template<typename _Tp>
29struct Line2D_ {
30 union {
31 struct {
32 _Tp x, y, dx, dy;
33 };
34 _Tp data[4];
35 };
36
37};
38
42template<typename _Tp>
43struct Line3D_ {
44 union {
45 struct {
46 _Tp x, y,z, dx, dy,dz;
47 };
48 _Tp data[6];
49 };
50};
51
55template<typename _Tp>
56struct PointXY_ {
57 PointXY_(_Tp _x, _Tp _y) {
58 x = _x;
59 y = _y;
60 data[2] = static_cast<_Tp>(1);
61 }
62 union {
63 struct {
64 _Tp x, y;
65 };
66 _Tp data[3];
67 };
68};
69
70
74template<typename _Tp>
75struct PointXYZ_ {
76 PointXYZ_(_Tp _x, _Tp _y, _Tp _z) {
77 x = _x;
78 y = _y;
79 z = _z;
80 data[3] = static_cast<_Tp>(1);
81 }
82 union {
83 struct {
84 _Tp x;
85 _Tp y;
86 _Tp z;
87 };
88 _Tp data[4];
89
90 };
91};
92
96template<typename _Tp>
97struct Rect_ {
98 _Tp x, y, w, h;
99};
100
109template<typename _Tp>
110struct Plane_ {
111 union {
112 struct {
113 _Tp a;
114 _Tp b;
115 _Tp c;
116 _Tp d;
117 };
118 _Tp data[4];
119 };
120};
121
123
124
125}
126}