You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a list of changes that should be made to OrbitingCelestialObject and Planet in order to overhaul lighting and phases.
Absolute Cartesian Coordinates
Returns the coordinates relative to the common body of a system. While TITAN.getRelativeCartesianCoordiantes() seems to give coordinates relative to Saturn, TITAN.getAbsoluteCartesianCoordinates() would give coordinates relative to Sol. This should work recursively for arbitrarily many ancestor objects, to a limit. 3 might be a good limit.
Attributes of OrbitingCelestialObjects available to Planet class for Planet.getUV()
Planet.getUV() needs to know three things: this.getAbsoluteCartesianCoordinates(), observerBody.getAbsoluteCartesianCoordinates(), and lightSource.getAbsoluteCartesianCoordinates().
Example: Titan needs this.getAbsoluteCartesianCoordinates(), EARTH.getAbsoluteCartesianCoordinates(), and SOL.getAbsoluteCartesianCoordinates().
Planet Phase Derived With Triangle Math
Draw a line from the observer to the light source. Draw a line from this to the light source. Do triangle math to determine the angles connecting the three bodies. The angle centered on this will determine phase. 180°±22.5° = full, 0°±22.5° = new, and so forth.
Quoting tehgreatdoge: (using degrees) where point A is the observer, point B is the observed body, and point S is the sun, the angle p of the phase can be obtained via the equation p = 90 - angle(B). angle B can be obtained from sin(angle(S))/ length(AB) = sin(angle(B))/length(AS). which, solving for angle B, is angle(B) = arcsin(sin(angle(S)*length(AS)/length(AB)). angle(S) is equivalent to the difference in phi between A and B. This gives us the final equation p = 90 - arcsin(sin(angle(S)*length(AS)/length(AB)). technically you could avoid the calculation of AS by using BS and angle A instead. this would have the benefit of not needing to calculate the distance of the observer to S in the case of a non- orbiting A or you could change it to be p = 90 - arccos((BS^2 + AB^2 - AS^2)/(2*BS*AB)) which cuts down on the trig operations either way, you also would need to determine which direction the triangle is going i think (two cases)
The text was updated successfully, but these errors were encountered:
2 and 3 is also entirely possible and I don't see a problem. I mean, the sun is always at 0 0 0 coords, that's kinda how solar systems work. the other two coordinates you also have in the form of vievCenterCoords and coords of the object. There is absolutely no information in there you can't already get.
Maybe next time it would be good to consider asking me about this kind of stuff so that I can explain what you can use to get things you need, instead of just assuming there is no way to get them.
It is true, however, that you don't get really easy access and you'd need to do some method overriding to get the effects you need, so I'll just adjust the getUV method in such a way that you can get all the info you need directly from there.
Calved from #5 and elaborated upon.
This is a list of changes that should be made to OrbitingCelestialObject and Planet in order to overhaul lighting and phases.
Returns the coordinates relative to the common body of a system. While TITAN.getRelativeCartesianCoordiantes() seems to give coordinates relative to Saturn, TITAN.getAbsoluteCartesianCoordinates() would give coordinates relative to Sol. This should work recursively for arbitrarily many ancestor objects, to a limit. 3 might be a good limit.
Planet.getUV() needs to know three things: this.getAbsoluteCartesianCoordinates(), observerBody.getAbsoluteCartesianCoordinates(), and lightSource.getAbsoluteCartesianCoordinates().
Example: Titan needs this.getAbsoluteCartesianCoordinates(), EARTH.getAbsoluteCartesianCoordinates(), and SOL.getAbsoluteCartesianCoordinates().
Draw a line from the observer to the light source. Draw a line from this to the light source. Do triangle math to determine the angles connecting the three bodies. The angle centered on this will determine phase. 180°±22.5° = full, 0°±22.5° = new, and so forth.
Quoting tehgreatdoge:
(using degrees) where point A is the observer, point B is the observed body, and point S is the sun, the angle p of the phase can be obtained via the equation p = 90 - angle(B). angle B can be obtained from sin(angle(S))/ length(AB) = sin(angle(B))/length(AS). which, solving for angle B, is angle(B) = arcsin(sin(angle(S)*length(AS)/length(AB)). angle(S) is equivalent to the difference in phi between A and B. This gives us the final equation p = 90 - arcsin(sin(angle(S)*length(AS)/length(AB)). technically you could avoid the calculation of AS by using BS and angle A instead. this would have the benefit of not needing to calculate the distance of the observer to S in the case of a non- orbiting A or you could change it to be p = 90 - arccos((BS^2 + AB^2 - AS^2)/(2*BS*AB)) which cuts down on the trig operations either way, you also would need to determine which direction the triangle is going i think (two cases)
The text was updated successfully, but these errors were encountered: