Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include <srs_env_model/but_server/plugins/octomap_plugin_tools/testing_planes.h>
00029 #include <iostream>
00030
00034 srs_env_model::CTestingPlane::CTestingPlane()
00035 : m_plane()
00036 , m_d( 0.0 )
00037 {
00038
00039 }
00040
00044 srs_env_model::CTestingPlane::CTestingPlane(const CTestingPlane & plane)
00045 : m_plane( plane.m_plane )
00046 , m_d( plane.m_d )
00047 {
00048
00049 }
00050
00051
00055 srs_env_model::CTestingPlane srs_env_model::CTestingPlane::operator =(const CTestingPlane & plane)
00056 {
00057 m_plane = plane.m_plane;
00058 m_d = plane.m_d;
00059
00060 return plane;
00061 }
00062
00063
00067 srs_env_model::CTestingPlane::CTestingPlane(const tPoint & p1, const tPoint & p2, const tPoint & p3)
00068 {
00069
00070 set( p1, p2, p3 );
00071 }
00072
00073
00077 srs_env_model::CTestingPlane::CTestingPlane(const tPoint & point, const tPoint & normal)
00078 {
00079
00080 set( point, normal );
00081 }
00082
00083
00100 void srs_env_model::CTestingPlane::set(const tPoint & p1, const tPoint & p2, const tPoint & p3)
00101 {
00102
00103 tPoint dir1( p2 - p1 ), dir2( p3 - p1 );
00104
00105
00106 m_plane = dir1;
00107 m_plane = m_plane.cross(dir2);
00108 m_plane.normalize();
00109
00110
00111
00112
00113 m_d = - p1.dot( m_plane );
00114 }
00115
00116
00120 void srs_env_model::CTestingPlane::set(const tPoint & point, const tPoint & normal)
00121 {
00122 m_plane = normal;
00123 m_plane.normalize();
00124 m_d = - point.dot( m_plane );
00125 }
00126
00127
00131 bool srs_env_model::CTestingPlane::isIn(double x, double y, double z)
00132 {
00133 tPoint p( x, y, z );
00134
00135 return p.dot( m_plane ) + m_d >= 0;
00136 }
00137
00138
00140
00141
00142
00143
00144 srs_env_model::CTestingPlanes::CTestingPlanes()
00145 {
00146 }
00147
00148
00152 srs_env_model::CTestingPlanes::CTestingPlanes(const tPlanesStack & planes)
00153 {
00154
00155 set( planes );
00156 }
00157
00158
00162 void srs_env_model::CTestingPlanes::set(const tPlanesStack & planes)
00163 {
00164 if( planes.size() == 0 )
00165 return;
00166
00167 m_planes.clear();
00168 m_planes.reserve( planes.size() );
00169 std::copy( planes.begin(), planes.end(), m_planes.begin() );
00170 }
00171
00172
00173
00174
00175 bool srs_env_model::CTestingPlanes::isIn( double x, double y, double z )
00176 {
00177 tPlanesStack::iterator i, end;
00178 for( i = m_planes.begin(), end = m_planes.end(); i != end; ++i)
00179 {
00180
00181 if( ! i->isIn( x, y, z ) )
00182 return false;
00183 }
00184
00185 return true;
00186 }
srs_env_model
Author(s): Vit Stancl (stancl@fit.vutbr.cz), Tomas Lokaj, Jan Gorig, Michal Spanel (spanel@fit.vutbr.cz)
autogenerated on Mon Oct 6 2014 08:05:07