normal_visual.cpp
Go to the documentation of this file.
1 // -*- mode:c++ -*-
2 #include "normal_visual.h"
3 
4 namespace jsk_rviz_plugins
5 {
6 
7  NormalVisual::NormalVisual( Ogre::SceneManager* scene_manager, Ogre::SceneNode* parent_node )
8  {
9  scene_manager_ = scene_manager;
10  frame_node_ = parent_node->createChildSceneNode();
12  }
13 
15  {
16  scene_manager_->destroySceneNode( frame_node_ );
17  }
18 
19  void NormalVisual::setValues( float x, float y, float z, float normal_x, float normal_y, float normal_z)
20  {
21 
22  Ogre::Vector3 dir( normal_x, normal_y, normal_z);
23  Ogre::Vector3 pos( x, y, z);
24 
25  float length = dir.length()/10;
26 
27  Ogre::Vector3 scale( length, length, length );
28  normal_arrow_->setScale( scale );
29  normal_arrow_->setDirection( dir );
30  normal_arrow_->setPosition(pos);
31  }
32 
33  void NormalVisual::setFramePosition( const Ogre::Vector3& position )
34  {
35  frame_node_->setPosition( position );
36  }
37 
38  void NormalVisual::setFrameOrientation( const Ogre::Quaternion& orientation )
39  {
40  frame_node_->setOrientation( orientation );
41  }
42 
43  void NormalVisual::setColor( float r, float g, float b, float a )
44  {
45  normal_arrow_->setColor( r, g, b, a );
46  }
47 
49  {
50  normal_arrow_->setScale( Ogre::Vector3( scale, scale, scale ) );
51  }
52 
53 }
void setFramePosition(const Ogre::Vector3 &position)
pos
void setValues(float x, float y, float z, float normal_x, float normal_y, float normal_z)
Ogre::SceneManager * scene_manager_
Definition: normal_visual.h:37
boost::shared_ptr< rviz::Arrow > normal_arrow_
Definition: normal_visual.h:34
Ogre::SceneNode * frame_node_
Definition: normal_visual.h:36
NormalVisual(Ogre::SceneManager *scene_manager, Ogre::SceneNode *parent_node)
TFSIMD_FORCE_INLINE tfScalar length(const Quaternion &q)
void setColor(float r, float g, float b, float a)
void setFrameOrientation(const Ogre::Quaternion &orientation)


jsk_rviz_plugins
Author(s): Kei Okada , Yohei Kakiuchi , Shohei Fujii , Ryohei Ueda
autogenerated on Thu Jun 1 2023 02:45:58