本文整理汇总了C++中Planet::diameter方法的典型用法代码示例。如果您正苦于以下问题:C++ Planet::diameter方法的具体用法?C++ Planet::diameter怎么用?C++ Planet::diameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Planet
的用法示例。
在下文中一共展示了Planet::diameter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setPlanetModifiers
void SolarSystemCreator::setPlanetModifiers(Planet& planet)
{
if (planet.planetType() == ptGasGiant) {
int nSize = SSGX::d6();
if (nSize <4)
planet.setDiameter(planet.diameter()*2);
if (nSize <3)
planet.setDiameter(planet.diameter()*2);
if (nSize <2)
planet.setDiameter(planet.diameter()*2);
if (planet.diameter() < 30000)
planet.setDiameter(15000 +SSGX::d10()*10000+SSGX::dn(5000));
}
if (planet.planetType() == ptGarden) {
int nSize = SSGX::d10() + _nMod;
if ( nSize < 3)
planet.setPlanetType(ptPreGarden);
if ( nSize >=3 && nSize < 6)
planet.setPlanetType(ptGlacier);
if (nSize >= 10)
planet.setPlanetType(ptPostGarden);
}
}
示例2: makeDiameterAndDensity
void SolarSystemCreator::makeDiameterAndDensity(bool isSatellite, Planet& planet, double currentDistance, Planet& planetTop)
{
int d = SSGX::d6();
if (currentDistance > _star->outerLifeZone()) {
if (d < 5) {
planet.setCoreType(NSPlanet::ctIcy);
planet.setDensity( ((double)(SSGX::dn(400)))/1000*5520.0);
if (!isSatellite)
planet.setDiameter(SSGX::icyDiameter());
else
planet.setDiameter(SSGX::satDiameter());
}
else {
if (!isSatellite)
planet.setDiameter(SSGX::rockyDiameter());
else
planet.setDiameter(SSGX::satDiameter());
planet.setDensity( ((double)(400+SSGX::dn(600)))/1000*5520.0);
}
}
else {
if (!isSatellite)
planet.setDiameter(SSGX::rockyDiameter());
else
planet.setDiameter(SSGX::satDiameter());
planet.setDensity( ((double)(400+SSGX::dn(900)))/1000*5520.0);
}
int divFactor = (planetTop.planetType() == ptGasGiant) ? 6 : 3;
while (isSatellite && (planet.diameter() > planetTop.diameter() / divFactor || planet.diameter() > 14000))
planet.setDiameter(planet.diameter()/1.5);
}
示例3: createPlanet
Planet SolarSystemCreator::createPlanet(
double currentDistance,
bool isSatellite,
Planet& planetTop,
double *prevDistance)
{
Planet planet;
if (isSatellite)
planet.setParent(&planetTop);
Orbit orbit;
makeOrbit(orbit);
makeDiameterAndDensity(isSatellite, planet, currentDistance, planetTop);
double dTemp = 255 / sqrt(( currentDistance / sqrt (_star->luminosity())));
planet.setTemperature(dTemp);
double dmmwr = (0.02783 * dTemp) / ( pow(planet.gravEarth(),2) );
planet.setMmwr(dmmwr);
if (dmmwr < 120)
planet.setAtmosphere(atVeryThin);
if (dmmwr < 80)
planet.setAtmosphere(atThin);
if (dmmwr < 40)
planet.setAtmosphere(atStandard);
if (dmmwr < 20)
planet.setAtmosphere(atDense);
if (dmmwr < 5) {
if (planet.diameter() > 20000 )
planet.setAtmosphere(atMassive);
else
planet.setAtmosphere(atDense);
}
this->setPlanetType(planet,currentDistance);
if (!isSatellite) {
this->setPlanetModifiers(planet);
planet.setPlanetFlag();
}
else {
planet.setSatelliteFlag();
//qDebug() << "Satellite flag set: " << planet.isSatellite();
}
if (!isSatellite) {
orbit.setDistance(currentDistance);
orbit.setYear(_star->mass());
}
else {
double sSatDist = *prevDistance;
if (sSatDist <= 0)
if (planetTop.planetType() != ptGasGiant)
sSatDist = 105000+(double)((SSGX::dn(20)+10) * planetTop.diameter());
else
sSatDist = 105000+(double)((SSGX::floatRand()*1.8+2.0) * planetTop.diameter());
else
sSatDist += 80000.0+(double)((SSGX::dn(50)+25) * planet.diameter());
*prevDistance = sSatDist;
orbit.setDistance(sSatDist); //in km
double d1 = orbit.distance() / 40000.0;
d1 = (pow(d1,3) * 793.64) / (planetTop.massEarth() + planet.massEarth());
double dYear = sqrt(d1);
orbit.setFixedYear(dYear);
}
planet.setOrbit(orbit);
int w = rand() % 10;
switch (w) {
case 1:
planet.setName(_onomastikon->fakeNomen());
break;
case 2:
planet.setName(_onomastikon->fakeNomen());
break;
case 3:
planet.setName(_onomastikon->nomen());
break;
case 4:
planet.setName(_onomastikon->nomen());
break;
case 5:
planet.setName(_onomastikon->sigla());
break;
default:
planet.setName(_onomastikon->pseudoNomen());
break;
}
return planet;
}