This commit is contained in:
iutbgdin 2025-10-10 10:21:36 +02:00
parent 8383fc1edf
commit 6ad7555ad7
12 changed files with 81 additions and 24 deletions

View file

@ -1,17 +1,24 @@
#include "point.h"
#include <string>
Point::Point(std::string &txt) {
size_t pos = 0;
Point::Point(std::string& txt) {
if (txt != "") {
size_t pos = 0;
while ((pos = txt.find(",")) != std::string::npos) {
this->xyz.push_back(new float(std::stof(txt.substr(0, pos))));
txt.erase(0, pos + 1);
}
this->xyz.push_back(new float(std::stof(txt)));
while ((pos = txt.find(",")) != std::string::npos) {
this->xyz.push_back(new float(std::stof(txt.substr(0, pos))));
txt.erase(0, pos + 1);
}
std::cout << txt << std::endl;
this->xyz.push_back(new float(std::stof(txt)));
}
if (this->xyz.size() != 3) {
this->xyz = {new float(0), new float(0), new float(0)};
}
}
uint16_t Point::translate3D() { return 0; };
uint16_t Point::translate3D() { return 0; }
float Point::getX() { return (*this->xyz.at(0)); }
float Point::getY() { return (*this->xyz.at(1)); }