libalmath
1.14.5
|
00001 /* 00002 * Copyright (c) 2012 Aldebaran Robotics. All rights reserved. 00003 * Use of this source code is governed by a BSD-style license that can be 00004 * found in the COPYING file. 00005 */ 00006 00007 00008 #pragma once 00009 #ifndef _LIBALMATH_ALMATH_TYPES_ALPOSITION6D_H_ 00010 #define _LIBALMATH_ALMATH_TYPES_ALPOSITION6D_H_ 00011 00012 #include <vector> 00013 00014 namespace AL { 00015 namespace Math { 00016 00023 struct Position6D { 00025 float x; 00027 float y; 00029 float z; 00031 float wx; 00033 float wy; 00035 float wz; 00036 00039 00058 00059 Position6D(); 00060 00063 00082 00083 00084 00085 explicit Position6D(float pInit); 00086 00089 00108 00109 00110 00111 00112 00113 00114 00115 Position6D( 00116 float pX, 00117 float pY, 00118 float pZ, 00119 float pWx, 00120 float pWy, 00121 float pWz); 00122 00125 00144 00145 00146 00147 00148 00149 Position6D(const std::vector<float>& pFloats); 00150 00155 Position6D operator+ (const Position6D& pPos2) const; 00156 00161 Position6D operator- (const Position6D& pPos2) const; 00162 00166 Position6D operator+ () const; 00167 00171 Position6D operator- () const; 00172 00177 Position6D& operator+= (const Position6D& pPos2); 00178 00183 Position6D& operator-= (const Position6D& pPos2); 00184 00189 bool operator== (const Position6D& pPos2) const; 00190 00195 bool operator!= (const Position6D& pPos2) const; 00196 00201 Position6D operator* (float pVal) const; 00202 00207 Position6D operator/ (float pVal) const; 00208 00213 Position6D& operator*= (float pVal); 00214 00219 Position6D& operator/= (float pVal); 00220 00232 bool isNear( 00233 const Position6D& pPos2, 00234 const float& pEpsilon=0.0001f) const; 00235 00246 float distanceSquared(const Position6D& pPos2) const; 00247 00258 float distance(const Position6D& pPos2) const; 00259 00268 float norm() const; 00269 00273 std::vector<float> toVector () const; 00274 }; // end struct 00275 00276 00289 float distanceSquared( 00290 const Position6D& pPos1, 00291 const Position6D& pPos2); 00292 00293 00305 float distance( 00306 const Position6D& pPos1, 00307 const Position6D& pPos2); 00308 00319 float norm(const Position6D& pPos); 00320 00331 Position6D normalize(const Position6D& pPos); 00332 00333 } // end namespace math 00334 } // end namespace al 00335 00336 #endif // _LIBALMATH_ALMATH_TYPES_ALPOSITION6D_H_