normal_visual.cpp
Go to the documentation of this file.
00001 // -*- mode:c++ -*-
00002 #include "normal_visual.h"
00003 
00004 namespace jsk_rviz_plugins
00005 {
00006 
00007   NormalVisual::NormalVisual( Ogre::SceneManager* scene_manager, Ogre::SceneNode* parent_node )
00008   {
00009     scene_manager_ = scene_manager;
00010     frame_node_ = parent_node->createChildSceneNode();
00011     normal_arrow_.reset(new rviz::Arrow( scene_manager_, frame_node_ ));
00012   }
00013 
00014   NormalVisual::~NormalVisual()
00015   {
00016     scene_manager_->destroySceneNode( frame_node_ );
00017   }
00018 
00019   void NormalVisual::setValues( float x, float y, float z, float normal_x, float normal_y, float  normal_z)
00020   {
00021 
00022     Ogre::Vector3 dir( normal_x, normal_y, normal_z);
00023     Ogre::Vector3 pos(        x,        y,        z);
00024 
00025     float length = dir.length()/10;
00026 
00027     Ogre::Vector3 scale( length, length, length );
00028     normal_arrow_->setScale( scale );
00029     normal_arrow_->setDirection( dir );
00030     normal_arrow_->setPosition(pos);
00031   }
00032 
00033   void NormalVisual::setFramePosition( const Ogre::Vector3& position )
00034   {
00035     frame_node_->setPosition( position );
00036   }
00037 
00038   void NormalVisual::setFrameOrientation( const Ogre::Quaternion& orientation )
00039   {
00040     frame_node_->setOrientation( orientation );
00041   }
00042 
00043   void NormalVisual::setColor( float r, float g, float b, float a )
00044   {
00045     normal_arrow_->setColor( r, g, b, a );
00046   }
00047 
00048   void NormalVisual::setScale( float scale )
00049   {
00050     normal_arrow_->setScale( Ogre::Vector3( scale, scale, scale ) );
00051   }
00052 
00053 }


jsk_rviz_plugins
Author(s): Kei Okada , Yohei Kakiuchi , Shohei Fujii , Ryohei Ueda
autogenerated on Wed May 1 2019 02:40:22