/*
Astronomy Engine for C/C++.
https://github.com/cosinekitty/astronomy
MIT License
Copyright (c) 2019-2020 Don Cross <cosinekitty@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <math.h>
#include "astronomy.h"
#ifdef __cplusplus
extern "C" {
#endif
/** @cond DOXYGEN_SKIP */
#define PI 3.14159265358979323846
typedef struct
{
double x;
double y;
double z;
}
terse_vector_t;
static const terse_vector_t VecZero;
static terse_vector_t VecAdd(terse_vector_t a, terse_vector_t b)
{
terse_vector_t c;
c.x = a.x + b.x;
c.y = a.y + b.y;
c.z = a.z + b.z;
return c;
}
static terse_vector_t VecSub(terse_vector_t a, terse_vector_t b)
{
terse_vector_t c;
c.x = a.x - b.x;
c.y = a.y - b.y;
c.z = a.z - b.z;
return c;
}
static void VecIncr(terse_vector_t *target, terse_vector_t source)
{
target->x += source.x;
target->y += source.y;
target->z += source.z;
}
static void VecDecr(terse_vector_t *target, terse_vector_t source)
{
target->x -= source.x;
target->y -= source.y;
target->z -= source.z;
}
static terse_vector_t VecMul(double s, terse_vector_t v)
{
terse_vector_t p;
p.x = s * v.x;
p.y = s * v.y;
p.z = s * v.z;
return p;
}
static void VecScale(terse_vector_t *target, double scalar)
{
target->x *= scalar;
target->y *= scalar;
target->z *= scalar;
}
static terse_vector_t VecRamp(terse_vector_t a, terse_vector_t b, double ramp)
{
terse_vector_t c;
c.x = (1-ramp)*a.x + ramp*b.x;
c.y = (1-ramp)*a.y + ramp*b.y;
c.z = (1-ramp)*a.z + ramp*b.z;
return c;
}
static terse_vector_t VecMean(terse_vector_t a, terse_vector_t b)
{
terse_vector_t c;
c.x = (a.x + b.x) / 2;
c.y = (a.y + b.y) / 2;
c.z = (a.z + b.z) / 2;
return c;
}
static astro_vector_t PublicVec(astro_time_t time, terse_vector_t terse)
{
astro_vector_t vector;
vector.status = ASTRO_SUCCESS;
vector.t = time;
vector.x = terse.x;
vector.y = terse.y;
vector.z = terse.z;
return vector;
}
typedef struct
{
double tt; /* Terrestrial Time in J2000 days */
terse_vector_t r; /* position [au] */
terse_vector_t v; /* velocity [au/day] */
}
body_state_t;
/** @endcond */
static const double DAYS_PER_TROPICAL_YEAR = 365.24217;
static const double DEG2RAD = 0.017453292519943296;
static const double RAD2DEG = 57.295779513082321;
static const double ASEC360 = 1296000.0;
static const double ASEC2RAD = 4.848136811095359935899141e-6;
static const double PI2 = 2.0 * PI;
static const double ARC = 3600.0 * 180.0 / PI; /* arcseconds per radian */
static const double C_AUDAY = 173.1446326846693; /* speed of light in AU/day */
static const double KM_PER_AU = 1.4959787069098932e+8;
static const double SECONDS_PER_DAY = 24.0 * 3600.0;
static const double SOLAR_DAYS_PER_SIDEREAL_DAY = 0.9972695717592592;
static const double MEAN_SYNODIC_MONTH = 29.530588; /* average number of days for Moon to return to the same phase */
static const double EARTH_ORBITAL_PERIOD = 365.256;
static const double NEPTUNE_ORBITAL_PERIOD = 60189.0;
static const double REFRACTION_NEAR_HORIZON = 34.0 / 60.0; /* degrees of refractive "lift" seen for objects near horizon */
static const double SUN_RADIUS_KM = 695700.0;
#define SUN_RADIUS_AU (SUN_RADIUS_KM / KM_PER_AU)
#define EARTH_FLATTENING 0.996647180302104
#define EARTH_EQUATORIAL_RADIUS_KM 6378.1366
#define EARTH_EQUATORIAL_RADIUS_AU (EARTH_EQUATORIAL_RADIUS_KM / KM_PER_AU)
#define EARTH_MEAN_RADIUS_KM 6371.0 /* mean radius of the Earth's geoid, without atmosphere */
#define EARTH_ATMOSPHERE_KM 88.0 /* effective atmosphere thickness for lunar eclipses */
#define EARTH_ECLIPSE_RADIUS_KM (EARTH_MEAN_RADIUS_KM + EARTH_ATMOSPHERE_KM)
/* Note: if we ever need Earth's polar radius, it is (EARTH_FLATTENING * EARTH_EQUATORIAL_RADIUS_KM) */
#define MOON_EQUATORIAL_RADIUS_KM 1738.1
#define MOON_MEAN_RADIUS_KM 1737.4
#define MOON_POLAR_RADIUS_KM 1736.0
#define MOON_EQUATORIAL_RADIUS_AU (MOON_EQUATORIAL_RADIUS_KM / KM_PER_AU)
static const double ASEC180 = 180.0 * 60.0 * 60.0; /* arcseconds per 180 degrees (or pi radians) */
static const double EARTH_MOON_MASS_RATIO = 81.30056;
/*
Masses of the Sun and outer planets, used for:
(1) Calculating the Solar System Barycenter
(2) Integrating the movement of Pluto
https://web.archive.org/web/20120220062549/http://iau-comm4.jpl.nasa.gov/de405iom/de405iom.pdf
Page 10 in the above document describes the constants used in the DE405 ephemeris.
The following are G*M values (gravity constant * mass) in [au^3 / day^2].
This side-steps issues of not knowing the exact values of G and masses M[i];
the products GM[i] are known extremely accurately.
*/
static const double SUN_GM = 0.2959122082855911e-03;
static const double JUPITER_GM = 0.2825345909524226e-06;
static const double SATURN_GM = 0.8459715185680659e-07;
static const double URANUS_GM = 0.1292024916781969e-07;
static const double NEPTUNE_GM = 0.1524358900784276e-07;
/** @cond DOXYGEN_SKIP */
#define ARRAYSIZE(x) (sizeof(x) / sizeof(x[0]))
#define AU_PER_PARSEC (ASEC180 / PI) /* exact definition of how many AU = one parsec */
#define Y2000_IN_MJD (T0 - MJD_BASIS)
/** @endcond */
static astro_ecliptic_t RotateEquatorialToEcliptic(const double pos[3], double obliq_radians);
static int QuadInterp(
double tm, double dt, double fa, double fm, double fb,
double *x, double *t, double *df_dt);
static double LongitudeOffset(double diff)
{
double offset = diff;
while (offset <= -180.0)
offset += 360.0;
while (offset > 180.0)
offset -= 360.0;
return offset;
}
static double NormalizeLongitude(double lon)
{
while (lon < 0.0)
lon += 360.0;
while (lon >= 360.0)
lon -= 360.0;
return lon;
}
/**
* @brief Calculates the length of the given vector.
*
* Calculates the non-negative length of the given vector.
* The length is expressed in the same units as the vector's components,
* usually astronomical units (AU).
*
* @param vector The vector whose length is to be calculated.
* @return The length of the vector.
*/
double Astronomy_VectorLength(astro_vector_t vector)
{
return sqrt(vector.x*vector.x + vector.y*vector.y + vector.z*vector.z);
}
/**
* @brief Finds the name of a celestial body.
* @param body The celestial body whose name is to be found.
* @return The English-language name of the celestial body, or "" if the body is not valid.
*/
const char *Astronomy_BodyName(astro_body_t body)
{
switch (body)
{
case BODY_MERCURY: return "Mercury";
case BODY_VENUS: return "Venus";
case BODY_EARTH: return "Earth";
case B
没有合适的资源?快使用搜索试试~ 我知道了~
mixly图形编程库 tft-eSPI库 FastLED 图片解码TJpg-Decoder库,tft-eSPI sprite精灵
共1836个文件
h:834个
ino:400个
png:238个
需积分: 5 33 下载量 134 浏览量
2023-08-07
13:50:02
上传
评论 4
收藏 14.04MB ZIP 举报
温馨提示
2023.8.7 更新新增 tft_eSPI库函数图形编程库,图片解码TJpg_Decoder库,tft_eSPI sprite精灵库 全部一体。 FastLED 库 LittleFS库 光敏电阻LDR库 EEPROM库 可支持米思齐 mixly 1.20 1.25 mixly2.0 版 ili9431 TFT 显示屏的 ESP32 引脚配置如下: | TFT ili9431 | ESP32 | | :-: | :-: | | VCC | 3.3V | | GND | GND | | CS | 15 | | RESET | 2 | | RS/DC | 4 | | MOSI | 23 | | CLK | 18 | | LED | 3.3V 或 5V | 如果您的显示屏采用其他芯片或型号,请参考其对应的数据手册和示例代码来进行引脚配置。 ILI9431 TFT_ESPI ESP8266引脚定义: 1. SCL——D5(GPIO14) 2. SDA——D7(GPIO13) 3. CS——D0(GPIO16) 有问题可留言。 https://blog.csdn.net/lnwqh
资源推荐
资源详情
资源评论
收起资源包目录
mixly图形编程库 tft-eSPI库 FastLED 图片解码TJpg-Decoder库,tft-eSPI sprite精灵 (1836个子文件)
parrot.bmp 60KB
parrot.bmp 60KB
TestCard.bmp 46KB
TestCard.bmp 46KB
Tiger.bmp 41KB
Tiger.bmp 41KB
star.bmp 13KB
star.bmp 13KB
astronomy.c 337KB
astronomy.c 337KB
star.c 78KB
star.c 78KB
tjpgd.c 42KB
tjpgd.c 42KB
Font32rle.c 35KB
Font32rle.c 35KB
TFT_eSPI_ESP32_C3.c 30KB
TFT_eSPI_ESP32_C3.c 30KB
TFT_eSPI_ESP32_S3.c 30KB
TFT_eSPI_ESP32_S3.c 30KB
TFT_eSPI_ESP32.c 29KB
TFT_eSPI_ESP32.c 29KB
Font16.c 28KB
Font16.c 28KB
TFT_eSPI_STM32.c 27KB
TFT_eSPI_STM32.c 27KB
TFT_eSPI_RP2040.c 25KB
TFT_eSPI_RP2040.c 25KB
Font72rle.c 16KB
Font72rle.c 16KB
Font72x53rle.c 16KB
Font72x53rle.c 16KB
TFT_eSPI_ESP8266.c 13KB
TFT_eSPI_ESP8266.c 13KB
Font64rle.c 12KB
Font64rle.c 12KB
Font7srle.c 11KB
Font7srle.c 11KB
TFT_eSPI_Generic.c 10KB
TFT_eSPI_Generic.c 10KB
fontconvert.c 9KB
fontconvert.c 9KB
glcdfont.c 8KB
glcdfont.c 8KB
glcdfont.c 8KB
glcdfont.c 8KB
gamma.c 1KB
gamma.c 1KB
gamma.c 1KB
gamma.c 1KB
COPYING 39KB
COPYING 39KB
COPYING 39KB
COPYING 39KB
TFT_eSPI.cpp 189KB
TFT_eSPI.cpp 189KB
Sprite.cpp 79KB
Sprite.cpp 79KB
starImage.cpp 77KB
starImage.cpp 77KB
Adafruit_GFX.cpp 42KB
Adafruit_GFX.cpp 42KB
colorutils.cpp 33KB
colorutils.cpp 33KB
NTPClientLib.cpp 26KB
NTPClientLib.cpp 26KB
noise.cpp 23KB
noise.cpp 23KB
hsv2rgb.cpp 23KB
hsv2rgb.cpp 23KB
Smooth_font.cpp 19KB
Smooth_font.cpp 19KB
TJpg_Decoder.cpp 17KB
TJpg_Decoder.cpp 17KB
Touch.cpp 13KB
Touch.cpp 13KB
Adafruit_SPIDevice.cpp 12KB
Adafruit_SPIDevice.cpp 12KB
Framebuffer_GFX.cpp 10KB
Framebuffer_GFX.cpp 10KB
Adafruit_BusIO_Register.cpp 10KB
Adafruit_BusIO_Register.cpp 10KB
Adafruit_SPITFT.cpp 9KB
Adafruit_SPITFT.cpp 9KB
FastLED_NeoMatrix.cpp 8KB
FastLED_NeoMatrix.cpp 8KB
Adafruit_I2CDevice.cpp 7KB
Adafruit_I2CDevice.cpp 7KB
wiring.cpp 7KB
wiring.cpp 7KB
lib8tion.cpp 6KB
lib8tion.cpp 6KB
FastLED.cpp 6KB
FastLED.cpp 6KB
power_mgt.cpp 6KB
power_mgt.cpp 6KB
colorpalettes.cpp 4KB
colorpalettes.cpp 4KB
Button.cpp 3KB
Button.cpp 3KB
共 1836 条
- 1
- 2
- 3
- 4
- 5
- 6
- 19
资源评论
琢磨侠
- 粉丝: 157
- 资源: 29
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功