107 vertex& vertex::operator+= (vertex other) { |
107 vertex& vertex::operator+= (vertex other) { |
108 move (other); |
108 move (other); |
109 return *this; |
109 return *this; |
110 } |
110 } |
111 |
111 |
|
112 int vertex::operator< (const vertex& other) const { |
|
113 if (operator== (other)) |
|
114 return false; |
|
115 |
|
116 if (coord (X) < other[X]) |
|
117 return true; |
|
118 |
|
119 if (coord (X) > other[X]) |
|
120 return false; |
|
121 |
|
122 if (coord (Y) < other[Y]) |
|
123 return true; |
|
124 |
|
125 if (coord (Y) > other[Y]) |
|
126 return false; |
|
127 |
|
128 return coord (Z) < other[Z]; |
|
129 } |
|
130 |
|
131 // ============================================================================= |
112 matrix::matrix (double vals[]) { |
132 matrix::matrix (double vals[]) { |
113 for (short i = 0; i < 9; ++i) |
133 for (short i = 0; i < 9; ++i) |
114 m_vals[i] = vals[i]; |
134 m_vals[i] = vals[i]; |
115 } |
135 } |
116 |
136 |
121 |
141 |
122 matrix::matrix (initlist<double> vals) { |
142 matrix::matrix (initlist<double> vals) { |
123 assert (vals.size() == 9); |
143 assert (vals.size() == 9); |
124 memcpy (&m_vals[0], &(*vals.begin ()), sizeof m_vals); |
144 memcpy (&m_vals[0], &(*vals.begin ()), sizeof m_vals); |
125 } |
145 } |
126 |
|
127 // ============================================================================= |
|
128 void matrix::puts () const { |
146 void matrix::puts () const { |
129 for (short i = 0; i < 3; ++i) { |
147 for (short i = 0; i < 3; ++i) { |
130 for (short j = 0; j < 3; ++j) |
148 for (short j = 0; j < 3; ++j) |
131 printf ("%*f\t", 10, m_vals[(i * 3) + j]); |
149 printf ("%*f\t", 10, m_vals[(i * 3) + j]); |
132 |
150 |