123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
- /*
- * number3d.cc
- * Copyright (C) 2016 Fran??ois Gautrais <francois@gautrais.eu>
- *
- * histodex is free software: you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * histodex is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
- #include "number3d.h"
- #include "utils.h"
- Number3d::Number3d(double x, double y, double z)
- {
- m_x=x;
- m_y=y;
- m_z=z;
- }
- Number3d::~Number3d()
- {
- }
- const Number3d& Number3d::operator=(const Number3d& a)
- {
- m_x=a.m_x;
- m_y=a.m_y;
- m_z=a.m_z;
- }
- Number3d::Number3d(Json::Value& v)
- {
- m_x = v[0].asDouble();
- m_y = v[1].asDouble();
- m_z = v[2].asDouble();
- }
- Json::Value Number3d::getJson()
- {
- Json::Value v(Json::arrayValue);
- v[0] = m_x;
- v[1] = m_y;
- v[2] = m_z;
- return v;
- }
- std::string Number3d::toString()
- {
- std::string x = "(";
- return x+tstr(m_x)+", "+tstr(m_y)+", "+tstr(m_z)+")";
- }
|