本文整理汇总了C++中setAngle函数的典型用法代码示例。如果您正苦于以下问题:C++ setAngle函数的具体用法?C++ setAngle怎么用?C++ setAngle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setAngle函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: setAngle
inline Angle::Angle (double a ,bool israd)
{
if(israd)
setAngle (a);
else
setAngle(a*DEGREE2RADIAN_CONSTANT);
}
开发者ID:mshicom,项目名称:nubot_ws,代码行数:7,代码来源:Angle.hpp
示例2: shootGun
void shootGun ()
{
// Calibration values for location of gun (in m) with respect to center of LIDAR sensor.
float x_offset = 0;
float y_offset = 0;
int angle;
//align shooter with object
if(angle < 90) {
pc.printf("IF\r\n");
angle = (int) (180.0/3.14159*atan((yball +y_offset)/(xball + x_offset))) - currentAngle;
} else {
pc.printf("ELSE\r\n");
angle = (int) (180.0/3.14159*atan((yball +y_offset)/(xball + x_offset)));
}
if(xball>0) {
angle = angle -30;
} else {
angle = angle + 30;
}
setAngle(-angle, 1);
pc.printf("Angle: %d\r\n", angle);
//Shoot code here
//return back to 0 angle position
setAngle(angle, 0.5);
}
开发者ID:RyanNaughton,项目名称:seas_ese350_neato_hacking,代码行数:28,代码来源:main.cpp
示例3: setAngle
void nTransformable::setForward(nVec3 forward) {
forward.normalize();
if(forward.z() > 0.99999) {
setAngle(nQuaternion::fromEuler(nVec3(0, 90, 0)));
} else {
float a = acos(forward.x());
nVec3 axis = nVec3(0, -forward.z(), forward.y()).normalized() * sin(a / 2);
setAngle(nQuaternion(axis.x(), axis.y(), axis.z(), cos(a / 2)));
}
}
开发者ID:gan74,项目名称:nGine2,代码行数:10,代码来源:nTransformable.cpp
示例4: turnTurtleRightTest
void turnTurtleRightTest() {
enterSuite("Turning Turtle ClockWise");
setAngle(0);
testVal((int) turnTurtleRight(90),90,"Valid: Turning turtle facing 0 degrees clockwise 90 degrees",EQUALS);
testVal((int) turnTurtleRight(360),90,"Valid: Turning turtle facing 90 degrees clockwise 360 degrees",EQUALS);
testVal((int) turnTurtleRight(270),0,"Valid: Turning turtle facing 90 degrees clockwise 270 degrees",EQUALS);
setAngle(330);
testVal((int) turnTurtleRight(100),70,"Valid: Turning turtle facing 330 degrees clockwise 100 degrees",EQUALS);
initTurtle();
leaveSuite();
}
开发者ID:benClar,项目名称:COMS1201,代码行数:12,代码来源:turtle.c
示例5: addChild
bool Aimer::init(bool isRight, float upper, float lower)
{
_back = Sprite::create("aimerback.png");
addChild(_back);
//const Point mid(getContentSize()/2);
_pointer = Sprite::create("pointer.png");
_pointer->setAnchorPoint(Point::ANCHOR_MIDDLE_LEFT);
//_pointer->setPosition(mid);
_pointer->setScaleY(0.5);
_pointer->setOpacity(200);
_green = ProgressTimer::create(Sprite::create("aimergreen.png"));
//_green->setPosition(mid);
_green->setType(ProgressTimer::Type::RADIAL);
_green->setOpacity(150);
_crosshair=Sprite::create("crosshair.png");
addChild(_crosshair);
addChild(_green);
addChild(_pointer);
upperLimit = upper;
lowerLimit = lower;
reversed = !isRight;
//find out the percentage
if(!isRight)
setAngle((upperLimit+lowerLimit)/2);
else{
setAngle(-180-((upperLimit+lowerLimit)/2));
}
_green->setPercentage((lowerLimit-upperLimit)/3.6);
//_green->setRotation(-upperLimit);
auto listener = EventListenerTouchOneByOne::create();
listener->onTouchBegan = CC_CALLBACK_2(Aimer::onTouchBegan, this);
listener->onTouchEnded = CC_CALLBACK_2(Aimer::onTouchEnded, this);
listener->onTouchMoved = CC_CALLBACK_2(Aimer::onTouchMoved, this);
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
listener->setSwallowTouches(true);
_back->setRotation((upperLimit+lowerLimit)/2);
return true;
}
开发者ID:calfjohn,项目名称:TankMultiplayer,代码行数:51,代码来源:Aimer.cpp
示例6: setShapeM
void OblatedEqArea::_loadFromParams()
{
Projection::_loadFromParams();
setShapeM(m_gctpParams[2]);
setShapeN(m_gctpParams[3]);
setAngle(m_gctpParams[8]);
}
开发者ID:bpass,项目名称:prasterblaster,代码行数:7,代码来源:oblatedeqarea.cpp
示例7: servo
void servo(int angle,int pin){
pin3 = 3;
pin9 = 9;
init(pin3, pin9, MIN_PULSE_WIDTH, MAX_PULSE_WIDTH,
DEFAULT_WAIT_DISABLE_PWM);
setAngle(angle,pin);
}
开发者ID:Liwsh,项目名称:Robot,代码行数:7,代码来源:servo.c
示例8: setScale
void NumberAnimation::setParametr(const std::string & _param, double _value)
{
m_currentParam = _param;
if (_param == "scale")
{
m_params[_param] = _value;
setScale();
}
else if (_param == "angle")
{
m_params[_param] = _value;
setAngle();
}
else if (_param == "alpha")
{
m_params[_param] = _value;
setAlpha();
}
else if (_param == "width")
{
m_params[_param] = _value;
setWidth();
}
else if (_param == "height")
{
m_params[_param] = _value;
setHeight();
}
else
{
m_currentParam = "";
}
}
开发者ID:KyryloBR,项目名称:SDLEngine,代码行数:33,代码来源:NumberAnimation.cpp
示例9: IString
/**
* Set the latitude given a value in the Planetographic coordinate system
*
* @param latitude The planetographic latitude to set ourselves to
* @param units The angular units latitude is in
*/
void Latitude::setPlanetographic(double latitude, Angle::Units units) {
if (m_equatorialRadius == NULL || m_polarRadius == NULL) {
IString msg = "Latitude [" + IString(latitude) + "] cannot be "
"converted to Planetocentic without the planetary radii, please use "
"the other Latitude constructor";
throw IException(IException::Programmer, msg, _FILEINFO_);
}
Angle inputAngle(latitude, units);
if (inputAngle > Angle(90.0, Angle::Degrees) ||
inputAngle < Angle(-90.0, Angle::Degrees)) {
IString msg = "Latitudes outside of the -90/90 range cannot be converted "
"between Planetographic and Planetocentric";
throw IException(IException::Programmer, msg, _FILEINFO_);
}
if(IsSpecial(latitude)) {
IString msg = "Invalid planetographic latitudes are not currently "
"supported";
throw IException(IException::Programmer, msg, _FILEINFO_);
}
double ocentricLatitude = atan(tan(inputAngle.radians()) *
(*m_polarRadius / *m_equatorialRadius) *
(*m_polarRadius / *m_equatorialRadius));
// Sometimes the trig functions return the negative of the expected value at the pole.
if ((ocentricLatitude > 0) != (inputAngle.radians() > 0)) {
ocentricLatitude *= -1;
}
setAngle(ocentricLatitude, Angle::Radians);
}
开发者ID:jlaura,项目名称:isis3,代码行数:40,代码来源:Latitude.cpp
示例10: getRotateMatrix_1
void WGraphicsRectItem::mouseReleaseEvent(WGraphicsSceneMouseEvent* event)
{
if (isSelected() && (event->button() == Ws::LeftButton) && _dragging)
{
_dragging = false;
WWorldPointF pos = event->scenePos();
WMatrix matrix = getRotateMatrix_1(); //获取逆向矩阵
if (_select_flag != SF_ROTATE) //矩形不是在旋转
{
if (_select_flag != SF_CONTENT || isMovable())
{
const int (&f)[4] = ADJUST_TABLE[bit(_select_flag)];
WWorldPointF offset = pos - scene()->dragStartPos();
WWorldRectF rect = data()->rect.adjusted(offset.x() * f[0], offset.y() * f[1], offset.x() * f[2], offset.y() * f[3]);
setRect(rect, false, true);
}
}
else //矩形在旋转
{
WWorldPointF c = data()->rect.center();
double ag = WWorldLineF(c, pos).angle() - 90;
setAngle(data()->angle + ag, false, true);
}
scene()->update();
}
}
开发者ID:tecentwenping,项目名称:Controller_Atcsim,代码行数:30,代码来源:wgraphicsrectitem.cpp
示例11: controller
BossBall::BossBall(GameController &controller):
controller(controller)
{
setData(GD_type, GO_BossBall);
pixMap.load("://images/BossBall1.png");
setAngle(0);
}
开发者ID:kun368,项目名称:PlaneWar,代码行数:7,代码来源:bossball.cpp
示例12: setLeftTopCorner
void Munizione::onTick()
{
MyAllegro* m =dynamic_cast<MyAllegro*>(MyAllegro::getInstance());
if(tick%m->getSpeed()==0)
{
if(checkColpito())
{
hit=false;
}
else
{
if(direzione == DESTRA)
posizioneX+=velocita;
else
posizioneX-=velocita;
angle += velocitaRotazione;
setLeftTopCorner(Point(posizioneX-getWidth()/2,posizioneY-getHeight()/2));
setAngle(angle);
}
}
}
开发者ID:Ocram83,项目名称:weddingGame,代码行数:25,代码来源:Munizione.cpp
示例13: setX
Astroid::Astroid(float x, float y) {
setX(x);
setY(y);
setWidth(kWidth);
setHeight(kHeight);
setAngle(rand() % 360);
}
开发者ID:johnmurcko,项目名称:CraigsWorld,代码行数:7,代码来源:Astroid.cpp
示例14: setAngle
void Explore::publishPose(float x, float y, float theta, bool robot){
move_base_msgs::MoveBaseGoal goal;
goal.target_pose.pose.position.x = x;
goal.target_pose.pose.position.y = y;
geometry_msgs::Quaternion qMsg;
setAngle(theta, qMsg);
goal.target_pose.pose.orientation = qMsg;
goal.target_pose.header.stamp = ros::Time::now();
if(robot)
{
goal.target_pose.header.frame_id ="/base_link";
} else {
goal.target_pose.header.frame_id ="/map";
}
ROS_INFO("Sending goal...");
ac_.sendGoalAndWait(goal,ros::Duration(TIME_FOR_GOAL),ros::Duration(0.1) );
firstGoalSend = true;
}
开发者ID:iarczi,项目名称:elektron_ballcollector,代码行数:25,代码来源:explore.cpp
示例15: turnLeft
double turnLeft( turtle* t, double angle ) {
double new_angle;
new_angle = t->side * angle;
setAngle(t, t->angle - toRadians(new_angle));
}
开发者ID:gpalsingh,项目名称:singhcodes,代码行数:7,代码来源:turtle.c
示例16: CC_RADIANS_TO_DEGREES
void Aimer::onTouchMoved(cocos2d::Touch *touch, cocos2d::Event *event)
{
float a = CC_RADIANS_TO_DEGREES((touch->getLocation()-convertToWorldSpace(getPosition())).getAngle());
setAngle(-a-getParent()->getParent()->getRotation());
}
开发者ID:calfjohn,项目名称:TankMultiplayer,代码行数:7,代码来源:Aimer.cpp
示例17: advanceFrame
void TWRotateMultiSprite::update(Uint32 ticks) {
advanceFrame(ticks);
Vector2f incr = getVelocity() * static_cast<float>(ticks) * 0.001;
setPosition(getPosition() + incr);
setAngle(getAngle() + getAngleInc() );
if ( Y() < 0) {
velocityY( abs( velocityY() ) );
}
if ( Y() > worldHeight-frameHeight) {
velocityY( -abs( velocityY() ) );
}
if ( X() < 0) {
velocityX( abs( velocityX() ) );
flag = true;
}
if ( X() > worldWidth-frameWidth) {
velocityX( -abs( velocityX() ) );
flag = false;
}
}
开发者ID:Kaitlynli,项目名称:light_the_firework,代码行数:26,代码来源:twRotateMultisprite.cpp
示例18: setAngle
void GoToSelectedBall::publishPose(float x, float y){
move_base_msgs::MoveBaseGoal goal;
goal.target_pose.pose.position.x = x;
goal.target_pose.pose.position.y = y;
geometry_msgs::Quaternion qMsg;
setAngle(getRobotAngleInMap(), qMsg);
goal.target_pose.pose.orientation = qMsg;
goal.target_pose.header.stamp = ros::Time::now();
goal.target_pose.header.frame_id ="/odom";
ROS_INFO("Sending goal...");
ac.sendGoal(goal);
firstGoalSent = true;
}
开发者ID:iarczi,项目名称:elektron_ballcollector,代码行数:25,代码来源:go_to_selected_ball.cpp
示例19: p
void PLEN2::JointController::resetSettings()
{
#if DEBUG
volatile Utility::Profiler p(F("JointController::resetSettings()"));
#endif
EEPROM[INIT_FLAG_ADDRESS()] = INIT_FLAG_VALUE();
eeprom_busy_wait();
for (int index = 0; index < sizeof(Shared::m_SETTINGS_INITIAL); index++)
{
EEPROM[SETTINGS_HEAD_ADDRESS() + index] = pgm_read_byte(
reinterpret_cast<const char*>(Shared::m_SETTINGS_INITIAL) + index
);
eeprom_busy_wait();
}
for (char joint_id = 0; joint_id < SUM; joint_id++)
{
m_SETTINGS[joint_id].MIN = pgm_read_word(Shared::m_SETTINGS_INITIAL + joint_id * 3 + 0);
m_SETTINGS[joint_id].MAX = pgm_read_word(Shared::m_SETTINGS_INITIAL + joint_id * 3 + 1);
m_SETTINGS[joint_id].HOME = pgm_read_word(Shared::m_SETTINGS_INITIAL + joint_id * 3 + 2);
setAngle(joint_id, m_SETTINGS[joint_id].HOME);
}
}
开发者ID:Temigo,项目名称:plen-Firmware_Arduino,代码行数:26,代码来源:JointController.cpp
示例20: switch
bool CannonField::qt_invoke( int _id, QUObject* _o )
{
switch ( _id - staticMetaObject()->slotOffset() ) {
case 0:
setAngle((int)static_QUType_int.get(_o+1));
break;
case 1:
setForce((int)static_QUType_int.get(_o+1));
break;
case 2:
shoot();
break;
case 3:
newTarget();
break;
case 4:
setGameOver();
break;
case 5:
restartGame();
break;
case 6:
moveShot();
break;
default:
return QWidget::qt_invoke( _id, _o );
}
return TRUE;
}
开发者ID:satazor,项目名称:univ-aca-mips,代码行数:29,代码来源:moc_cannon.cpp
注:本文中的setAngle函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论