本文整理汇总了C++中Coord::getZ方法的典型用法代码示例。如果您正苦于以下问题:C++ Coord::getZ方法的具体用法?C++ Coord::getZ怎么用?C++ Coord::getZ使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Coord
的用法示例。
在下文中一共展示了Coord::getZ方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getAnchor
//=============================================
Coord Glyph::getAnchor(const Coord &nodeCenter, const Coord &from, const Size &scale, const double zRotation) const {
Coord anchor = from - nodeCenter;
if( anchor.getX() == 0.0f && anchor.getY() == 0.0f)
return nodeCenter;
if( scale.getW() == 0.0f || scale.getH() == 0.0f)
return nodeCenter;
if(zRotation!=0) {
//unrotate
Coord saveAnchor(anchor);
double zRot = - 2.0*M_PI * zRotation / 360.0;
anchor[0] = saveAnchor[0]*cos(zRot) - saveAnchor[1]*sin(zRot);
anchor[1] = saveAnchor[0]*sin(zRot) + saveAnchor[1]*cos(zRot);
}
// unscale
anchor.setX( anchor.getX() / scale.getW() );
anchor.setY( anchor.getY() / scale.getH() );
if(scale.getD() != 0.0f)
anchor.setZ( anchor.getZ() / scale.getD() );
else
anchor.setZ(0.0f);
anchor = getAnchor( anchor );
// rescale
anchor.setX( anchor.getX() * scale.getW() );
anchor.setY( anchor.getY() * scale.getH() );
anchor.setZ( anchor.getZ() * scale.getD() );
if(zRotation!=0) {
//rerotate
Coord saveAnchor(anchor);
double zRot = 2.0*M_PI * zRotation / 360.0;
anchor[0] = saveAnchor[0]*cos(zRot) - saveAnchor[1]*sin(zRot);
anchor[1] = saveAnchor[0]*sin(zRot) + saveAnchor[1]*cos(zRot);
}
return nodeCenter + anchor;
}
示例2: printCoord
void printCoord(ostream &os,const Coord &v) {
printFloat(os,"x ",v.getX());
printFloat(os,"y ",v.getY());
printFloat(os,"z ",v.getZ());
}
示例3: setApple
void GameState::setApple(const Coord& coord, bool apple) {
apples[coord.getX()][coord.getY()][coord.getZ()] = apple;
}
示例4: isApple
bool GameState::isApple(const Coord& coord) {
return apples[coord.getX()][coord.getY()][coord.getZ()];
}
示例5: setSnakeTexture
void GameState::setSnakeTexture(const Coord& coord, int texture) {
snakeTextures[coord.getX()][coord.getY()][coord.getZ()] = texture;
}
示例6: getSnakeTexture
int GameState::getSnakeTexture(Coord& coord) {
return snakeTextures[coord.getX()][coord.getY()][coord.getZ()];
}