本文整理汇总了C++中kvs::Vector3f::y方法的典型用法代码示例。如果您正苦于以下问题:C++ Vector3f::y方法的具体用法?C++ Vector3f::y怎么用?C++ Vector3f::y使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kvs::Vector3f
的用法示例。
在下文中一共展示了Vector3f::y方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create_coords
void ColonLED::create_coords( const kvs::Vector3f& center )
{
m_coords.allocate( 3 * 8 );
const float length = 2.0;
const float width = 0.2;
// Set const z coord.
for ( size_t i = 2; i < 24; i += 3 ) m_coords[i] = center.z();
for ( size_t i = 0; i < 2; i++ )
{
float is_minus = ( i == 0 ) ? 1.0f : - 1.0f;
m_coords[ i * 12 + 0 ] = center.x() - width;
m_coords[ i * 12 + 1 ] = center.y() + is_minus * length / 2 + width;
m_coords[ i * 12 + 3 ] = center.x() + width;
m_coords[ i * 12 + 4 ] = center.y() + is_minus * length / 2 + width;
m_coords[ i * 12 + 6 ] = center.x() + width;
m_coords[ i * 12 + 7 ] = center.y() + is_minus * length / 2 - width;
m_coords[ i * 12 + 9 ] = center.x() - width;
m_coords[ i * 12 + 10 ] = center.y() + is_minus * length / 2 - width;
}
}
示例2: calculate_uniform_coords
/*===========================================================================*/
void ExtractEdges::calculate_uniform_coords( const kvs::StructuredVolumeObject* volume )
{
kvs::ValueArray<kvs::Real32> coords( 3 * volume->numberOfNodes() );
kvs::Real32* coord = coords.data();
const kvs::Vector3ui resolution( volume->resolution() );
const kvs::Vector3f volume_size( volume->maxObjectCoord() - volume->minObjectCoord() );
const kvs::Vector3ui ngrids( resolution - kvs::Vector3ui( 1, 1, 1 ) );
const kvs::Vector3f grid_size(
volume_size.x() / static_cast<float>( ngrids.x() ),
volume_size.y() / static_cast<float>( ngrids.y() ),
volume_size.z() / static_cast<float>( ngrids.z() ) );
for ( size_t k = 0; k < resolution.z(); ++k )
{
const float z =
grid_size.z() * static_cast<float>( k );
for ( size_t j = 0; j < resolution.y(); ++j )
{
const float y =
grid_size.y() * static_cast<float>( j );
for ( size_t i = 0; i < resolution.x(); ++i )
{
const float x =
grid_size.x() * static_cast<float>( i );
*( coord++ ) = x;
*( coord++ ) = y;
*( coord++ ) = z;
}
}
}
SuperClass::setCoords( coords );
}
示例3: kvsMessageError
const kvs::Vector3f DepthGenerator::realPosition( const kvs::Vector3f& pos )
{
if ( !m_is_created )
{
kvsMessageError( "DepthGenerator is not created yet." );
return( pos );
}
XnPoint3D proj;
XnPoint3D real;
proj.X = pos.x();
proj.Y = pos.y();
proj.Z = pos.z();
XnStatus status = m_generator.ConvertProjectiveToRealWorld( 1, &proj, &real );
if ( status != XN_STATUS_OK )
{
kvsMessageError( "%s error: <%s>.",
xnGetStatusName( status ),
xnGetStatusString( status ) );
return( pos );
}
return( kvs::Vector3f( real.X, real.Y, real.Z ) );
}
示例4: calculate_normals
void Ply::calculate_normals()
{
kvs::ValueArray<kvs::UInt32> counter( m_nverts );
counter.fill( 0 );
m_normals.allocate( m_nverts * 3 );
const kvs::UInt32* pconnections = m_connections.data();
const kvs::Real32* pcoords = m_coords.data();
for ( size_t i = 0; i < m_nfaces; i++ )
{
// Calculate normal vector for each triangles.
const kvs::UInt32 index0 = *(pconnections++);
const kvs::UInt32 index1 = *(pconnections++);
const kvs::UInt32 index2 = *(pconnections++);
const kvs::Vector3f v0( pcoords + 3 * index0 );
const kvs::Vector3f v1( pcoords + 3 * index1 );
const kvs::Vector3f v2( pcoords + 3 * index2 );
const kvs::Vector3f normal = ( ( v1 - v0 ).cross( v2 - v1 ) ).normalized();
// Sum of the normal vectors of the adjacent triangles for the vertex.
m_normals[ 3 * index0 + 0 ] = normal.x();
m_normals[ 3 * index0 + 1 ] = normal.y();
m_normals[ 3 * index0 + 2 ] = normal.z();
counter[ index0 ] += 1;
m_normals[ 3 * index1 + 0 ] = normal.x();
m_normals[ 3 * index1 + 1 ] = normal.y();
m_normals[ 3 * index1 + 2 ] = normal.z();
counter[ index1 ] += 1;
m_normals[ 3 * index2 + 0 ] = normal.x();
m_normals[ 3 * index2 + 1 ] = normal.y();
m_normals[ 3 * index2 + 2 ] = normal.z();
counter[ index2 ] += 1;
}
for ( size_t i = 0; i < m_nverts; i++ )
{
if ( counter[i] == 0 ) continue;
m_normals[ 3 * i + 0 ] /= static_cast<kvs::Real32>( counter[i] );
m_normals[ 3 * i + 1 ] /= static_cast<kvs::Real32>( counter[i] );
m_normals[ 3 * i + 2 ] /= static_cast<kvs::Real32>( counter[i] );
}
}
示例5: return
const kvs::Vector3f ScreenController::vertex_of_joint(
const unsigned int index,
const kvs::ni::Skeleton::SkeletonJoint& joint,
kvs::ni::DepthGenerator& depth,
kvs::ni::UserGenerator& user )
{
const kvs::ni::JointPosition pos = user.skeleton().jointPosition( index, joint );
const kvs::Vector3f proj_pos = depth.projectPosition( pos.position() );
const float d = 0.001f * proj_pos.z();
return( kvs::Vector3f(
d * m_p2r * ( proj_pos.x() - m_cx ),
d * m_p2r * ( float( m_height ) - proj_pos.y() - m_cy ),
- d ) );
}
示例6: sliderMoved
void sliderMoved( void )
{
const float dy_new = this->value();
const float _ymin = center.y() - dy_new / 2;
const float _ymax = center.y() + dy_new / 2;
m_seed_point->setYMin( _ymin );
m_seed_point->setYMax( _ymax );
m_seed_point->reset_coordinates();
#ifdef USE_KVS
m_compositor->changeObject( m_seed_point, m_seed_point, false );
#else
m_renderer->changeObject( m_seed_point, m_point_renderer, false );
#endif
}
示例7: build_segment_coord
void OneSegment::build_segment_coord(
const kvs::Vector3f& center,
const float length,
const float width,
const float offset,
const float left_ratio,
const float right_ratio,
const float rotate_theta )
{
m_coords.allocate( 3 * 6 );
// Set const z coord.
for ( size_t i = 2; i < 18; i += 3 ) m_coords[i] = center.z();
const float half_length = length / 2;
m_coords[ 0] = - ( half_length + left_ratio * width - offset );
m_coords[ 1] = - left_ratio * width;
m_coords[ 3] = - ( half_length - width - offset );
m_coords[ 4] = width;
m_coords[ 6] = - ( half_length - ( 1.0f - 2 * left_ratio ) * width - offset );
m_coords[ 7] = - width;
m_coords[ 9] = ( half_length - width - offset );
m_coords[10] = width;
m_coords[12] = ( half_length - ( 1.0f - 2 * right_ratio ) * width - offset );
m_coords[13] = - width;
m_coords[15] = ( half_length + right_ratio * width - offset );
m_coords[16] = - right_ratio * width;
for ( size_t i = 0; i < 6; i++ )
{
const float theta = kvs::Math::Deg2Rad( rotate_theta );
const float x = m_coords[ i * 3 + 0 ];
const float y = m_coords[ i * 3 + 1 ];
m_coords[ i * 3 + 0 ] = center.x() + cosf( theta ) * x + sinf( theta ) * y;
m_coords[ i * 3 + 1 ] = center.y() - sinf( theta ) * x + cosf( theta ) * y;
}
}
示例8: calculate_triangle_normals
/*===========================================================================*/
void PolygonToPolygon::calculate_triangle_normals( void )
{
const size_t nvertices = SuperClass::nvertices();
const size_t npolygons = SuperClass::nconnections();
const float* p_coords = SuperClass::coords().pointer();
const unsigned int* p_connections = SuperClass::connections().pointer();
kvs::ValueArray<float> normals( 3 * nvertices );
normals.fill( 0x00 );
for ( size_t i = 0; i < npolygons; i++ )
{
size_t index[3];
kvs::Vector3f vertex[3];
for ( size_t j = 0; j < 3; j++ )
{
index[j] = p_connections[ 3 * i + j ];
vertex[j] = kvs::Vector3f( p_coords + 3 * index[j] );
}
const kvs::Vector3f normal( ( vertex[1] - vertex[0] ).cross( vertex[2] - vertex[0] ) );
for ( size_t j = 0; j < 3; j++ )
{
normals[ 3 * index[j] ] += normal.x();
normals[ 3 * index[j] + 1 ] += normal.y();
normals[ 3 * index[j] + 2 ] += normal.z();
}
}
// Normalize normals.
const float* p_normals = normals.pointer();
for ( size_t i = 0; i < nvertices; i++ )
{
kvs::Vector3f normal( p_normals + i * 3 );
normal.normalize();
normals[ i * 3 ] = normal.x();
normals[ i * 3 + 1 ] = normal.y();
normals[ i * 3 + 2 ] = normal.z();
}
SuperClass::setNormals( normals );
SuperClass::setNormalType( kvs::PolygonObject::VertexNormal );
}
示例9: startTracking
const bool HandsGenerator::startTracking( const kvs::Vector3f& position )
{
if ( !m_is_created )
{
kvsMessageError( "HandsGenerator is not created yet." );
return( false );
}
XnPoint3D pos;
pos.X = position.x();
pos.Y = position.y();
pos.Z = position.z();
XnStatus status = m_generator.StartTracking( pos );
if ( status != XN_STATUS_OK )
{
kvsMessageError( "%s error: <%s>.",
xnGetStatusName( status ),
xnGetStatusString( status ) );
return( false );
}
return( true );
}
示例10: extract_surfaces_with_duplication
void MarchingPyramid::extract_surfaces_with_duplication(
const kvs::UnstructuredVolumeObject* volume )
{
// Calculated the coordinate data array and the normal vector array.
std::vector<kvs::Real32> coords;
std::vector<kvs::Real32> normals;
const kvs::UInt32 ncells( volume->numberOfCells() );
const kvs::UInt32* connections =
static_cast<const kvs::UInt32*>( volume->connections().data() );
// Extract surfaces.
size_t index = 0;
size_t local_index[5];
for ( kvs::UInt32 cell = 0; cell < ncells; ++cell, index += 5 )
{
// Calculate the indices of the target cell.
local_index[0] = connections[ index + 0 ];
local_index[1] = connections[ index + 1 ];
local_index[2] = connections[ index + 2 ];
local_index[3] = connections[ index + 3 ];
local_index[4] = connections[ index + 4 ];
// Calculate the index of the reference table.
size_t table_index = this->calculate_table_index<T>( local_index );
if ( table_index == 0 ) continue;
if ( table_index == 10 || table_index == 11 || table_index == 20 || table_index == 21 ){
table_index = this->calculate_special_table_index<T>( local_index, table_index );
}
if ( table_index == 36 ) continue;
// Calculate the triangle polygons.
for ( size_t i = 0; MarchingPyramidTable::TriangleID[ table_index ][i] != -1; i += 3 )
{
// Refer the edge IDs from the TriangleTable by using the table_index.
const int e0 = MarchingPyramidTable::TriangleID[table_index][i];
const int e1 = MarchingPyramidTable::TriangleID[table_index][i+2];
const int e2 = MarchingPyramidTable::TriangleID[table_index][i+1];
// Determine vertices for each edge.
const int v0 = local_index[MarchingPyramidTable::VertexID[e0][0]];
const int v1 = local_index[MarchingPyramidTable::VertexID[e0][1]];
const int v2 = local_index[MarchingPyramidTable::VertexID[e1][0]];
const int v3 = local_index[MarchingPyramidTable::VertexID[e1][1]];
const int v4 = local_index[MarchingPyramidTable::VertexID[e2][0]];
const int v5 = local_index[MarchingPyramidTable::VertexID[e2][1]];
// Calculate coordinates of the vertices which are composed
// of the triangle polygon.
const kvs::Vector3f vertex0( this->interpolate_vertex<T>( v0, v1 ) );
coords.push_back( vertex0.x() );
coords.push_back( vertex0.y() );
coords.push_back( vertex0.z() );
const kvs::Vector3f vertex1( this->interpolate_vertex<T>( v2, v3 ) );
coords.push_back( vertex1.x() );
coords.push_back( vertex1.y() );
coords.push_back( vertex1.z() );
const kvs::Vector3f vertex2( this->interpolate_vertex<T>( v4, v5 ) );
coords.push_back( vertex2.x() );
coords.push_back( vertex2.y() );
coords.push_back( vertex2.z() );
// Calculate a normal vector for the triangle polygon.
const kvs::Vector3f normal( ( vertex1 - vertex0 ).cross( vertex2 - vertex0 ) );
normals.push_back( normal.x() );
normals.push_back( normal.y() );
normals.push_back( normal.z() );
} // end of loop-triangle
} // end of loop-cell
// Calculate the polygon color for the isolevel.
const kvs::RGBColor color = this->calculate_color<T>();
if( coords.size() > 0 ){
SuperClass::setCoords( kvs::ValueArray<kvs::Real32>( coords ) );
SuperClass::setColor( color );
SuperClass::setNormals( kvs::ValueArray<kvs::Real32>( normals ) );
SuperClass::setOpacity( 255 );
SuperClass::setPolygonType( kvs::PolygonObject::Triangle );
SuperClass::setColorType( kvs::PolygonObject::PolygonColor );
SuperClass::setNormalType( kvs::PolygonObject::PolygonNormal );
}
}
示例11: import
void StructuredVolumeImporter::import( const kvs::DicomList* dicom_list )
{
if ( dicom_list->size() == 0 )
{
BaseClass::setSuccess( false );
kvsMessageError("Dicom file is not included.");
return;
}
const float spacing = static_cast<float>( dicom_list->sliceSpacing() );
const float thickness = static_cast<float>( dicom_list->sliceThickness() );
const size_t x_size = dicom_list->width();
const size_t y_size = dicom_list->height();
const size_t z_size = dicom_list->nslices();
const float x_ratio = dicom_list->pixelSpacing()[0];
const float y_ratio = dicom_list->pixelSpacing()[1];
const float z_ratio = kvs::Math::IsZero( spacing ) ? kvs::Math::IsZero( thickness ) ? x_ratio : thickness : spacing;
const kvs::Vector3f min_obj_coord( 0.0f, 0.0f, 0.0f );
const kvs::Vector3f max_obj_coord( x_size - 1.0f, y_size - 1.0f, z_size - 1.0f );
SuperClass::setMinMaxObjectCoords( min_obj_coord, max_obj_coord );
const kvs::Vector3f min_ext_coord( min_obj_coord );
const kvs::Vector3f max_ext_coord( max_obj_coord.x() * x_ratio,
max_obj_coord.y() * y_ratio,
max_obj_coord.z() * z_ratio );
SuperClass::setMinMaxExternalCoords( min_ext_coord, max_ext_coord );
bool shift = true;
const kvs::Dicom* dicom = (*dicom_list)[0];
const kvs::UInt32 bits_allocated = dicom->bitsAllocated();
const bool pixel_representation = dicom->pixelRepresentation();
switch ( bits_allocated )
{
case 8:
{
const kvs::AnyValueArray values = this->get_dicom_data<kvs::UInt8>( dicom_list, false );
SuperClass::setValues( values );
break;
}
case 16:
{
if ( pixel_representation )
{
const kvs::AnyValueArray values = this->get_dicom_data<kvs::UInt16>( dicom_list, false );
SuperClass::setValues( values );
}
else
{
if ( shift )
{
const kvs::AnyValueArray values = this->get_dicom_data<kvs::UInt16>( dicom_list, true );
SuperClass::setValues( values );
}
else
{
const kvs::AnyValueArray values = this->get_dicom_data<kvs::Int16>( dicom_list, false );
SuperClass::setValues( values );
}
}
break;
}
default: break;
}
const kvs::Vector3ui resolution( x_size, y_size, z_size );
SuperClass::setGridType( kvs::StructuredVolumeObject::Uniform );
SuperClass::setResolution( resolution );
SuperClass::setVeclen( 1 );
SuperClass::updateMinMaxValues();
}
示例12: pressed
void pressed()
{
#ifdef WIN32
std::string default_volume1( "D:\\Koron\\Dropbox\\Work\\Viz\\Hyperstreamline\\data\\engine\\v6engine_stress_and_mises.kvsml" );
#else
std::string default_volume1( "../../data/engine/v6engine_stress_and_mises.kvsml" );
#endif
if ( p_arg->hasOption( "volume1" ) )
m_volume1 = new kvs::UnstructuredVolumeImporter( p_arg->optionValue<std::string>("volume1") );
else
m_volume1 = new kvs::UnstructuredVolumeImporter( default_volume1 );
if ( m_volume1->veclen() != 6 && m_volume1->veclen() != 7 )
{
p_pb_info->setCaption( "Veclen wrong!" );
return;
}
// initialize sliders
const kvs::Vector3f min_coord = m_volume1->minExternalCoord();
const kvs::Vector3f max_coord = m_volume1->maxExternalCoord();
xmin = min_coord.x();
ymin = min_coord.y();
zmin = min_coord.z();
xmax = max_coord.x();
ymax = max_coord.y();
zmax = max_coord.z();
center.x() = ( xmin + xmax ) / 2;
center.y() = ( ymin + ymax ) / 2;
center.z() = ( zmin + zmax ) / 2;
resx = 10;
resy = 10;
resz = 10;
const float dx = xmax - xmin;
const float dy = ymax - ymin;
const float dz = zmax - zmin;
p_sld0->setValue( dx );
p_sld0->setRange( 0.0, dx );
p_sld0->activate();
p_sld1->setValue( dy );
p_sld1->setRange( 0.0, dy );
p_sld1->activate();
p_sld2->setValue( dz );
p_sld2->setRange( 0, dz );
p_sld2->activate();
p_sld3->setValue( resx );
p_sld3->setRange( 0, 30 );
p_sld3->activate();
p_sld4->setValue( resy );
p_sld4->setRange( 0, 30 );
p_sld4->activate();
p_sld5->setValue( resz );
p_sld5->setRange( 0, 30 );
p_sld5->activate();
m_seed_point->setResX( resx );
m_seed_point->setResY( resy );
m_seed_point->setResZ( resz );
m_seed_point->setXMin( xmin );
m_seed_point->setXMax( xmax );
m_seed_point->setYMin( ymin );
m_seed_point->setYMax( ymax );
m_seed_point->setZMin( zmin );
m_seed_point->setZMax( zmax );
m_seed_point->reset_coordinates();
m_seed_point->setMinMaxObjectCoords( m_volume1->minObjectCoord(), m_volume1->maxObjectCoord() );
m_seed_point->setMinMaxExternalCoords( m_volume1->minExternalCoord(), m_volume1->maxExternalCoord() );
#ifdef USE_KVS
#else
m_renderer->changeObject( m_seed_point, m_point_renderer, false );
#endif
p_pb_info->setCaption( "Tensor Volume Read!" );
std::cout << "Tensor Volume Read" << std::endl;
this->deactivate();
}
示例13: main
int main( int argc, char** argv )
{
kvs::glut::Application app( argc, argv );
Argument arg( app.argc(), app.argv() );
p_arg = &arg;
// for empty objects
std::vector<kvs::Real32> coords;
std::vector<kvs::UInt32> connections;
std::vector<kvs::UInt8> colors;
std::vector<float> values;
std::vector<float> eigenvalues;
colors.push_back(255);
colors.push_back(255);
colors.push_back(255);
for ( unsigned int i = 0; i < 3; i++ )
{
coords.push_back(0.0);
}
for ( unsigned int i = 0; i < 2; i ++ )
{
connections.push_back(0);
values.push_back(0.0);
}
eigenvalues.push_back(0);
// Volume 2 (Displacement)
m_volume2 = new kvs::UnstructuredVolumeObject();
m_volume2->setCellType( kvs::UnstructuredVolumeObject::Tetrahedra );
m_volume2->setConnections( kvs::ValueArray<kvs::UInt32>( connections ) );
m_volume2->setCoords( kvs::ValueArray<float>( coords ) );
m_volume2->setValues( kvs::AnyValueArray( values ) );
m_volume2->setNCells(0);
m_volume2->setNNodes(0);
// polygon (Empty External)
#ifdef WIN32
std::string default_polygon( "D:\\Koron\\Dropbox\\Work\\Viz\\Hyperstreamline\\data\\engine\\v6engine_external_face.kvsml" );
#else
std::string default_polygon( "../../data/engine/v6engine_external_face.kvsml" );
#endif
if ( p_arg->hasOption( "polygon" ) )
{
kvs::PolygonObject* import_polygon = new kvs::PolygonImporter( p_arg->optionValue<std::string>("polygon") );
m_polygon = new kvs::PolygonToPolygon( import_polygon );
}
else
{
kvs::PolygonObject* import_polygon = new kvs::PolygonImporter( default_polygon );
m_polygon = new kvs::PolygonToPolygon( import_polygon );
}
if ( !m_polygon )
{
kvsMessageError( "Cannot create surface." );
exit( EXIT_FAILURE );
}
m_polygon->setOpacity( opacity_polygon );
m_polygon->setColor( kvs::RGBColor( 255,255,255 ) );
const kvs::Vector3f min_coord = m_polygon->minExternalCoord();
const kvs::Vector3f max_coord = m_polygon->maxExternalCoord();
xmin = min_coord.x();
ymin = min_coord.y();
zmin = min_coord.z();
xmax = max_coord.x();
ymax = max_coord.y();
zmax = max_coord.z();
resx = 10;
resy = 10;
resz = 10;
m_seed_point = new kvs::CubicPointObject();
m_seed_point->reset_coordinates( resx, resy, resz, xmin, xmax, ymin, ymax, zmin, zmax );
m_seed_point->updateMinMaxCoords();
// streamlines (Empty LineObject)
m_streamline = new kvs::HyperStreamline();
m_streamline->setLineType( kvs::LineObject::Polyline );
m_streamline->setColorType( kvs::LineObject::VertexColor );
m_streamline->setCoords( kvs::ValueArray<kvs::Real32>( coords ) );
m_streamline->setConnections( kvs::ValueArray<kvs::UInt32>( connections ) );
m_streamline->setEigenValues( eigenvalues );
m_streamline->setColors( kvs::ValueArray<kvs::UInt8>( colors ) );
m_streamline->setSize( 1.0f );
// main screen
kvs::glut::Screen main_screen( &app );
p_main_screen = &main_screen;
//main_screen.background()->setColor( kvs::RGBAColor( 0, 0, 0, 1 ) );
int interval = 30;
kvs::glut::Timer timer( interval );
TimerEvent timer_event;
KeyPressEvent keypress_event;
main_screen.addTimerEvent( &timer_event, &timer );
main_screen.addKeyPressEvent( &keypress_event );
main_screen.show();
//.........这里部分代码省略.........
示例14: update
void update ( kvs::MouseEvent* event = 0 )
{
if ( event->x() > 20 && event->x() < 330 && event->y() > 20 && event->y() < 400 && m_seed_point->nvertices() > 0 )
{
const kvs::Xform x = p_main_screen->objectManager()->xform();
const float* pcoord = m_seed_point->coords().pointer();
const unsigned int nvertices = m_seed_point->nvertices();
kvs::ValueArray<float> coords( nvertices * 3 );
if ( event->button() == kvs::MouseButton::Right )
{
this->screen()->mouse()->setMode( kvs::Mouse::Translation );
this->screen()->mouse()->move( event->x(), event->y() );
kvs::Vector3f translation = this->screen()->mouse()->translation();
const kvs::Vector3f normalize = p_main_screen->objectManager()->normalize();
translation.x() /= normalize.x() * x.scaling().x();
translation.y() /= normalize.y() * x.scaling().y();
translation.z() /= normalize.z() * x.scaling().z();
for ( unsigned int i = 0; i < nvertices; i ++ )
{
kvs::Vector3f coord( pcoord );
const kvs::Vector3f new_coord = coord + translation * x.rotation();
coords[ 3 * i] = new_coord.x();
coords[ 3 * i + 1] = new_coord.y();
coords[ 3 * i + 2] = new_coord.z();
pcoord += 3;
}
m_seed_point->setCoords( coords );
}
if ( event->button() == kvs::MouseButton::Left )
{
this->screen()->mouse()->setMode( kvs::Mouse::Rotation );
this->screen()->mouse()->move( event->x(), event->y() );
kvs::Matrix33f rotation = this->screen()->mouse()->rotation().toMatrix();
for ( unsigned int i = 0; i < nvertices; i ++ )
{
kvs::Vector3f coord( pcoord );
const kvs::Vector3f new_coord = coord * rotation;
coords[ 3 * i] = new_coord.x();
coords[ 3 * i + 1] = new_coord.y();
coords[ 3 * i + 2] = new_coord.z();
pcoord += 3;
}
m_seed_point->setCoords( coords );
}
#ifdef USE_KVS
m_compositor->changeObject( m_seed_point, m_seed_point, false );
#else
m_renderer->changeObject( m_seed_point, m_point_renderer, false );
#endif
m_seed_point->updateMinMaxCoords();
const kvs::Vector3f min = m_seed_point->minObjectCoord();
const kvs::Vector3f max = m_seed_point->maxObjectCoord();
center = ( min + max ) / 2;
m_seed_point->setXMin( min.x() );
m_seed_point->setXMax( max.x() );
m_seed_point->setYMin( min.y() );
m_seed_point->setYMax( max.y() );
m_seed_point->setZMin( min.z() );
m_seed_point->setZMax( max.z() );
if ( m_seed_point->nvertices() <= 8 )
update_streamline();
}
}