本文整理汇总了C++中Star::setY方法的典型用法代码示例。如果您正苦于以下问题:C++ Star::setY方法的具体用法?C++ Star::setY怎么用?C++ Star::setY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Star
的用法示例。
在下文中一共展示了Star::setY方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createStars
void CreateBetweenStarsDlg::createStars() {
StarWidgetItem* swiFrom = (StarWidgetItem *)ui->lstFrom->currentItem();
StarWidgetItem* swiTo = (StarWidgetItem *)ui->lstTo->currentItem();
double x1 = swiFrom->star()->x();
double y1 = swiFrom->star()->y();
double z1 = swiFrom->star()->z();
double x2 = swiTo->star()->x();
double y2 = swiTo->star()->y();
double z2 = swiTo->star()->z();
double s = (double)ui->spinBox->value()+1.0;
double dx = (x2-x1)/s;
double dy = (y2-y1)/s;
double dz = (z2-z1)/s;
_stars.clear();
for (int h = 0; h < ui->spinBox->value(); h++ ) {
double nx = (dx*h)+ (dx+ (SSGX::floatRand()*0.5*dx)-(0.25*dx));
double ny = (dy*h)+ (dy+ (SSGX::floatRand()*0.5*dy)-(0.25*dx));
double nz = (dz*h)+ (dz+ (SSGX::floatRand()*0.5*dz)-(0.25*dz));
Star *s = new Star();
s->setX(x1+nx); s->setY(y1+ny); s->setZ(z1+nz);
s->starName = Onomastikon::instancePtr()->nomen();
s->setStarFullType(StarCodeHelper::createStarCode());
_stars.append(s);
}
}
示例2: createStar
Star* CreateNewStarDlg::createStar() {
Star *res = 0;
if (ui->txtStarType->validator()->Acceptable &&
ui->txtZ->validator()->Acceptable &&
ui->txtY->validator()->Acceptable &&
ui->txtX->validator()->Acceptable &&
!ui->txtStarName->text().isEmpty())
{
res = new Star();
res->starName = ui->txtStarName->text();
res->setX(ui->txtX->text().toDouble());
res->setY(ui->txtY->text().toDouble());
res->setZ(ui->txtZ->text().toDouble());
res->setStarFullType(ui->txtStarType->text());
}
return res;
}
示例3: createRandomMap
void StarList::createRandomMap(double radius = 50, double density = 750)
{
double dFactor = radius/50;
dFactor = pow(dFactor, 3);
int starCount = (int)(1000 * dFactor) + SSGX::d100()-SSGX::d100();
Onomastikon* names = Onomastikon::instancePtr();
Star *starToDelete;
foreach (starToDelete,_stars)
delete starToDelete;
_stars.clear();
Star *newStar = 0;
for (int idx = 0; idx < starCount; idx++)
{
newStar = new Star(radius);
int die = SSGX::d10();
if (die < 3)
newStar->starName = names->greekName();
else if (die >=3 && die <= 8)
newStar->starName = names->sigla();
else {
QString nomen;
do {
nomen = names->pseudoNomen()+"'s star";
} while (nomen.length() == 0);
newStar->starName = nomen;
}
_stars.append(newStar);
if (idx == 0) {
newStar->starName = "(CORE) "+newStar->starName;
newStar->setX(0);
newStar->setY(0);
newStar->setZ(0);
newStar->setStarFullType("G2V");
newStar->setReference();
}
}
}