7 #include "PlusConfigure.h" 16 this->
Type =
"LinearObject";
38 if ( v1.size() != v2.size() )
44 for (
unsigned int i = 0;
i < v1.size();
i++ )
46 distance += ( v1.at(
i) - v2.at(
i) ) * ( v1.at(
i) - v2.at(
i) );
57 for (
unsigned int i = 0;
i < vector.size();
i++ )
59 norm += vector.at(
i) * vector.at(
i);
69 if ( v1.size() != v2.size() )
75 for (
unsigned int i = 0;
i < v1.size();
i++ )
77 dot += v1.at(
i) * v2.at(
i);
87 if ( v1.size() != 3 || v2.size() != 3 )
89 return std::vector<double>( 0, 0.0 );
92 std::vector<double> result( 3, 0.0 );
93 result.at(0) = v1.at(1) * v2.at(2) - v1.at(2) * v2.at(1);
94 result.at(1) = v1.at(2) * v2.at(0) - v1.at(0) * v2.at(2);
95 result.at(2) = v1.at(0) * v2.at(1) - v1.at(1) * v2.at(0);
104 if ( v1.size() != v2.size() )
106 return std::vector<double>( 0, 0.0 );
109 std::vector<double> result( v1.size(), 0.0 );
110 for (
unsigned int i = 0;
i < v1.size();
i++ )
112 result.at(
i) = v1.at(
i) + v2.at(
i);
122 if ( v1.size() != v2.size() )
124 return std::vector<double>( 0, 0.0 );
127 std::vector<double> result( v1.size(), 0.0 );
128 for (
unsigned int i = 0;
i < v1.size();
i++ )
130 result.at(
i) = v1.at(
i) - v2.at(
i);
140 std::vector<double> result( vector.size(), 0.0 );
141 for (
unsigned int i = 0;
i < vector.size();
i++ )
143 result.at(
i) = c * vector.at(
i);
153 std::ostringstream s;
155 for (
unsigned int i = 0;
i < vector.size();
i++ )
157 s << vector.at(
i) <<
" ";
167 std::stringstream ss( s );
169 std::vector<double> vector( size, 0.0 );
171 for (
int i = 0;
i < size;
i++ )
static double Distance(std::vector< double > v1, std::vector< double > v2)
static double Norm(std::vector< double > vector)
static std::vector< double > Add(std::vector< double > v1, std::vector< double > v2)
std::vector< double > BasePoint
virtual std::vector< double > ProjectVector(std::vector< double > vector)=0
static double Dot(std::vector< double > v1, std::vector< double > v2)
const char const char * value
std::vector< double > Signature
double DistanceToVector(std::vector< double > vector)
static std::vector< double > StringToVector(std::string s, int size)
static std::string VectorToString(std::vector< double > vector)
static std::vector< double > Cross(std::vector< double > v1, std::vector< double > v2)
static std::vector< double > Multiply(double c, std::vector< double > vector)
static std::vector< double > Subtract(std::vector< double > v1, std::vector< double > v2)