[Jderobot-admin] jderobot-r1018 - in trunk/src/stable/libs/geometry: . collada math
eperdices en jderobot.org
eperdices en jderobot.org
Mar Oct 8 14:48:10 CEST 2013
Author: eperdices
Date: 2013-10-08 14:47:10 +0200 (Tue, 08 Oct 2013)
New Revision: 1018
Removed:
trunk/src/stable/libs/geometry/math/vector2H.cpp
trunk/src/stable/libs/geometry/math/vector2H.h
trunk/src/stable/libs/geometry/math/vector2d.cpp
trunk/src/stable/libs/geometry/math/vector2d.h
trunk/src/stable/libs/geometry/math/vector3.cpp
trunk/src/stable/libs/geometry/math/vector3.h
trunk/src/stable/libs/geometry/math/vector3H.cpp
trunk/src/stable/libs/geometry/math/vector3H.h
Modified:
trunk/src/stable/libs/geometry/CMakeLists.txt
trunk/src/stable/libs/geometry/Dense.h
trunk/src/stable/libs/geometry/collada/colladaparser.cpp
trunk/src/stable/libs/geometry/collada/colladaparser.h
trunk/src/stable/libs/geometry/collada/color.cpp
trunk/src/stable/libs/geometry/collada/color.h
trunk/src/stable/libs/geometry/collada/malla.cpp
trunk/src/stable/libs/geometry/collada/malla.h
trunk/src/stable/libs/geometry/collada/material.cpp
trunk/src/stable/libs/geometry/collada/material.h
trunk/src/stable/libs/geometry/collada/submalla.cpp
trunk/src/stable/libs/geometry/collada/submalla.h
trunk/src/stable/libs/geometry/math/Point3D.cpp
trunk/src/stable/libs/geometry/math/Point3D.h
trunk/src/stable/libs/geometry/math/matriz3x3.h
trunk/src/stable/libs/geometry/math/matriz4x4.cpp
trunk/src/stable/libs/geometry/math/matriz4x4.h
trunk/src/stable/libs/geometry/math/plano.cpp
trunk/src/stable/libs/geometry/math/plano.h
trunk/src/stable/libs/geometry/math/segmento.cpp
trunk/src/stable/libs/geometry/math/segmento.h
Log:
Updated Collada, deleted old math::vectorX
Modified: trunk/src/stable/libs/geometry/CMakeLists.txt
===================================================================
--- trunk/src/stable/libs/geometry/CMakeLists.txt 2013-10-08 10:20:43 UTC (rev 1017)
+++ trunk/src/stable/libs/geometry/CMakeLists.txt 2013-10-08 12:47:10 UTC (rev 1018)
@@ -4,7 +4,7 @@
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} /usr/include/libxml2/)
-set(SRC_FILES math/matriz3x3.cpp math/matriz4x4.cpp math/plano.cpp math/utils.cpp math/vector2d.cpp math/vector3.cpp math/vector2H.cpp math/vector3H.cpp math/Line2D.cpp math/Segment2D.cpp math/Point2D.cpp math/Point3D.cpp math/Line3D.cpp math/Plane3D.cpp math/Segment3D.cpp collada/colladaparser.cpp collada/color.cpp collada/malla.cpp collada/material.cpp collada/submalla.cpp progeo/Progeo.cpp math/segmento.cpp math/recta.cpp)
+set(SRC_FILES math/matriz3x3.cpp math/matriz4x4.cpp math/plano.cpp math/utils.cpp math/Line2D.cpp math/Segment2D.cpp math/Point2D.cpp math/Point3D.cpp math/Line3D.cpp math/Plane3D.cpp math/Segment3D.cpp collada/colladaparser.cpp collada/color.cpp collada/malla.cpp collada/material.cpp collada/submalla.cpp progeo/Progeo.cpp math/segmento.cpp math/recta.cpp)
ADD_LIBRARY(geometry SHARED ${SRC_FILES})
Modified: trunk/src/stable/libs/geometry/Dense.h
===================================================================
--- trunk/src/stable/libs/geometry/Dense.h 2013-10-08 10:20:43 UTC (rev 1017)
+++ trunk/src/stable/libs/geometry/Dense.h 2013-10-08 12:47:10 UTC (rev 1018)
@@ -6,3 +6,6 @@
#include "math/Point3D.h"
#include "math/Segment2D.h"
#include "math/Segment3D.h"
+
+/*Collada*/
+#include "collada/colladaparser.h"
Modified: trunk/src/stable/libs/geometry/collada/colladaparser.cpp
===================================================================
--- trunk/src/stable/libs/geometry/collada/colladaparser.cpp 2013-10-08 10:20:43 UTC (rev 1017)
+++ trunk/src/stable/libs/geometry/collada/colladaparser.cpp 2013-10-08 12:47:10 UTC (rev 1018)
@@ -1,8 +1,8 @@
#include "colladaparser.h"
-namespace files_3D {
- ColladaParser::ColladaParser(std::string filename, bool to2D, double scalemap, double scale)
- {
+namespace Geometry {
+
+ ColladaParser::ColladaParser(std::string filename, bool to2D, double scalemap, double scale) {
TiXmlDocument xmlDoc;
this->filename = filename;
@@ -141,18 +141,18 @@
unsigned int indice =submalla->getIndex(k);
- math::Vector3 v= submalla->getVertex(indice);
+ Eigen::Vector3d v= submalla->getVertex(indice);
if(submalla->getNormalCount()>0){
- math::Vector3 normals= submalla->getNormal(indice);
- glNormal3f(normals.vector(0), normals.vector(1), normals.vector(2));
+ Eigen::Vector3d normals= submalla->getNormal(indice);
+ glNormal3f(normals(0), normals(1), normals(2));
}
if(submalla->getTexCoordCount()>0){
- math::Vector2d text= submalla->getTexCoord(indice);
- glTexCoord2f(text.vector(0), text.vector(1));
+ Eigen::Vector2d text= submalla->getTexCoord(indice);
+ glTexCoord2f(text(0), text(1));
}
- glVertex3f(v.vector(0), v.vector(1), v.vector(2));
+ glVertex3f(v(0), v(1), v(2));
if(k%3==2)
glEnd();
@@ -357,20 +357,22 @@
if (_elem->FirstChildElement("scale"))
{
std::string scaleStr = _elem->FirstChildElement("scale")->GetText();
- math::Vector3 scale;
- scale = boost::lexical_cast<math::Vector3>(scaleStr);
+ Point3D scale;
+ scale = boost::lexical_cast<Point3D>(scaleStr);
math::Matriz4x4 scaleMat;
- scaleMat.setScale(scale);
+ Eigen::Vector3d scalev(scale.getPoint()(0), scale.getPoint()(1), scale.getPoint()(2));
+ scaleMat.setScale(scalev);
transform = transform * scaleMat;
}
if (_elem->FirstChildElement("translate"))
{
std::string transStr = _elem->FirstChildElement("translate")->GetText();
- math::Vector3 translate;
- translate = boost::lexical_cast<math::Vector3>(transStr);
+ Point3D translate;
+ translate = boost::lexical_cast<Point3D>(transStr);
// translate *= this->meter;
- transform.setTranslate(translate);
+ Eigen::Vector3d translatev(translate.getPoint()(0), translate.getPoint()(1), translate.getPoint()(2));
+ transform.setTranslate(translatev);
}
TiXmlElement *rotateXml = _elem->FirstChildElement("rotate");
@@ -378,7 +380,7 @@
while (rotateXml)
{
math::Matriz3x3 mat;
- math::Vector3 axis;
+ Eigen::Vector3d axis;
double angle;
std::string rotateStr = rotateXml->GetText();
@@ -388,12 +390,12 @@
iss >> x >> y >> z;
- axis.setX(x);
- axis.setY(y);
- axis.setZ(z);
+ axis(0) = x;
+ axis(1) = y;
+ axis(2) = z;
iss >> angle;
- mat.setFromAxis(axis.getX(), axis.getY(), axis.getZ(), angle*3.1416/180);
+ mat.setFromAxis(axis(0), axis(1), axis(2), angle*3.1416/180);
transform = transform * mat;
rotateXml = rotateXml->NextSiblingElement("rotate");
@@ -409,8 +411,8 @@
/////////////////////////////////////////////////
void ColladaParser::loadVertices(const std::string &_id,
const math::Matriz4x4 &_transform,
- std::vector<math::Vector3> &_verts,
- std::vector<math::Vector3> &_norms)
+ std::vector<Eigen::Vector3d> &_verts,
+ std::vector<Eigen::Vector3d> &_norms)
{
TiXmlElement *verticesXml = this->getElementId(this->colladaXml,
"vertices", _id);
@@ -442,7 +444,7 @@
/////////////////////////////////////////////////
void ColladaParser::loadPositions(const std::string &_id,
const math::Matriz4x4 &_transform,
- std::vector<math::Vector3> &_values)
+ std::vector<Eigen::Vector3d> &_values)
{
TiXmlElement *sourceXml = this->getElementId("source", _id);
TiXmlElement *floatArrayXml = sourceXml->FirstChildElement("float_array");
@@ -460,7 +462,7 @@
end = strs.end();
for (iter = strs.begin(); iter != end; iter += 3)
{
- math::Vector3 vec(math::parseFloat(*iter), math::parseFloat(*(iter+1)),
+ Eigen::Vector3d vec(math::parseFloat(*iter), math::parseFloat(*(iter+1)),
math::parseFloat(*(iter+2)));
vec = _transform * vec;
_values.push_back(vec);
@@ -470,7 +472,7 @@
/////////////////////////////////////////////////
void ColladaParser::loadNormals(const std::string &_id,
const math::Matriz4x4 &_transform,
- std::vector<math::Vector3> &_values)
+ std::vector<Eigen::Vector3d> &_values)
{
TiXmlElement *normalsXml = this->getElementId("source", _id);
if (!normalsXml)
@@ -490,12 +492,12 @@
std::istringstream iss(valueStr);
do
{
- math::Vector3 vec;
+ Eigen::Vector3d vec;
float x, y, z;
iss >> x >> y >> z;
- vec.setX(x);
- vec.setY(y);
- vec.setZ(z);
+ vec(0) = x;
+ vec(1) = y;
+ vec(2) = z;
if (iss)
{
@@ -551,8 +553,8 @@
// std::string semantic = inputXml->Attribute("semantic");
std::string source = inputXml->Attribute("source");
- std::vector<math::Vector3> verts;
- std::vector<math::Vector3> norms;
+ std::vector<Eigen::Vector3d> verts;
+ std::vector<Eigen::Vector3d> norms;
this->loadVertices(source, _transform, verts, norms);
TiXmlElement *pXml = _xml->FirstChildElement("p");
@@ -608,9 +610,9 @@
TiXmlElement *polylistInputXml = _polylistXml->FirstChildElement("input");
- std::vector<math::Vector3> verts;
- std::vector<math::Vector3> norms;
- std::vector<math::Vector2d> texcoords;
+ std::vector<Eigen::Vector3d> verts;
+ std::vector<Eigen::Vector3d> norms;
+ std::vector<Eigen::Vector2d> texcoords;
math::Matriz4x4 bindShapeMat(math::Matriz4x4::IDENTITY);
//if (_mesh->HasSkeleton())
@@ -659,14 +661,14 @@
TiXmlElement *pXml = _polylistXml->FirstChildElement("p");
std::string pStr = pXml->GetText();
- std::vector<math::Vector3> vertNorms(verts.size());
+ std::vector<Eigen::Vector3d> vertNorms(verts.size());
std::vector<int> vertNormsCounts(verts.size());
std::fill(vertNormsCounts.begin(), vertNormsCounts.end(), 0);
int *values = new int[inputs.size()];
std::map<std::string, int>::iterator end = inputs.end();
std::map<std::string, int>::iterator iter;
- math::Vector2d vec;
+ Eigen::Vector2d vec;
std::vector<std::string> strs;
boost::split(strs, pStr, boost::is_any_of(" "));
@@ -736,8 +738,8 @@
}
else if (iter->first == "TEXCOORD")
{
- subMalla->addTexCoord(texcoords[values[iter->second]].getX(),
- texcoords[values[iter->second]].getY());
+ subMalla->addTexCoord(texcoords[values[iter->second]](0),
+ texcoords[values[iter->second]](1));
}
// else
// gzerr << "Unhandled semantic[" << iter->first << "]\n";
@@ -752,7 +754,7 @@
/////////////////////////////////////////////////
void ColladaParser::loadTexCoords(const std::string &_id,
- std::vector<math::Vector2d> &_values)
+ std::vector<Eigen::Vector2d> &_values)
{
int stride = 0;
int texCount = 0;
@@ -845,7 +847,7 @@
for (int i = 0; i < totCount; i += stride)
{
// We only handle 2D texture coordinates right now.
- _values.push_back(math::Vector2d(boost::lexical_cast<double>(values[i]),
+ _values.push_back(Eigen::Vector2d(boost::lexical_cast<double>(values[i]),
1.0 - boost::lexical_cast<double>(values[i+1])));
}
}
@@ -879,9 +881,9 @@
TiXmlElement *trianglesInputXml = _trianglesXml->FirstChildElement("input");
- std::vector<math::Vector3> verts;
- std::vector<math::Vector3> norms;
- std::vector<math::Vector2d> texcoords;
+ std::vector<Eigen::Vector3d> verts;
+ std::vector<Eigen::Vector3d> norms;
+ std::vector<Eigen::Vector2d> texcoords;
// A list of all the input values.
std::list<std::pair<std::string, int> > inputs;
@@ -919,14 +921,14 @@
}
std::string pStr = pXml->GetText();
- std::vector<math::Vector3> vertNorms(verts.size());
+ std::vector<Eigen::Vector3d> vertNorms(verts.size());
std::vector<int> vertNormsCounts(verts.size());
std::fill(vertNormsCounts.begin(), vertNormsCounts.end(), 0);
int *values = new int[inputs.size()];
std::list<std::pair<std::string, int> >::iterator end = inputs.end();
std::list<std::pair<std::string, int> >::iterator iter;
- math::Vector2d vec;
+ Eigen::Vector2d vec;
std::vector<std::string> strs;
boost::split(strs, pStr, boost::is_any_of(" "));
@@ -967,8 +969,8 @@
else if ((*iter).first == "TEXCOORD" && !already)
{
already = true;
- subMalla->addTexCoord(texcoords[values[(*iter).second]].getX(),
- texcoords[values[(*iter).second]].getY());
+ subMalla->addTexCoord(texcoords[values[(*iter).second]](0),
+ texcoords[values[(*iter).second]](1));
}
// else
// gzerr << "Unhandled semantic[" << (*iter).first << "]\n";
@@ -1347,8 +1349,9 @@
return mat;
}
- void ColladaParser::worldTo2D()
- {
+ void ColladaParser::worldTo2D() {
+ Point3D p3d1, p3d2;
+
std::vector<Segmento> listaSegmentos;
@@ -1360,7 +1363,7 @@
Plano plano2(0, 0, 1, 400.0);
Plano p_proyeccion(0, 0, 1, 0);
- math::Vector3 inter1;
+ Eigen::Vector3d inter1;
int triangulo = 0;
int indice_triangulo = 0;
@@ -1374,16 +1377,18 @@
triangulo = 0;
}
- math::Vector3 v1= submalla->getVertex(indice%3 + indice_triangulo*3);
- math::Vector3 v2= submalla->getVertex((indice+1)%3 + indice_triangulo*3);
+ Eigen::Vector3d v1= submalla->getVertex(indice%3 + indice_triangulo*3);
+ Eigen::Vector3d v2= submalla->getVertex((indice+1)%3 + indice_triangulo*3);
inter1 = plano1.InterConRecta(v1, v2);
- if(inter1.getX()!=0 && inter1.getY()!=0 && inter1.getZ()!=0 ){
- math::Vector3 proyeccion1 = p_proyeccion.proyeccionOrtogonal(v1, p_proyeccion.getCoefA(), p_proyeccion.getCoefB(), p_proyeccion.getCoefC());
- math::Vector3 proyeccion2 = p_proyeccion.proyeccionOrtogonal(v2, p_proyeccion.getCoefA(), p_proyeccion.getCoefB(), p_proyeccion.getCoefC());
+ if(inter1(0)!=0 && inter1(1)!=0 && inter1(2)!=0 ){
+ Eigen::Vector3d proyeccion1 = p_proyeccion.proyeccionOrtogonal(v1, p_proyeccion.getCoefA(), p_proyeccion.getCoefB(), p_proyeccion.getCoefC());
+ Eigen::Vector3d proyeccion2 = p_proyeccion.proyeccionOrtogonal(v2, p_proyeccion.getCoefA(), p_proyeccion.getCoefB(), p_proyeccion.getCoefC());
- double dist = proyeccion1.distance(proyeccion2);
+ p3d1.set(proyeccion1);
+ p3d2.set(proyeccion2);
+ double dist = p3d1.distanceTo(p3d2);
if(dist > 1){
listaSegmentos.push_back(Segmento(proyeccion1,proyeccion2));
@@ -1392,11 +1397,13 @@
inter1 = plano2.InterConRecta(v1, v2);
- if(inter1.getX()!=0 && inter1.getY()!=0 && inter1.getZ()!=0 ){
- math::Vector3 proyeccion1 = p_proyeccion.proyeccionOrtogonal(v1, p_proyeccion.getCoefA(), p_proyeccion.getCoefB(), p_proyeccion.getCoefC());
- math::Vector3 proyeccion2 = p_proyeccion.proyeccionOrtogonal(v2, p_proyeccion.getCoefA(), p_proyeccion.getCoefB(), p_proyeccion.getCoefC());
+ if(inter1(0)!=0 && inter1(1)!=0 && inter1(2)!=0 ){
+ Eigen::Vector3d proyeccion1 = p_proyeccion.proyeccionOrtogonal(v1, p_proyeccion.getCoefA(), p_proyeccion.getCoefB(), p_proyeccion.getCoefC());
+ Eigen::Vector3d proyeccion2 = p_proyeccion.proyeccionOrtogonal(v2, p_proyeccion.getCoefA(), p_proyeccion.getCoefB(), p_proyeccion.getCoefC());
- double dist = proyeccion1.distance(proyeccion2);
+ p3d1.set(proyeccion1);
+ p3d2.set(proyeccion2);
+ double dist = p3d1.distanceTo(p3d2);
if(dist > 1){
listaSegmentos.push_back(Segmento(proyeccion1,proyeccion2));
@@ -1406,12 +1413,12 @@
// int verticesDentroSandwich = 0;
// float distanciaEntrePlanos = plano2.distanciaAPunto(0, 0, 1);
-// std::vector<math::Vector3> vectorProyecciones;
+// std::vector<Eigen::Vector3d> vectorProyecciones;
// for(int k = 0; k < submalla->getVertexCount()-1; k++){
// unsigned int indice =submalla->getIndex(k);
-// math::Vector3 v1= submalla->getVertex(indice);
+// Eigen::Vector3d v1= submalla->getVertex(indice);
// float distanciaEntrePlanos1_1 = plano1.distanciaAPunto(v1);
@@ -1430,8 +1437,8 @@
// for(int k = 0; k < submalla->getVertexCount()-1; k++){
// unsigned int indice =submalla->getIndex(k);
-// math::Vector3 v1= submalla->getVertex(indice);
-// math::Vector3 v2= submalla->getVertex(indice);
+// Eigen::Vector3d v1= submalla->getVertex(indice);
+// Eigen::Vector3d v2= submalla->getVertex(indice);
// float dist = v1.distance(v2);
@@ -1443,10 +1450,10 @@
}
- math::Vector3 max = mesh->getMax();
- math::Vector3 min = mesh->getMin();
- image.create((max.getY() - min.getY()),
- (max.getX() - min.getY()),
+ Eigen::Vector3d max = mesh->getMax();
+ Eigen::Vector3d min = mesh->getMin();
+ image.create((max(1) - min(1)),
+ (max(0) - min(1)),
CV_8UC3);
image = cv::Scalar(255, 255, 255);
@@ -1456,8 +1463,8 @@
for(int i = 0; i < listaSegmentos.size(); i++){
cv::line(image,
- cv::Point2f((listaSegmentos[i].x1 - min.getX()), (listaSegmentos[i].y1 - min.getY())),
- cv::Point2f((listaSegmentos[i].x2 - min.getX()), (listaSegmentos[i].y2 - min.getY())),
+ cv::Point2f((listaSegmentos[i].x1 - min(0)), (listaSegmentos[i].y1 - min(1))),
+ cv::Point2f((listaSegmentos[i].x2 - min(0)), (listaSegmentos[i].y2 - min(1))),
cv::Scalar(0, 0, 0),
3);
fprintf(fp, "%.2f %.2f %.2f %.2f\n", listaSegmentos[i].x1, listaSegmentos[i].y1,
@@ -1469,8 +1476,7 @@
}
- cv::Mat ColladaParser::getWorld2D()
- {
+ cv::Mat ColladaParser::getWorld2D() {
return this->image.clone();
}
Modified: trunk/src/stable/libs/geometry/collada/colladaparser.h
===================================================================
--- trunk/src/stable/libs/geometry/collada/colladaparser.h 2013-10-08 10:20:43 UTC (rev 1017)
+++ trunk/src/stable/libs/geometry/collada/colladaparser.h 2013-10-08 12:47:10 UTC (rev 1018)
@@ -18,14 +18,16 @@
#include "../math/utils.h"
#include "../math/matriz4x4.h"
#include "../math/matriz3x3.h"
-#include "../math/vector3.h"
#include "../math/plano.h"
#include "../math/segmento.h"
+#include "../math/Point3D.h"
+#include <eigen3/Eigen/Dense>
#include <GL/glut.h>
#include <GL/gl.h>
-namespace files_3D {
+namespace Geometry {
+
class ColladaParser
{
public:
@@ -64,16 +66,16 @@
void loadVertices(const std::string &_id,
const math::Matriz4x4 &_transform,
- std::vector<math::Vector3> &_verts,
- std::vector<math::Vector3> &_norms);
+ std::vector<Eigen::Vector3d> &_verts,
+ std::vector<Eigen::Vector3d> &_norms);
void loadNormals(const std::string &_id,
const math::Matriz4x4 &_transform,
- std::vector<math::Vector3> &_values);
+ std::vector<Eigen::Vector3d> &_values);
void loadPositions(const std::string &_id,
const math::Matriz4x4 &_transform,
- std::vector<math::Vector3> &_values);
+ std::vector<Eigen::Vector3d> &_values);
void loadController(TiXmlElement *_contrXml,
TiXmlElement *_skelXml, const math::Matriz4x4 _transform, Malla *_mesh);
@@ -91,7 +93,7 @@
Malla *_mesh);
Material *loadMaterial(const std::string &_name);
void loadTexCoords(const std::string &_id,
- std::vector<math::Vector2d> &_values);
+ std::vector<Eigen::Vector2d> &_values);
// collada filename
private: std::string filename;
private: std::string path;
Modified: trunk/src/stable/libs/geometry/collada/color.cpp
===================================================================
--- trunk/src/stable/libs/geometry/collada/color.cpp 2013-10-08 10:20:43 UTC (rev 1017)
+++ trunk/src/stable/libs/geometry/collada/color.cpp 2013-10-08 12:47:10 UTC (rev 1018)
@@ -1,5 +1,6 @@
#include "color.h"
-namespace files_3D {
+namespace Geometry {
+
Color::Color()
{
}
Modified: trunk/src/stable/libs/geometry/collada/color.h
===================================================================
--- trunk/src/stable/libs/geometry/collada/color.h 2013-10-08 10:20:43 UTC (rev 1017)
+++ trunk/src/stable/libs/geometry/collada/color.h 2013-10-08 12:47:10 UTC (rev 1018)
@@ -2,7 +2,8 @@
#define COLOR_H
#include <iostream>
-namespace files_3D {
+namespace Geometry {
+
class Color
{
public:
Modified: trunk/src/stable/libs/geometry/collada/malla.cpp
===================================================================
--- trunk/src/stable/libs/geometry/collada/malla.cpp 2013-10-08 10:20:43 UTC (rev 1017)
+++ trunk/src/stable/libs/geometry/collada/malla.cpp 2013-10-08 12:47:10 UTC (rev 1018)
@@ -1,5 +1,6 @@
#include "malla.h"
-namespace files_3D {
+namespace Geometry {
+
Malla::Malla()
{
}
@@ -63,49 +64,49 @@
}
//////////////////////////////////////////////////
- math::Vector3 Malla::getMax() const
+ Eigen::Vector3d Malla::getMax() const
{
- math::Vector3 max;
+ Eigen::Vector3d max;
std::vector<SubMalla*>::const_iterator iter;
- max.setX( -std::numeric_limits<float>::max());
- max.setY( -std::numeric_limits<float>::max());
- max.setZ( -std::numeric_limits<float>::max());
+ max(0) = -std::numeric_limits<float>::max();
+ max(1) = -std::numeric_limits<float>::max();
+ max(2) = -std::numeric_limits<float>::max();
for (iter = this->submeshes.begin(); iter != this->submeshes.end(); ++iter)
{
if ((*iter)->getVertexCount() <= 2)
continue;
- math::Vector3 smax = (*iter)->getMax();
+ Eigen::Vector3d smax = (*iter)->getMax();
- max.setX(std::max(max.getX(), smax.getX()));
- max.setY(std::max(max.getY(), smax.getY()));
- max.setZ(std::max(max.getZ(), smax.getZ()));
+ max(0) =std::max(max(0), smax(0));
+ max(1) =std::max(max(1), smax(1));
+ max(2) =std::max(max(2), smax(2));
}
return max;
}
//////////////////////////////////////////////////
- math::Vector3 Malla::getMin() const
+ Eigen::Vector3d Malla::getMin() const
{
- math::Vector3 min;
+ Eigen::Vector3d min;
std::vector<SubMalla *>::const_iterator iter;
- min.setX( std::numeric_limits<float>::max());
- min.setY( std::numeric_limits<float>::max());
- min.setZ( std::numeric_limits<float>::max());
+ min(0) = std::numeric_limits<float>::max();
+ min(1) = std::numeric_limits<float>::max();
+ min(2) = std::numeric_limits<float>::max();
for (iter = this->submeshes.begin(); iter != this->submeshes.end(); ++iter)
{
if ((*iter)->getVertexCount() <= 2)
continue;
- math::Vector3 smin = (*iter)->getMin();
- min.setX(std::min(min.getX(), smin.getX()));
- min.setY(std::min(min.getY(), smin.getY()));
- min.setZ(std::min(min.getZ(), smin.getZ()));
+ Eigen::Vector3d smin = (*iter)->getMin();
+ min(0) = std::min(min(0), smin(0));
+ min(1) = std::min(min(1), smin(1));
+ min(2) = std::min(min(2), smin(2));
}
return min;
Modified: trunk/src/stable/libs/geometry/collada/malla.h
===================================================================
--- trunk/src/stable/libs/geometry/collada/malla.h 2013-10-08 10:20:43 UTC (rev 1017)
+++ trunk/src/stable/libs/geometry/collada/malla.h 2013-10-08 12:47:10 UTC (rev 1018)
@@ -6,7 +6,8 @@
#include "submalla.h"
#include "material.h"
-namespace files_3D {
+namespace Geometry {
+
class Malla
{
public:
@@ -21,8 +22,8 @@
void Scale(double _factor);
- math::Vector3 getMax() const;
- math::Vector3 getMin() const;
+ Eigen::Vector3d getMax() const;
+ Eigen::Vector3d getMin() const;
/// \brief The name of the mesh
Modified: trunk/src/stable/libs/geometry/collada/material.cpp
===================================================================
--- trunk/src/stable/libs/geometry/collada/material.cpp 2013-10-08 10:20:43 UTC (rev 1017)
+++ trunk/src/stable/libs/geometry/collada/material.cpp 2013-10-08 12:47:10 UTC (rev 1018)
@@ -1,6 +1,7 @@
#include "material.h"
-namespace files_3D {
+namespace Geometry {
+
unsigned int Material::counter = 0;
Material::Material()
Modified: trunk/src/stable/libs/geometry/collada/material.h
===================================================================
--- trunk/src/stable/libs/geometry/collada/material.h 2013-10-08 10:20:43 UTC (rev 1017)
+++ trunk/src/stable/libs/geometry/collada/material.h 2013-10-08 12:47:10 UTC (rev 1018)
@@ -7,10 +7,11 @@
#include <boost/filesystem.hpp>
#include <boost/lexical_cast.hpp>
-
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
-namespace files_3D {
+
+namespace Geometry {
+
class Material
{
public:
Modified: trunk/src/stable/libs/geometry/collada/submalla.cpp
===================================================================
--- trunk/src/stable/libs/geometry/collada/submalla.cpp 2013-10-08 10:20:43 UTC (rev 1017)
+++ trunk/src/stable/libs/geometry/collada/submalla.cpp 2013-10-08 12:47:10 UTC (rev 1018)
@@ -1,5 +1,6 @@
#include "submalla.h"
-namespace files_3D {
+namespace Geometry {
+
SubMalla::SubMalla()
{
materialIndex = -1;
@@ -18,12 +19,12 @@
//////////////////////////////////////////////////
void SubMalla::Scale(double _factor)
{
- for (std::vector<math::Vector3>::iterator iter = this->vertices.begin();
+ for (std::vector<Eigen::Vector3d>::iterator iter = this->vertices.begin();
iter != this->vertices.end(); ++iter)
{
- (*iter).vector(0) *= _factor;
- (*iter).vector(1) *= _factor;
- (*iter).vector(2) *= _factor;
+ (*iter)(0) *= _factor;
+ (*iter)(1) *= _factor;
+ (*iter)(2) *= _factor;
}
}
@@ -40,7 +41,7 @@
}
//////////////////////////////////////////////////
- void SubMalla::addVertex(const math::Vector3 &_v)
+ void SubMalla::addVertex(const Eigen::Vector3d &_v)
{
this->vertices.push_back(_v);
}
@@ -58,7 +59,7 @@
}
//////////////////////////////////////////////////
- math::Vector3 SubMalla::getVertex(unsigned int _i) const
+ Eigen::Vector3d SubMalla::getVertex(unsigned int _i) const
{
if (_i >= this->vertices.size())
std::cout << "Index too large\n";
@@ -67,7 +68,7 @@
}
//////////////////////////////////////////////////
- math::Vector3 SubMalla::getNormal(unsigned int _i) const
+ Eigen::Vector3d SubMalla::getNormal(unsigned int _i) const
{
if (_i >= this->normals.size())
std::cout <<"Index too large";
@@ -94,7 +95,7 @@
}
//////////////////////////////////////////////////
- void SubMalla::addNormal(const math::Vector3 &_n)
+ void SubMalla::addNormal(const Eigen::Vector3d &_n)
{
this->normals.push_back(_n);
}
@@ -102,7 +103,7 @@
//////////////////////////////////////////////////
void SubMalla::addTexCoord(double _u, double _v)
{
- this->texCoords.push_back(math::Vector2d(_u, _v));
+ this->texCoords.push_back(Eigen::Vector2d(_u, _v));
}
//////////////////////////////////////////////////
@@ -128,7 +129,7 @@
}
//////////////////////////////////////////////////
- math::Vector2d SubMalla::getTexCoord(unsigned int _i) const
+ Eigen::Vector2d SubMalla::getTexCoord(unsigned int _i) const
{
if (_i >= this->texCoords.size())
std::cout << "Index too large";
@@ -139,9 +140,9 @@
//////////////////////////////////////////////////
void SubMalla::center()
{
- math::Vector3 _center(0, 0, 0);
+ Eigen::Vector3d _center(0, 0, 0);
- math::Vector3 min, max, half;
+ Eigen::Vector3d min, max, half;
min = this->getMin();
max = this->getMax();
half = (max - min) * 0.5;
@@ -150,9 +151,9 @@
}
//////////////////////////////////////////////////
- void SubMalla::translate(const math::Vector3 &_vec)
+ void SubMalla::translate(const Eigen::Vector3d &_vec)
{
- for (std::vector<math::Vector3>::iterator iter = this->vertices.begin();
+ for (std::vector<Eigen::Vector3d>::iterator iter = this->vertices.begin();
iter != this->vertices.end(); ++iter)
{
(*iter) += _vec;
@@ -160,42 +161,42 @@
}
//////////////////////////////////////////////////
- math::Vector3 SubMalla::getMax() const
+ Eigen::Vector3d SubMalla::getMax() const
{
- math::Vector3 max;
- std::vector<math::Vector3>::const_iterator iter;
+ Eigen::Vector3d max;
+ std::vector<Eigen::Vector3d>::const_iterator iter;
- max.setX( -std::numeric_limits<float>::max());
- max.setY( -std::numeric_limits<float>::max());
- max.setZ( -std::numeric_limits<float>::max());
+ max(0) = -std::numeric_limits<float>::max();
+ max(1) = -std::numeric_limits<float>::max();
+ max(2) = -std::numeric_limits<float>::max();
for (iter = this->vertices.begin(); iter != this->vertices.end(); ++iter)
{
- math::Vector3 v = (*iter);
- max.setX(std::max(max.getX(), v.getX()));
- max.setY(std::max(max.getY(), v.getY()));
- max.setZ(std::max(max.getZ(), v.getZ()));
+ Eigen::Vector3d v = (*iter);
+ max(0) = std::max(max(0), v(0));
+ max(1) = std::max(max(1), v(1));
+ max(2) = std::max(max(2), v(2));
}
return max;
}
//////////////////////////////////////////////////
- math::Vector3 SubMalla::getMin() const
+ Eigen::Vector3d SubMalla::getMin() const
{
- math::Vector3 min;
- std::vector<math::Vector3>::const_iterator iter;
+ Eigen::Vector3d min;
+ std::vector<Eigen::Vector3d>::const_iterator iter;
- min.setX( std::numeric_limits<float>::max());
- min.setY( std::numeric_limits<float>::max());
- min.setZ( std::numeric_limits<float>::max());
+ min(0) = std::numeric_limits<float>::max();
+ min(1) = std::numeric_limits<float>::max();
+ min(2) = std::numeric_limits<float>::max();
for (iter = this->vertices.begin(); iter != this->vertices.end(); ++iter)
{
- math::Vector3 v = (*iter);
- min.setX(std::min(min.getX(), v.getX()));
- min.setY(std::min(min.getY(), v.getY()));
- min.setZ(std::min(min.getZ(), v.getZ()));
+ Eigen::Vector3d v = (*iter);
+ min(0) = std::min(min(0), v(0));
+ min(1) = std::min(min(1), v(1));
+ min(2) = std::min(min(2), v(2));
}
@@ -210,7 +211,7 @@
if (this->vertices.size() == 0 || this->indices.size() == 0)
std::cout << "No vertices or indices\n";
- std::vector< math::Vector3 >::const_iterator viter;
+ std::vector< Eigen::Vector3d >::const_iterator viter;
std::vector< unsigned int >::const_iterator iiter;
unsigned int i;
@@ -225,9 +226,9 @@
for (viter = this->vertices.begin(), i = 0; viter != this->vertices.end();
++viter){
- (*_vertArr)[i++] = static_cast<float>((*viter).vector(0));
- (*_vertArr)[i++] = static_cast<float>((*viter).vector(1));
- (*_vertArr)[i++] = static_cast<float>((*viter).vector(2));
+ (*_vertArr)[i++] = static_cast<float>((*viter)(0));
+ (*_vertArr)[i++] = static_cast<float>((*viter)(1));
+ (*_vertArr)[i++] = static_cast<float>((*viter)(2));
}
for (iiter = this->indices.begin(), i = 0;
Modified: trunk/src/stable/libs/geometry/collada/submalla.h
===================================================================
--- trunk/src/stable/libs/geometry/collada/submalla.h 2013-10-08 10:20:43 UTC (rev 1017)
+++ trunk/src/stable/libs/geometry/collada/submalla.h 2013-10-08 12:47:10 UTC (rev 1018)
@@ -1,11 +1,11 @@
#ifndef SUBMALLA_H
#define SUBMALLA_H
+#include <iostream>
#include <vector>
+#include <eigen3/Eigen/Dense>
-#include "../math/vector3.h"
-#include "../math/vector2d.h"
-namespace files_3D {
+namespace Geometry {
class SubMalla
{
@@ -28,20 +28,20 @@
int getPrimitiveType() const;
- void addVertex(const math::Vector3 &_v);
+ void addVertex(const Eigen::Vector3d &_v);
void addIndex(unsigned int _i);
unsigned int getVertexCount() const;
- void addNormal(const math::Vector3 &_n);
+ void addNormal(const Eigen::Vector3d &_n);
unsigned int getNormalCount() const;
void addTexCoord(double _u, double _v);
unsigned int getTexCoordCount() const;
- math::Vector3 getVertex(unsigned int _i) const;
- math::Vector3 getNormal(unsigned int _i) const;
- math::Vector2d getTexCoord(unsigned int _i) const;
+ Eigen::Vector3d getVertex(unsigned int _i) const;
+ Eigen::Vector3d getNormal(unsigned int _i) const;
+ Eigen::Vector2d getTexCoord(unsigned int _i) const;
unsigned int getIndex(unsigned int _i) const;
unsigned int getIndexCount() const;
@@ -52,23 +52,23 @@
void center();
- math::Vector3 getMax() const;
- math::Vector3 getMin() const;
+ Eigen::Vector3d getMax() const;
+ Eigen::Vector3d getMin() const;
- void translate(const math::Vector3 &_vec);
+ void translate(const Eigen::Vector3d &_vec);
void FillArrays(float **_vertArr, int **_indArr) ;
///////////////////////////////////////////////////////////////////////////////////////////////////////
/// \brief the vertex array
- private: std::vector< math::Vector3 > vertices;
+ private: std::vector< Eigen::Vector3d > vertices;
/// \brief the normal array
- private: std::vector< math::Vector3 > normals;
+ private: std::vector< Eigen::Vector3d > normals;
/// \brief the texture coordinate array
- private: std::vector< math::Vector2d > texCoords;
+ private: std::vector< Eigen::Vector2d > texCoords;
/// \brief the vertex index array
private: std::vector<unsigned int> indices;
Modified: trunk/src/stable/libs/geometry/math/Point3D.cpp
===================================================================
--- trunk/src/stable/libs/geometry/math/Point3D.cpp 2013-10-08 10:20:43 UTC (rev 1017)
+++ trunk/src/stable/libs/geometry/math/Point3D.cpp 2013-10-08 12:47:10 UTC (rev 1018)
@@ -101,3 +101,17 @@
return o;
}
+std::istream&
+operator >>(std::istream &in, Point3D &p) {
+ // Skip white spaces
+ in.setf(std::ios_base::skipws);
+
+ double x, y, z;
+
+ in >> x >> y >> z;
+ p.point(0) = x;
+ p.point(1) = y;
+ p.point(2) = z;
+ return in;
+}
+
Modified: trunk/src/stable/libs/geometry/math/Point3D.h
===================================================================
--- trunk/src/stable/libs/geometry/math/Point3D.h 2013-10-08 10:20:43 UTC (rev 1017)
+++ trunk/src/stable/libs/geometry/math/Point3D.h 2013-10-08 12:47:10 UTC (rev 1018)
@@ -64,6 +64,7 @@
/*Operators*/
Point3D& operator =(const Point3D &pt);
friend std::ostream& operator <<(std::ostream &o,const Point3D &p);
+ friend std::istream &operator >>(std::istream &in, Point3D &p);
private:
Modified: trunk/src/stable/libs/geometry/math/matriz3x3.h
===================================================================
--- trunk/src/stable/libs/geometry/math/matriz3x3.h 2013-10-08 10:20:43 UTC (rev 1017)
+++ trunk/src/stable/libs/geometry/math/matriz3x3.h 2013-10-08 12:47:10 UTC (rev 1018)
@@ -5,8 +5,6 @@
#include <eigen3/Eigen/Dense>
-#include "vector3.h"
-
namespace math
{
class Matriz3x3
Modified: trunk/src/stable/libs/geometry/math/matriz4x4.cpp
===================================================================
--- trunk/src/stable/libs/geometry/math/matriz4x4.cpp 2013-10-08 10:20:43 UTC (rev 1017)
+++ trunk/src/stable/libs/geometry/math/matriz4x4.cpp 2013-10-08 12:47:10 UTC (rev 1018)
@@ -39,21 +39,21 @@
}
//////////////////////////////////////////////////
- void Matriz4x4::setScale( Vector3 &_s)
+ void Matriz4x4::setScale( Eigen::Vector3d &_s)
{
- matriz(0, 0) = _s.getX();
- matriz(1, 1) = _s.getY();
- matriz(2, 2) = _s.getZ();
+ matriz(0, 0) = _s(0);
+ matriz(1, 1) = _s(1);
+ matriz(2, 2) = _s(2);
matriz(3, 3) = 1.0;
}
//////////////////////////////////////////////////
- void Matriz4x4::setTranslate( Vector3 &_t)
+ void Matriz4x4::setTranslate( Eigen::Vector3d &_t)
{
- matriz(0, 3) = _t.getX();
- matriz(1, 3) = _t.getY();
- matriz(2, 3) = _t.getZ();
+ matriz(0, 3) = _t(0);
+ matriz(1, 3) = _t(1);
+ matriz(2, 3) = _t(2);
}
Matriz4x4 Matriz4x4::operator*(Matriz3x3 _mat) const
@@ -104,17 +104,17 @@
return result;
}
- Vector3 Matriz4x4::operator*(Vector3 &_vec) const
+ Eigen::Vector3d Matriz4x4::operator*(Eigen::Vector3d &_vec) const
{
- Vector3 result;
- result.setX( matriz(0, 0)*_vec.getX() + matriz(0, 1)*_vec.getY() +
- matriz(0, 2)*_vec.getZ() + matriz(0, 3));
+ Eigen::Vector3d result;
+ result(0) = matriz(0, 0)*_vec(0) + matriz(0, 1)*_vec(1) +
+ matriz(0, 2)*_vec(2) + matriz(0, 3);
- result.setY( matriz(1, 0)*_vec.getX() + matriz(1, 1)*_vec.getY() +
- matriz(1, 2)*_vec.getZ() + matriz(1, 3));
+ result(1) = matriz(1, 0)*_vec(0) + matriz(1, 1)*_vec(1) +
+ matriz(1, 2)*_vec(2) + matriz(1, 3);
- result.setZ( matriz(2, 0)*_vec.getX() + matriz(2, 1)*_vec.getY() +
- matriz(2, 2)*_vec.getZ() + matriz(2, 3));
+ result(2) = matriz(2, 0)*_vec(0) + matriz(2, 1)*_vec(1) +
+ matriz(2, 2)*_vec(2) + matriz(2, 3);
return result;
}
}
Modified: trunk/src/stable/libs/geometry/math/matriz4x4.h
===================================================================
--- trunk/src/stable/libs/geometry/math/matriz4x4.h 2013-10-08 10:20:43 UTC (rev 1017)
+++ trunk/src/stable/libs/geometry/math/matriz4x4.h 2013-10-08 12:47:10 UTC (rev 1018)
@@ -4,8 +4,6 @@
#define EIGEN_DONT_ALIGN_STATICALLY True
#include <eigen3/Eigen/Dense>
-
-#include "vector3.h"
#include "matriz3x3.h"
namespace math
@@ -23,8 +21,8 @@
Eigen::Matrix4f getCopyMatrix();
void setMatrix(Eigen::Matrix4f m);
- void setTranslate(Vector3 &_t);
- void setScale(Vector3 &_s);
+ void setTranslate(Eigen::Vector3d &_t);
+ void setScale(Eigen::Vector3d &_s);
void set(double _v00, double _v01, double _v02, double _v03,
double _v10, double _v11, double _v12, double _v13,
@@ -33,7 +31,7 @@
public: Matriz4x4 operator*(Matriz3x3 _mat) const;
public: Matriz4x4 operator*( Matriz4x4 &_mat) const;
- public: Vector3 operator*(Vector3 &_vec) const;
+ public: Eigen::Vector3d operator*(Eigen::Vector3d &_vec) const;
//private:
Eigen::Matrix4f matriz;
};
Modified: trunk/src/stable/libs/geometry/math/plano.cpp
===================================================================
--- trunk/src/stable/libs/geometry/math/plano.cpp 2013-10-08 10:20:43 UTC (rev 1017)
+++ trunk/src/stable/libs/geometry/math/plano.cpp 2013-10-08 12:47:10 UTC (rev 1018)
@@ -9,15 +9,15 @@
}
//http://paulbourke.net/geometry/pointlineplane/
-Plano::Plano(math::Vector3 p1, math::Vector3 p2, math::Vector3 p3)
+Plano::Plano(Eigen::Vector3d p1, Eigen::Vector3d p2, Eigen::Vector3d p3)
{
- this->A = p1.getY()*(p2.getZ() - p3.getZ()) + p2.getY()*(p3.getZ() - p1.getZ()) + p3.getY()*(p1.getZ() - p2.getZ());
+ this->A = p1(1)*(p2(2) - p3(2)) + p2(1)*(p3(2) - p1(2)) + p3(1)*(p1(2) - p2(2));
- this->B = p1.getZ()*(p2.getX() - p3.getX()) + p2.getZ()*(p3.getX() - p1.getX()) + p3.getZ()*(p1.getX() - p2.getX());
+ this->B = p1(2)*(p2(0) - p3(0)) + p2(2)*(p3(0) - p1(0)) + p3(2)*(p1(0) - p2(0));
- this->C = p1.getX()*(p2.getY() - p3.getY()) + p2.getX()*(p3.getY() - p1.getY()) + p3.getX()*(p1.getY() - p2.getY());
+ this->C = p1(0)*(p2(1) - p3(1)) + p2(0)*(p3(1) - p1(1)) + p3(0)*(p1(1) - p2(1));
- this->D = -(p1.getX()*(p2.getY()*p3.getZ() - p3.getY()*p2.getZ()) + p2.getX()*(p3.getY()*p1.getZ() - p1.getY()*p3.getZ()) + p3.getX()*(p1.getY()*p2.getZ() - p2.getY()*p1.getZ()));
+ this->D = -(p1(0)*(p2(1)*p3(2) - p3(1)*p2(2)) + p2(0)*(p3(1)*p1(2) - p1(1)*p3(2)) + p3(0)*(p1(1)*p2(2) - p2(1)*p1(2)));
}
@@ -72,9 +72,9 @@
return 10000000;
}
-float Plano::distanciaAPunto(math::Vector3 p)
+float Plano::distanciaAPunto(Eigen::Vector3d p)
{
- float numerador = A*p.getX() + B*p.getY() + C*p.getZ() + D;
+ float numerador = A*p(0) + B*p(1) + C*p(2) + D;
float denominador = sqrt( pow(A, 2) + pow(B, 2) + pow(C, 2));
if(denominador!=0)
@@ -88,31 +88,31 @@
return -1;
}
-math::Vector3 Plano::InterConRecta(math::Vector3 p, math::Vector3 q)
+Eigen::Vector3d Plano::InterConRecta(Eigen::Vector3d p, Eigen::Vector3d q)
{
- math::Vector3 result(0,0,0);
+ Eigen::Vector3d result(0,0,0);
- float u = calculateU(A, B, C, D, p.getX(), p.getY(), p.getZ(), q.getX(), q.getY(), q.getZ()) ;
+ float u = calculateU(A, B, C, D, p(0), p(1), p(2), q(0), q(1), q(2)) ;
//std::cout << "U: " << u << std::endl;
if( u <= 1 && u >= 0){
- result.setX(p.getX() + u*(q.getX()-p.getX()));
- result.setY(p.getY() + u*(q.getY()-p.getY()));
- result.setZ(p.getZ() + u*(q.getZ()-p.getZ()));
+ result(0) = p(0) + u*(q(0)-p(0));
+ result(1) = p(1) + u*(q(1)-p(1));
+ result(2) = p(2) + u*(q(2)-p(2));
//std::cout << "X: " << X << " Y: " << Y << " Z: " << Z << std::endl;
}
return result;
}
-math::Vector3 Plano::InterConRecta(float px, float py, float pz, float qx, float qy, float qz)
+Eigen::Vector3d Plano::InterConRecta(float px, float py, float pz, float qx, float qy, float qz)
{
- math::Vector3 result(0,0,0);
+ Eigen::Vector3d result(0,0,0);
float u = calculateU(A, B, C, D, px, py, pz, qx, qy, qz) ;
//std::cout << "U: " << u << std::endl;
if( u <= 1 && u >= 0){
- result.setX(px + u*(qx-px));
- result.setY(py + u*(qy-py));
- result.setZ(pz + u*(qz-pz));
+ result(0) = px + u*(qx-px);
+ result(1) = py + u*(qy-py);
+ result(2) = pz + u*(qz-pz);
//std::cout << "X: " << X << " Y: " << Y << " Z: " << Z << std::endl;
}
return result;
@@ -126,17 +126,17 @@
// A* (px + vx*t) + B(py + vy*t) +C(pz+vz*t) + D = 0;
// (-A*px - D - B*py - C*pz) = (A *vx *t + B *vy *t + C *vz *t)
// t = (-A*px - D - B*py - C*pz)/ (A*vx + B*vy + C* vz)
-math::Vector3 Plano::proyeccionOrtogonal(float px, float py, float pz, float vx, float vy, float vz)
+Eigen::Vector3d Plano::proyeccionOrtogonal(float px, float py, float pz, float vx, float vy, float vz)
{
float t = (-A*px - B*py - C*pz - D )/(A*vx + B*vy + C*vz );
- math::Vector3 result(px+vx*t, py+vy*t, pz+vz*t);
+ Eigen::Vector3d result(px+vx*t, py+vy*t, pz+vz*t);
return result;
}
-math::Vector3 Plano::proyeccionOrtogonal(math::Vector3 p, float vx, float vy, float vz)
+Eigen::Vector3d Plano::proyeccionOrtogonal(Eigen::Vector3d p, float vx, float vy, float vz)
{
- float t = (-A*p.getX() - B*p.getY() - C*p.getZ() - D )/(A*vx + B*vy + C*vz );
- math::Vector3 result(p.getX()+vx*t, p.getY()+vy*t, p.getZ()+vz*t);
+ float t = (-A*p(0) - B*p(1) - C*p(2) - D )/(A*vx + B*vy + C*vz );
+ Eigen::Vector3d result(p(0)+vx*t, p(1)+vy*t, p(2)+vz*t);
return result;
}
Modified: trunk/src/stable/libs/geometry/math/plano.h
===================================================================
--- trunk/src/stable/libs/geometry/math/plano.h 2013-10-08 10:20:43 UTC (rev 1017)
+++ trunk/src/stable/libs/geometry/math/plano.h 2013-10-08 12:47:10 UTC (rev 1018)
@@ -2,14 +2,13 @@
#define PLANO_H
#include <math.h>
+#include <eigen3/Eigen/Dense>
-#include "vector3.h"
-
class Plano
{
public:
Plano(float A, float B, float C, float D);
- Plano(math::Vector3 p1, math::Vector3 p2, math::Vector3 p3);
+ Plano(Eigen::Vector3d p1, Eigen::Vector3d p2, Eigen::Vector3d p3);
float getCoefA();
float getCoefB();
@@ -21,14 +20,14 @@
void setCoefC(float f);
void setCoefD(float f);
- math::Vector3 InterConRecta(math::Vector3 p, math::Vector3 q);
- math::Vector3 InterConRecta(float px, float py, float pz, float qx, float qy, float qz);
+ Eigen::Vector3d InterConRecta(Eigen::Vector3d p, Eigen::Vector3d q);
+ Eigen::Vector3d InterConRecta(float px, float py, float pz, float qx, float qy, float qz);
float calculateU(float A, float B, float C, float D, float px, float py, float pz, float qx, float qy, float qz);
float distanciaAPunto(float x, float y, float z);
- float distanciaAPunto(math::Vector3 p);
+ float distanciaAPunto(Eigen::Vector3d p);
- math::Vector3 proyeccionOrtogonal(float px, float py, float pz, float vx, float vy, float vz);
- math::Vector3 proyeccionOrtogonal(math::Vector3 p, float vx, float vy, float vz);
+ Eigen::Vector3d proyeccionOrtogonal(float px, float py, float pz, float vx, float vy, float vz);
+ Eigen::Vector3d proyeccionOrtogonal(Eigen::Vector3d p, float vx, float vy, float vz);
private:
float A;
Modified: trunk/src/stable/libs/geometry/math/segmento.cpp
===================================================================
--- trunk/src/stable/libs/geometry/math/segmento.cpp 2013-10-08 10:20:43 UTC (rev 1017)
+++ trunk/src/stable/libs/geometry/math/segmento.cpp 2013-10-08 12:47:10 UTC (rev 1018)
@@ -14,14 +14,14 @@
this->z2 = z2;
}
-Segmento::Segmento(math::Vector3 p, math::Vector3 q)
+Segmento::Segmento(Eigen::Vector3d p, Eigen::Vector3d q)
{
- this->x1 = p.getX();
- this->y1 = p.getY();
- this->z1 = p.getZ();
- this->x2 = q.getX();
- this->y2 = q.getY();
- this->z2 = q.getZ();
+ this->x1 = p(0);
+ this->y1 = p(1);
+ this->z1 = p(2);
+ this->x2 = q(0);
+ this->y2 = q(1);
+ this->z2 = q(2);
}
Modified: trunk/src/stable/libs/geometry/math/segmento.h
===================================================================
--- trunk/src/stable/libs/geometry/math/segmento.h 2013-10-08 10:20:43 UTC (rev 1017)
+++ trunk/src/stable/libs/geometry/math/segmento.h 2013-10-08 12:47:10 UTC (rev 1018)
@@ -4,7 +4,7 @@
#include <math.h>
#include "recta.h"
-#include "vector3.h"
+#include <eigen3/Eigen/Dense>
#define infinito 9.9e9
@@ -12,7 +12,7 @@
public:
Segmento();
Segmento(float x1, float y1, float z1, float x2, float y2, float z2);
- Segmento(math::Vector3 p, math::Vector3 q);
+ Segmento(Eigen::Vector3d p, Eigen::Vector3d q);
~Segmento();
Recta SegmentoARecta();
Deleted: trunk/src/stable/libs/geometry/math/vector2H.cpp
===================================================================
--- trunk/src/stable/libs/geometry/math/vector2H.cpp 2013-10-08 10:20:43 UTC (rev 1017)
+++ trunk/src/stable/libs/geometry/math/vector2H.cpp 2013-10-08 12:47:10 UTC (rev 1018)
@@ -1,171 +0,0 @@
-#include "vector2H.h"
-namespace math
-{
- Vector2H::Vector2H()
- {
- vector << 0, 0, 0;
-
- }
-
- Vector2H::Vector2H(float _x, float _y, float _h)
- {
- vector << _x, _y, _h;
-
- }
-
- float Vector2H::getX()
- {
- return vector(0);
- }
-
- float Vector2H::getY()
- {
- return vector(1);
- }
-
- float Vector2H::getH()
- {
- return vector(2);
- }
-
- float Vector2H::getX() const
- {
- return vector(0);
- }
-
- float Vector2H::getY() const
- {
- return vector(1);
- }
-
- void Vector2H::setX(float _x)
- {
- vector(0) = _x;
- }
-
- void Vector2H::setY(float _y )
- {
- vector(1) = _y;
-
- }
-
- void Vector2H::setH(float _h )
- {
- vector(2) = _h;
-
- }
-
- //////////////////////////////////////////////////
- Vector2H Vector2H::operator-(const Vector2H &pt) const
- {
- return Vector2H(vector(0) - pt.vector(0), vector(1) - pt.vector(1));
- }
-
- const Vector2H &Vector2H::operator-=(const Vector2H &pt)
- {
- vector(0) -= pt.vector(0);
- vector(1) -= pt.vector(1);
-
- return *this;
- }
-
- //////////////////////////////////////////////////
-
- const Vector2H Vector2H::operator/(const Vector2H &pt) const
- {
- return Vector2H(vector(0) / pt.vector(0), vector(1) / pt.vector(1));
- }
-
- const Vector2H &Vector2H::operator/=(const Vector2H &pt)
- {
- vector(0) /= pt.vector(0);
- vector(1) /= pt.vector(1);
-
- return *this;
- }
-
- const Vector2H Vector2H::operator/(double v) const
- {
- return Vector2H(vector(0) / v, vector(1) / v);
- }
-
- const Vector2H &Vector2H::operator/=(double v)
- {
- vector(0) /= v;
- vector(1) /= v;
-
- return *this;
- }
-
- double Vector2H::mag_squared() const
- {
- return (vector(0)*vector(0))*(vector(1)*vector(1));
- }
-
- double Vector2H::mag_squared()
- {
- return (vector(0)*vector(0))*(vector(1)*vector(1));
- }
-
-
- //////////////////////////////////////////////////
- const Vector2H Vector2H::operator*(const Vector2H &pt) const
- {
- return Vector2H(vector(0) * pt.vector(0), vector(1) * pt.vector(1));
- }
-
- const Vector2H &Vector2H::operator*=(const Vector2H &pt)
- {
- vector(0) *= pt.vector(0);
- vector(1) *= pt.vector(1);
-
- return *this;
- }
-
- const Vector2H Vector2H::operator*(double v) const
- {
- return Vector2H(vector(0) * v, vector(1) * v);
- }
-
- const Vector2H &Vector2H::operator*=(double v)
- {
- vector(0) *= v;
- vector(1) *= v;
-
- return *this;
- }
-
- //////////////////////////////////////////////////
- Vector2H &Vector2H::operator =(const Vector2H &pt)
- {
- vector(0) = pt.vector(0);
- vector(1) = pt.vector(1);
-
- return *this;
- }
-
- //////////////////////////////////////////////////
- const Vector2H &Vector2H::operator =(double value)
- {
- vector(0) = value;
- vector(1) = value;
-
- return *this;
- }
-
- //////////////////////////////////////////////////
- Vector2H Vector2H::operator+(const Vector2H &pt) const
- {
- return Vector2H(vector(0) + pt.vector(0), vector(1) + pt.vector(1));
- }
-
- const Vector2H &Vector2H::operator+=(const Vector2H &pt)
- {
- vector(0) += pt.vector(0);
- vector(1) += pt.vector(1);
-
- return *this;
- }
-
-
-}
Deleted: trunk/src/stable/libs/geometry/math/vector2H.h
===================================================================
--- trunk/src/stable/libs/geometry/math/vector2H.h 2013-10-08 10:20:43 UTC (rev 1017)
+++ trunk/src/stable/libs/geometry/math/vector2H.h 2013-10-08 12:47:10 UTC (rev 1018)
@@ -1,57 +0,0 @@
-#ifndef VECTOR2D_H
-#define VECTOR2D_H
-
-#define EIGEN_DONT_ALIGN_STATICALLY True
-
-#include <eigen3/Eigen/Dense>
-
-namespace math
-{
- class Vector2H
- {
- public:
- Vector2H();
- Vector2H(float _x, float _y, float _h=1.0);
-
- public: float getX();
- public: float getY();
- public: float getH();
-
- public: float getX() const;
- public: float getY() const;
-
- public: void setX(float _x);
- public: void setY(float _y);
- public: void setH(float _h);
-
- public: double mag_squared() const;
- public: double mag_squared() ;
-
-
- //OPERATORS
- public: Vector2H operator-(const Vector2H &pt) const;
- public: const Vector2H &operator-=(const Vector2H &pt);
-
- public: const Vector2H &operator/=(double v);
- public: const Vector2H operator/(double v) const;
- public: const Vector2H &operator/=(const Vector2H &pt);
- public: const Vector2H operator/(const Vector2H &pt) const;
-
- const Vector2H operator*(const Vector2H &pt) const;
- const Vector2H &operator*=(const Vector2H &pt);
- const Vector2H operator*(double v) const;
- const Vector2H &operator*=(double v);
-
-
- const Vector2H &operator =(double value);
- Vector2H &operator =(const Vector2H &pt);
-
- const Vector2H &operator+=(const Vector2H &pt);
- Vector2H operator+(const Vector2H &pt) const;
-
-
- public: Eigen::Vector3f vector;
- };
-}
-
-#endif // VECTOR2D_H
Deleted: trunk/src/stable/libs/geometry/math/vector2d.cpp
===================================================================
--- trunk/src/stable/libs/geometry/math/vector2d.cpp 2013-10-08 10:20:43 UTC (rev 1017)
+++ trunk/src/stable/libs/geometry/math/vector2d.cpp 2013-10-08 12:47:10 UTC (rev 1018)
@@ -1,160 +0,0 @@
-#include "vector2d.h"
-namespace math
-{
- Vector2d::Vector2d()
- {
- vector << 0, 0;
-
- }
-
- Vector2d::Vector2d(float _x, float _y)
- {
- vector << _x, _y;
-
- }
-
- float Vector2d::getX()
- {
- return vector(0);
- }
-
- float Vector2d::getY()
- {
- return vector(1);
- }
-
- float Vector2d::getX() const
- {
- return vector(0);
- }
-
- float Vector2d::getY() const
- {
- return vector(1);
- }
-
- void Vector2d::setX(float _x)
- {
- vector(0) = _x;
- }
-
- void Vector2d::setY(float _y )
- {
- vector(1) = _y;
-
- }
-
- //////////////////////////////////////////////////
- Vector2d Vector2d::operator-(const Vector2d &pt) const
- {
- return Vector2d(vector(0) - pt.vector(0), vector(1) - pt.vector(1));
- }
-
- const Vector2d &Vector2d::operator-=(const Vector2d &pt)
- {
- vector(0) -= pt.vector(0);
- vector(1) -= pt.vector(1);
-
- return *this;
- }
-
- //////////////////////////////////////////////////
-
- const Vector2d Vector2d::operator/(const Vector2d &pt) const
- {
- return Vector2d(vector(0) / pt.vector(0), vector(1) / pt.vector(1));
- }
-
- const Vector2d &Vector2d::operator/=(const Vector2d &pt)
- {
- vector(0) /= pt.vector(0);
- vector(1) /= pt.vector(1);
-
- return *this;
- }
-
- const Vector2d Vector2d::operator/(double v) const
- {
- return Vector2d(vector(0) / v, vector(1) / v);
- }
-
- const Vector2d &Vector2d::operator/=(double v)
- {
- vector(0) /= v;
- vector(1) /= v;
-
- return *this;
- }
-
- double Vector2d::mag_squared() const
- {
- return (vector(0)*vector(0))*(vector(1)*vector(1));
- }
-
- double Vector2d::mag_squared()
- {
- return (vector(0)*vector(0))*(vector(1)*vector(1));
- }
-
-
- //////////////////////////////////////////////////
- const Vector2d Vector2d::operator*(const Vector2d &pt) const
- {
- return Vector2d(vector(0) * pt.vector(0), vector(1) * pt.vector(1));
- }
-
- const Vector2d &Vector2d::operator*=(const Vector2d &pt)
- {
- vector(0) *= pt.vector(0);
- vector(1) *= pt.vector(1);
-
- return *this;
- }
-
- const Vector2d Vector2d::operator*(double v) const
- {
- return Vector2d(vector(0) * v, vector(1) * v);
- }
-
- const Vector2d &Vector2d::operator*=(double v)
- {
- vector(0) *= v;
- vector(1) *= v;
-
- return *this;
- }
-
- //////////////////////////////////////////////////
- Vector2d &Vector2d::operator =(const Vector2d &pt)
- {
- vector(0) = pt.vector(0);
- vector(1) = pt.vector(1);
-
- return *this;
- }
-
- //////////////////////////////////////////////////
- const Vector2d &Vector2d::operator =(double value)
- {
- vector(0) = value;
- vector(1) = value;
-
- return *this;
- }
-
- //////////////////////////////////////////////////
- Vector2d Vector2d::operator+(const Vector2d &pt) const
- {
- return Vector2d(vector(0) + pt.vector(0), vector(1) + pt.vector(1));
- }
-
- const Vector2d &Vector2d::operator+=(const Vector2d &pt)
- {
- vector(0) += pt.vector(0);
- vector(1) += pt.vector(1);
-
- return *this;
- }
-
-
-}
Deleted: trunk/src/stable/libs/geometry/math/vector2d.h
===================================================================
--- trunk/src/stable/libs/geometry/math/vector2d.h 2013-10-08 10:20:43 UTC (rev 1017)
+++ trunk/src/stable/libs/geometry/math/vector2d.h 2013-10-08 12:47:10 UTC (rev 1018)
@@ -1,55 +0,0 @@
-#ifndef VECTOR2D_H
-#define VECTOR2D_H
-
-#define EIGEN_DONT_ALIGN_STATICALLY True
-
-#include <eigen3/Eigen/Dense>
-
-namespace math
-{
- class Vector2d
- {
- public:
- Vector2d();
- Vector2d(float _x, float _y);
-
- public: float getX();
- public: float getY();
-
- public: float getX() const;
- public: float getY() const;
-
- public: void setX(float _x);
- public: void setY(float _y);
-
- public: double mag_squared() const;
- public: double mag_squared() ;
-
-
- //OPERATORS
- public: Vector2d operator-(const Vector2d &pt) const;
- public: const Vector2d &operator-=(const Vector2d &pt);
-
- public: const Vector2d &operator/=(double v);
- public: const Vector2d operator/(double v) const;
- public: const Vector2d &operator/=(const Vector2d &pt);
- public: const Vector2d operator/(const Vector2d &pt) const;
-
- const Vector2d operator*(const Vector2d &pt) const;
- const Vector2d &operator*=(const Vector2d &pt);
- const Vector2d operator*(double v) const;
- const Vector2d &operator*=(double v);
-
-
- const Vector2d &operator =(double value);
- Vector2d &operator =(const Vector2d &pt);
-
- const Vector2d &operator+=(const Vector2d &pt);
- Vector2d operator+(const Vector2d &pt) const;
-
-
- public: Eigen::Vector2f vector;
- };
-}
-
-#endif // VECTOR2D_H
Deleted: trunk/src/stable/libs/geometry/math/vector3.cpp
===================================================================
--- trunk/src/stable/libs/geometry/math/vector3.cpp 2013-10-08 10:20:43 UTC (rev 1017)
+++ trunk/src/stable/libs/geometry/math/vector3.cpp 2013-10-08 12:47:10 UTC (rev 1018)
@@ -1,92 +0,0 @@
-#include "vector3.h"
-namespace math
-{
- Vector3::Vector3()
- {
- vector<< 0.0, 0.0, 0.0;
- }
- Vector3::Vector3(const double &_x, const double &_y, const double &_z)
- {
- vector<< _x, _y, _z;
-
- }
-
- float Vector3::getX()
- {
- return vector(0);
- }
-
- float Vector3::getY()
- {
- return vector(1);
- }
- float Vector3::getZ()
- {
- return vector(2);
- }
-
- void Vector3::setX(float f)
- {
- vector(0) = f;
- }
-
- void Vector3::setY(float f)
- {
- vector(1) = f;
- }
-
- void Vector3::setZ(float f)
- {
- vector(2) = f;
- }
-
- //////////////////////////////////////////////////
- Vector3 Vector3::normalize()
- {
- double d = sqrt(this->getX() * this->getX() + this->getY() * this->getY() + this->getZ() * this->getZ());
-
- if (!math::equal(d, 0.0))
- {
- this->setX(this->getX()/ d);
- this->setY(this->getY()/ d);
- this->setZ(this->getZ()/ d);
- }
-
- return *this;
- }
-
- //////////////////////////////////////////////////
- Vector3 Vector3::operator+(const Vector3 &pt) const
- {
- return Vector3(this->vector(0) + pt.vector(0), this->vector(1) + pt.vector(1), this->vector(2) + pt.vector(2));
- }
-
- Vector3 Vector3::operator-(const Vector3 &pt) const
- {
- return Vector3(this->vector(0) - pt.vector(0), this->vector(1) - pt.vector(1), this->vector(2) - pt.vector(2));
- }
-
- //////////////////////////////////////////////////
- Vector3 Vector3::operator*(double v) const
- {
- return Vector3(this->vector(0) * v, this->vector(1) * v, this->vector(2) * v);
- }
-
- //////////////////////////////////////////////////
- const Vector3 &Vector3::operator+=(const Vector3 &pt)
- {
- this->vector(0) += pt.vector(0);
- this->vector(1) += pt.vector(1);
- this->vector(2) += pt.vector(2);
-
- return *this;
- }
-
- double Vector3::distance(math::Vector3 p){
- return sqrt( pow(p.getX()-this->vector(0),2) +
- pow(p.getY()-this->vector(1),2) +
- pow(p.getZ()-this->vector(2),2));
- }
-
-
-}
Deleted: trunk/src/stable/libs/geometry/math/vector3.h
===================================================================
--- trunk/src/stable/libs/geometry/math/vector3.h 2013-10-08 10:20:43 UTC (rev 1017)
+++ trunk/src/stable/libs/geometry/math/vector3.h 2013-10-08 12:47:10 UTC (rev 1018)
@@ -1,64 +0,0 @@
-#ifndef VECTOR3_H
-#define VECTOR3_H
-
-#include <eigen3/Eigen/Dense>
-
-#include "matriz3x3.h"
-
-#include "utils.h"
-
-namespace math
-{
- class Vector3
- {
- public: Vector3();
- public: Vector3(const double &_x, const double &_y, const double &_z);
-
- public: float getX();
- public: float getY();
- public: float getZ();
-
- public: void setX(float f);
- public: void setY(float f);
- public: void setZ(float f);
-
- Vector3 normalize();
- double distance(math::Vector3 p);
-
- public: Eigen::Vector3f vector;
-
- public: Vector3 operator+(const Vector3 &pt) const;
- Vector3 operator-(const Vector3 &pt) const;
- Vector3 operator*(double v) const;
- const Vector3 &operator+=(const Vector3 &pt);
-
-
- public: friend std::ostream &operator<<(std::ostream &_out,
- Vector3 &_pt)
- {
- _out << math::precision(_pt.getX(), 6) << " " << math::precision(_pt.getY(), 6) << " "
- << math::precision(_pt.getZ(), 6);
- return _out;
- }
-
- public: friend std::istream &operator>>(std::istream &_in,
- Vector3 &_pt)
- {
- // Skip white spaces
- _in.setf(std::ios_base::skipws);
-
- float x, y, z;
-
- _in >> x >> y >> z;
- _pt.setX(x);
- _pt.setY(y);
- _pt.setZ(z);
- return _in;
- }
-
-
-
- };
-}
-
-#endif // VECTOR3_H
Deleted: trunk/src/stable/libs/geometry/math/vector3H.cpp
===================================================================
--- trunk/src/stable/libs/geometry/math/vector3H.cpp 2013-10-08 10:20:43 UTC (rev 1017)
+++ trunk/src/stable/libs/geometry/math/vector3H.cpp 2013-10-08 12:47:10 UTC (rev 1018)
@@ -1,96 +0,0 @@
-#include "vector3H.h"
-namespace math
-{
- Vector3H::Vector3H()
- {
- vector<< 0.0, 0.0, 0.0, 0.0;
- }
- Vector3H::Vector3H(const double &_x, const double &_y, const double &_z, const double &_h)
- {
- vector<< _x, _y, _z, _h;
-
- }
-
- float Vector3H::getX()
- {
- return vector(0);
- }
-
- float Vector3H::getY()
- {
- return vector(1);
- }
- float Vector3H::getZ()
- {
- return vector(2);
- }
-
- float Vector3H::getH()
- {
- return vector(3);
- }
-
- void Vector3H::setX(float f)
- {
- vector(0) = f;
- }
-
- void Vector3H::setY(float f)
- {
- vector(1) = f;
- }
-
- void Vector3H::setZ(float f)
- {
- vector(2) = f;
- }
-
- void Vector3H::setH(float f)
- {
- vector(3) = f;
- }
-
- //////////////////////////////////////////////////
- Vector3H Vector3H::normalize()
- {
- double d = sqrt(this->getX() * this->getX() + this->getY() * this->getY() + this->getZ() * this->getZ());
-
- if (!math::equal(d, 0.0))
- {
- this->setX(this->getX()/ d);
- this->setY(this->getY()/ d);
- this->setZ(this->getZ()/ d);
- }
-
- return *this;
- }
-
- //////////////////////////////////////////////////
- Vector3H Vector3H::operator+(const Vector3H &pt) const
- {
- return Vector3H(this->vector(0) + pt.vector(0), this->vector(1) + pt.vector(1), this->vector(2) + pt.vector(2));
- }
-
- Vector3H Vector3H::operator-(const Vector3H &pt) const
- {
- return Vector3H(this->vector(0) - pt.vector(0), this->vector(1) - pt.vector(1), this->vector(2) - pt.vector(2));
- }
-
- //////////////////////////////////////////////////
- Vector3H Vector3H::operator*(double v) const
- {
- return Vector3H(this->vector(0) * v, this->vector(1) * v, this->vector(2) * v);
- }
-
- //////////////////////////////////////////////////
- const Vector3H &Vector3H::operator+=(const Vector3H &pt)
- {
- this->vector(0) += pt.vector(0);
- this->vector(1) += pt.vector(1);
- this->vector(2) += pt.vector(2);
-
- return *this;
- }
-
-
-}
Deleted: trunk/src/stable/libs/geometry/math/vector3H.h
===================================================================
--- trunk/src/stable/libs/geometry/math/vector3H.h 2013-10-08 10:20:43 UTC (rev 1017)
+++ trunk/src/stable/libs/geometry/math/vector3H.h 2013-10-08 12:47:10 UTC (rev 1018)
@@ -1,67 +0,0 @@
-#ifndef Vector3H_H
-#define Vector3H_H
-
-#define EIGEN_DONT_ALIGN_STATICALLY True
-
-#include <eigen3/Eigen/Dense>
-
-#include "matriz3x3.h"
-
-#include "utils.h"
-
-namespace math
-{
- class Vector3H
- {
- public: Vector3H();
- public: Vector3H(const double &_x, const double &_y, const double &_z, const double &_h=1);
-
- public: float getX();
- public: float getY();
- public: float getZ();
- public: float getH();
-
- public: void setX(float f);
- public: void setY(float f);
- public: void setZ(float f);
- public: void setH(float f);
-
- Vector3H normalize();
- public: Eigen::Vector4f vector;
-
- public: Vector3H operator+(const Vector3H &pt) const;
- Vector3H operator-(const Vector3H &pt) const;
- Vector3H operator*(double v) const;
- const Vector3H &operator+=(const Vector3H &pt);
-
-
- public: friend std::ostream &operator<<(std::ostream &_out,
- Vector3H &_pt)
- {
- _out << math::precision(_pt.getX(), 6) << " " << math::precision(_pt.getY(), 6) << " "
- << math::precision(_pt.getZ(), 6) << " " << math::precision(_pt.getH(), 6);
- return _out;
- }
-
- public: friend std::istream &operator>>(std::istream &_in,
- Vector3H &_pt)
- {
- // Skip white spaces
- _in.setf(std::ios_base::skipws);
-
- float x, y, z, h;
-
- _in >> x >> y >> z >> h;
- _pt.setX(x);
- _pt.setY(y);
- _pt.setZ(z);
- _pt.setH(h);
- return _in;
- }
-
-
-
- };
-}
-
-#endif // Vector3H_H
More information about the Jderobot-admin
mailing list