当前位置: 首页>>代码示例>>C++>>正文


C++ Star::setStarFullType方法代码示例

本文整理汇总了C++中Star::setStarFullType方法的典型用法代码示例。如果您正苦于以下问题:C++ Star::setStarFullType方法的具体用法?C++ Star::setStarFullType怎么用?C++ Star::setStarFullType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Star的用法示例。


在下文中一共展示了Star::setStarFullType方法的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);
    }

}
开发者ID:,项目名称:,代码行数:31,代码来源:

示例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;
}
开发者ID:,项目名称:,代码行数:17,代码来源:

示例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();
        }
    }
}
开发者ID:,项目名称:,代码行数:40,代码来源:


注:本文中的Star::setStarFullType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。