|
|
|
@ -18,8 +18,9 @@ |
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
//
|
|
|
|
use std::fmt::{Formatter, Display, Result};
|
|
|
|
use std::ops::{Add, Sub, Neg, Mul, Div};
|
|
|
|
use std::fmt;
|
|
|
|
|
|
|
|
use crate::trigonometry::Trig;
|
|
|
|
|
|
|
|
#[derive(Debug, Eq, Clone, Copy)]
|
|
|
|
@ -61,10 +62,11 @@ where T: Add<Output = T> + Sub<Output = T> + Neg<Output = T> |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<T> fmt::Display for Vector<T>
|
|
|
|
where T: Add + Sub + Neg + Mul + Div + Trig + fmt::Display + Copy {
|
|
|
|
fn fmt(&self, f :&mut fmt::Formatter<'_>) -> fmt::Result {
|
|
|
|
write!(f, "({}, {}, {})", self.0, self.1, self.2)
|
|
|
|
impl<T> Display for Vector<T>
|
|
|
|
where T: Add + Sub + Neg + Mul + Div + Trig + Display + Copy {
|
|
|
|
fn fmt(&self, f :&mut Formatter<'_>) -> Result {
|
|
|
|
let Vector(x, y, z) = self;
|
|
|
|
write!(f, "({}, {}, {})", x, y, z)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|