Refactor comments

This commit is contained in:
2022-03-28 10:31:17 +02:00
parent dca869995a
commit fcacaa8657
9 changed files with 152 additions and 88 deletions

View File

@ -2,17 +2,21 @@ import java.awt.*;
public class SpaceDraw {
// Returns the approximate radius of a celestial body with the specified mass.
// (It is assumed that the radius r is related to the mass m of the body by r = m ^ 0.5,
// where m and r measured in solar units.)
/**
* Returns the approximate radius of a celestial body with the specified mass.
* (It is assumed that the radius r is related to the mass m of the body by r = m ^ 0.5,
* where m and r measured in solar units.)
*/
public static double massToRadius(double mass) {
return Simulation.SUN_RADIUS * (Math.pow(mass / Simulation.SUN_MASS, 0.5));
}
// Returns the approximate color of a celestial body with the specified mass. The color of
// the body corresponds to the temperature of the body, assuming the relation of mass and
// temperature of a main sequence star.
/**
* Returns the approximate color of a celestial body with the specified mass. The color of
* the body corresponds to the temperature of the body, assuming the relation of mass and
* temperature of a main sequence star.
*/
public static Color massToColor(double mass) {
Color color;
if (mass < Simulation.SUN_MASS / 10) {
@ -26,7 +30,9 @@ public class SpaceDraw {
return color;
}
// Returns the approximate color of temperature 'kelvin'.
/**
* Returns the approximate color of temperature 'kelvin'.
*/
private static Color kelvinToColor(int kelvin) {
double k = kelvin / 100D;
@ -41,7 +47,9 @@ public class SpaceDraw {
);
}
// A transformation used in the method 'kelvinToColor'.
/**
* A transformation used in the method 'kelvinToColor'.
*/
private static int limitAndDarken(double color, int kelvin) {
int kelvinNorm = kelvin - 373;