gregseth / suncalc-php

PHP library for basic astronomical computation (sun and moon rise and set, moon phases, …)
GNU General Public License v2.0
65 stars 20 forks source link

Get shadow length - possible? #19

Closed ibragimof closed 9 months ago

hnccox-yard commented 9 months ago

Wouldn't the length of any shadow be depending on the height of the object? What are you even trying to do?

ibragimof commented 9 months ago

The length of the shadow depends on where the sun is and at what angle its rays hit the object.

If the ratio coefficient of the real length of the object to its real shadow length can be obtained for a one-inch object, it is applicable to all objects regardless of their scale. You can obtain results like "shadow length 50%" (half of the object's real height). I've already implemented this function, by the way.

If something is unclear to you specifically, it doesn't mean that others are fools.

hnccox-yard commented 9 months ago

"The length of the shadow depends on where the sun is and at what angle its rays hit the object."

Correct, but the length from here on would be depending on the height of the object itself. You can use pythagoras theorem for this. You can get the ratio by dividing the length of the shadow with the height of the object.

EDIT: If the object is really high, you need to consider the curvature of the earth

PS: Noone said you are a fool, your question statement is unclear as you didn't provide all the parameters you consider.

ibragimof commented 9 months ago

Are you laughing or genuinely not getting what I'm talking about?! With just 10 lines of code, you can achieve a result where, regardless of the object's height, you get an accurate proportion of its shadow.

For the specific tasks in my work, I don't need to know the height of the object. Moreover, it's not possible considering the various gradations of working objects.

Where does the Pythagorean triangle come into play when I don't have tools to measure height or the angle of inclination?

ibragimof commented 9 months ago

2023-11-27 19-5-1

ibragimof commented 9 months ago

https://www.moonsighting.com/how-we.html

hnccox-yard commented 9 months ago

2023-11-27 19-5-1

Now you are just being rude and retarded. You are literally posting a picture where you give the height of the object to be 67 meters! You need to know the height of the object and the angle of the sun to be able to calculate the length of it's shadow.

To find the lengths of sides A and B in a right-angled triangle given the angle at corner C, you'll need additional information such as the length of side AC (the hypotenuse) or another angle. If you have the length of the hypotenuse and the angle at C, you can use trigonometric functions.

If you set AC to be 1, you can get the ratio to AB

Also, you said LENGTH in your question, not proportion or ratio