这篇教程C++ GetAngle函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetAngle函数的典型用法代码示例。如果您正苦于以下问题:C++ GetAngle函数的具体用法?C++ GetAngle怎么用?C++ GetAngle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetAngle函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: meanValvoid CKinectProc::BatchAngel(double *data,double *outputData,int height,int width,int channel){ int lineWidth = channel * width; for (int i = 0; i < height; ++i) { vector<double> meanVal(channel,0); GetBodyCenter(data + i*lineWidth,width,channel,meanVal); std::cout<<"BodyNo:"<<i<<". "<<" body center ok!"<<std::endl; for (int j = 0; j < width; ++j) { vector<double> val(channel,0); GetAngle(data + i*lineWidth + j * channel,&meanVal[0],channel,val); for (int k = 0; k < channel; ++k) { outputData[i*lineWidth + j * channel + k] = val[k]; } //val.clear(); } std::cout<<"BodyNo:"<<i<<". "<<" Angle ok!"<<std::endl; //meanVal.clear(); } }
开发者ID:EricWeiYb,项目名称:KinectCPlus,代码行数:22,
示例2: GetAnglevoid Encoder::Load(physics::ModelPtr model, sdf::ElementPtr sdf) { this->model = model; // Parse SDF properties joint = model->GetJoint(sdf->Get<std::string>("joint")); if (sdf->HasElement("topic")) { topic = sdf->Get<std::string>("topic"); } else { topic = "~/" + sdf->GetAttribute("name")->GetAsString(); } if (sdf->HasElement("units")) { radians = sdf->Get<std::string>("units") != "degrees"; } else { radians = true; } zero = GetAngle(); stopped = true; stop_value = 0; gzmsg << "Initializing encoder: " << topic << " joint=" << joint->GetName() << " radians=" << radians << std::endl; // Connect to Gazebo transport for messaging std::string scoped_name = model->GetWorld()->GetName() + "::" + model->GetScopedName(); boost::replace_all(scoped_name, "::", "/"); node = transport::NodePtr(new transport::Node()); node->Init(scoped_name); command_sub = node->Subscribe(topic + "/control", &Encoder::Callback, this); pos_pub = node->Advertise<msgs::Float64>(topic + "/position"); vel_pub = node->Advertise<msgs::Float64>(topic + "/velocity"); // Connect to the world update event. // This will trigger the Update function every Gazebo iteration updateConn = event::Events::ConnectWorldUpdateBegin( boost::bind(&Encoder::Update, this, _1));}
开发者ID:PeterMitrano,项目名称:allwpilib,代码行数:38,
示例3: switchvoid EDGE_MODULE::Mirror( wxPoint aCentre, bool aMirrorAroundXAxis ){ // Mirror an edge of the footprint. the layer is not modified // This is a footprint shape modification. switch( GetShape() ) { case S_ARC: SetAngle( -GetAngle() ); //Fall through default: case S_SEGMENT: if( aMirrorAroundXAxis ) { MIRROR( m_Start0.y, aCentre.y ); MIRROR( m_End0.y, aCentre.y ); } else { MIRROR( m_Start0.x, aCentre.x ); MIRROR( m_End0.x, aCentre.x ); } break; case S_POLYGON: // polygon corners coordinates are always relative to the // footprint position, orientation 0 for( unsigned ii = 0; ii < m_PolyPoints.size(); ii++ ) { if( aMirrorAroundXAxis ) MIRROR( m_PolyPoints[ii].y, aCentre.y ); else MIRROR( m_PolyPoints[ii].x, aCentre.x ); } } SetDrawCoord();}
开发者ID:PatMart,项目名称:kicad-source-mirror,代码行数:37,
示例4: GetMomentum/**/brief Accelerates the ship. * /sa Model::GetAcceleration */void Ship::Accelerate( void ) { Trig *trig = Trig::Instance(); Coordinate momentum = GetMomentum(); float angle = static_cast<float>(trig->DegToRad( GetAngle() )); float speed = shipStats.GetMaxSpeed()*engineBooster; float acceleration = (shipStats.GetForceOutput() *engineBooster ) / shipStats.GetMass(); momentum += Coordinate( trig->GetCos( angle ) * acceleration * Timer::GetDelta(), -1 * trig->GetSin( angle ) * acceleration * Timer::GetDelta() ); momentum.EnforceMagnitude(speed); SetMomentum( momentum ); status.isAccelerating = true; // Play engine sound float engvol = OPTION(float,"options/sound/engines"); Coordinate offset = GetWorldPosition() - Camera::Instance()->GetFocusCoordinate(); if ( this->GetDrawOrder() == DRAW_ORDER_SHIP ) engvol = engvol * NON_PLAYER_SOUND_RATIO ; this->engine->GetSound()->SetVolume( engvol ); this->engine->GetSound()->PlayNoRestart( offset );}
开发者ID:markettwp,项目名称:Epiar,代码行数:27,
示例5: switchvoid EDGE_MODULE::Flip(const wxPoint& aCentre ){ wxPoint pt; switch( GetShape() ) { case S_ARC: SetAngle( -GetAngle() ); //Fall through default: case S_SEGMENT: pt = GetStart(); pt.y -= aCentre.y; pt.y = -pt.y; pt.y += aCentre.y; SetStart( pt ); pt = GetEnd(); pt.y -= aCentre.y; pt.y = -pt.y; pt.y += aCentre.y; SetEnd( pt ); NEGATE( m_Start0.y ); NEGATE( m_End0.y ); break; case S_POLYGON: // polygon corners coordinates are always relative to the // footprint position, orientation 0 for( unsigned ii = 0; ii < m_PolyPoints.size(); ii++ ) NEGATE( m_PolyPoints[ii].y ); } SetLayer( FlipLayer( GetLayer() ) );}
开发者ID:LDavis4559,项目名称:kicad-source-mirror,代码行数:36,
示例6: assertstd::stringSimbox::getStormHeader(int cubetype, int nx, int ny, int nz, bool flat, bool ascii) const{ if(flat == false) assert(topName_ != ""); std::string header; if(ascii == false) header = "storm_petro_binary/n"; else header = "storm_petro_ascii/n"; header += "0 "+NRLib::ToString(cubetype) +" "+ NRLib::ToString(RMISSING,6)+"/n"; header += "FFTGrid/n"; if(flat == false) header += NRLib::ToString(GetXMin(),6) +" "+ NRLib::ToString(GetLX(),6) +" "+ NRLib::ToString(GetYMin(),6) +" "+ NRLib::ToString(GetLY(),6) +" "+ topName_ +" "+ botName_ +" 0.0 0.0/n"; else header += NRLib::ToString(GetXMin(),6) +" "+ NRLib::ToString(GetLX(),6) +" "+ NRLib::ToString(GetYMin(),6) +" "+ NRLib::ToString(GetLY(),6) +" 0.0 "+ NRLib::ToString(GetLZ(),6)+" 0.0 0.0/n"; header += NRLib::ToString(GetLZ(),6) +" "+ NRLib::ToString(GetAngle()*180/NRLib::Pi,6)+"/n/n"; header += NRLib::ToString(nx) +" "+ NRLib::ToString(ny) +" "+ NRLib::ToString(nz)+"/n"; std::string strHeader(header); return(strHeader);}
开发者ID:CRAVA,项目名称:crava,代码行数:24,
示例7: GetAnglevoid ribi::QtPathArrowItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *){ painter->setRenderHint(QPainter::Antialiasing); if (this->isSelected() || this->hasFocus()) { painter->setPen(m_focus_pen); } else { painter->setPen(m_pen); } { //Draw the lines painter->drawLine(m_tail_pos,m_mid_pos[0]); const std::size_t max = m_mid_pos.size() - 1; //-1, because the line goes to the next index for (std::size_t i = 0; i!= max; ++i) { painter->drawLine(m_mid_pos[i],m_mid_pos[i+1]); } painter->drawLine(m_mid_pos[ m_mid_pos.size() - 1 ],m_head_pos); } const double sz = 10.0; //pixels if (m_tail) { const double pi = boost::math::constants::pi<double>(); const double dx = m_mid_pos[0].x() - m_tail_pos.x(); const double dy = m_mid_pos[0].y() - m_tail_pos.y(); double angle = GetAngle(dx,dy); if (dy >= 0.0) angle = (1.0 * pi) + angle; //const QPointF m_tail_pos(m_tail_x,m_tail_y); const QPointF p1 = m_tail_pos + QPointF( std::sin(angle + pi + (pi * 0.1)) * sz, -std::cos(angle + pi + (pi * 0.1)) * sz); const QPointF p2 = m_tail_pos + QPointF( std::sin(angle + pi - (pi * 0.1)) * sz, -std::cos(angle + pi - (pi * 0.1)) * sz); painter->drawPolygon(QPolygonF() << m_tail_pos << p1 << p2); } if (m_head) { const double pi = boost::math::constants::pi<double>(); const double dx = m_head_pos.x() - m_mid_pos[m_mid_pos.size() - 1].x(); const double dy = m_head_pos.y() - m_mid_pos[m_mid_pos.size() - 1].y(); double angle = GetAngle(dx,dy); if (dy >= 0.0) angle = (1.0 * pi) + angle; const QPointF p1 = m_head_pos + QPointF( std::sin(angle + 0.0 + (pi * 0.1)) * sz, -std::cos(angle + 0.0 + (pi * 0.1)) * sz); const QPointF p2 = m_head_pos + QPointF( std::sin(angle + 0.0 - (pi * 0.1)) * sz, -std::cos(angle + 0.0 - (pi * 0.1)) * sz); painter->drawPolygon(QPolygonF() << m_head_pos << p1 << p2); }}
开发者ID:RLED,项目名称:ProjectRichelBilderbeek,代码行数:61,
示例8: WinMain//.........这里部分代码省略......... { multiplier = 5.0f; } if(Length(acceleration) > 0) { acceleration = Normalize(acceleration) * multiplier; } } acceleration = acceleration - (entity->velocity * 0.05f); Vector2 new_velocity = (acceleration * timestep) + entity->velocity; Vector2 new_position = (acceleration * 0.5f * timestep * timestep) + (new_velocity * timestep) + GetCenter(entity->bounds); Rect2 collision_box = RectPosSize(new_position.x, new_position.y, GetWidth(entity->bounds), GetHeight(entity->bounds)); bool intersects = false; for(int j = 0; j < entities.count; j++) { if(j != i) { Entity *other_entity = entities.entities + j; intersects = intersects || Intersect(other_entity->bounds, collision_box); } } if(!intersects) { entity->velocity = new_velocity; entity->bounds = RectPosSize(new_position.x, new_position.y, GetWidth(entity->bounds), GetHeight(entity->bounds)); } else { entity->velocity = V2(0, 0); } switch(entity->type) { case EntityType_Box: { DrawRectangle(entity->bounds.min.x, entity->bounds.min.y, GetWidth(entity->bounds), GetHeight(entity->bounds), backbuffer, V4(1.0f, 0.0f, 0.0f, 1.0f)); } break; case EntityType_Player: { float angle = GetAngle(entity->velocity); Direction direction = AngleToDirection(angle); Vector4 color = V4(1.0f, 1.0f, 1.0f, 0.0f); if(direction == Direction_Up) { color = V4(1.0f, 0.0f, 0.0f, 1.0f); } else if(direction == Direction_Down) { color = V4(1.0f, 1.0f, 0.0f, 1.0f); } else if(direction == Direction_Left) { color = V4(0.0f, 1.0f, 1.0f, 1.0f); } else if(direction == Direction_Right) { color = V4(0.0f, 1.0f, 0.0f, 1.0f); } char output[255]; sprintf(output, "%f/n", angle); OutputDebugStringA(output); DrawRectangle(300, 300, 10, 10, backbuffer, color); DrawRectangle(entity->bounds.min.x, entity->bounds.min.y, GetWidth(entity->bounds), GetHeight(entity->bounds), backbuffer, intersects ? V4(0.5f, 0.0f, 0.0f, 0.5f) : V4(0.5f, 0.5f, 0.5f, 0.5f)); DrawBitmap(entity->bounds.min.x, entity->bounds.min.y, GetWidth(entity->bounds), GetHeight(entity->bounds), backbuffer, player_head); } break; } } } StretchDIBits(window_context, 0, 0, backbuffer.width, backbuffer.height, 0, 0, backbuffer.width, backbuffer.height, backbuffer.pixels, &bitmap_info, DIB_RGB_COLORS, SRCCOPY); } return 0;}
开发者ID:ChevDaBeastt,项目名称:CN-GAME-DEV,代码行数:101,
示例9: GetAnglebool Shooter::IsAtAngle(){ bool ontarget=angle_pid->OnTarget(); GetAngle(); return ontarget;}
开发者ID:FRCTeam159,项目名称:MentorRepository,代码行数:5,
|