"mikaboshi" is a calculation library for Chinese astrology (written in Rust) specifically for Feng-Shui (風水 or 风水). The name "mikaboshi" derives from a Marvel character "Amatsu-Mikaboshi", or one of the goddesses in Shinto myth. "Amatsu-Mikaboshi" (アマツミカボシ), when literally translated, means "the shinning star in the sky".
Supported (Chinese astrological) calculations are:
- 八卦 (Ba-Gua)
- 干支 (Gan-Zhi)
- 九星 (Jiu-Xing)
- 二十四节气 (Er-Shi-Si Jie-Qi)
- 二十四山向 (Er-Shi-Si Shan-Xiang)
- 生死衰旺 (Sheng-Si Shuai-Wang)
This library depends on "sowngwala" for calculating the sun's position. For both "mikaboshi" and "sowngwala" use chrono for managing date & time.
You may have noticed many codes found in samples are that of WASM apps. Yet, it does not mean you need WASM apps. It is just that I happen to have a WASM app using this library, and was easy for me to share the codes...
What Makes The Program Tricky?
So, the library expects you to have
a Feng-Shui board with 9 boxes drawn on a device screen.
1 empty box in the middle surrounded by 8 boxes.
360 divided by 8, makes it 45 degrees for each.
See how it goes when pointing "N" (north):
(When pointing "N")
1st row ‐‐> "NW", "N", and "NE"
2nd row ‐‐> "W", (middle), and "E"
3rd row ‐‐> "SW", "S", and "SE"
However, it gets tricky when device rotates. Say, the device rotates for 45 degrees clockwise. It now points to "NE" (north-east):
(When pointing "NE")
1st row ‐‐> "N", "NE", and "E"
2nd row ‐‐> "NW", (middle), and "SE"
3rd row ‐‐> "W", "SW", and "S"
As you can imagine, when the above is expressed in a Rust program,
we need Vec
and HashMap
, and that is why we have
many Vec
and HashMap
as to map variations
that manifest per compass direction
(usually 8, but sometimes 9 when center is concerned).
This is so, not only for compass directions,
but for Feng-Shui mappings as well.
Whenever we calculate positions for Feng-Shui elements,
the positions are provided in Vec
or HashMap
so that they will have 8 or 9 patterns.
I have a few examples which may, or may not help...
You may:
cargo doc
However, you will probably learn more from the online documentations bellow.
Each page provides general descriptions about what they are,
and also provide some examples.
You can also explore the actual codes for they contain a lot of doc tests.
- Gua
- GuaRaw
- BAGUA_LO_SHU_ORDER_WITH_CENTER
- BAGUA_HE_TU_ORDER_INDEXES
- BAGUA_HE_TU_ORDER
- BAGUA_LO_SHU_ORDER_INDEXES
- BAGUA_LO_SHU_ORDER
- BAGUA_LO_SHU_COMPASS_ORDER_INDEXES
- BAGUA_LO_SHU_COMPASS_ORDER
- get_gua_compass_order
- Stem
- Branch
- StemRawData
- BranchRawData
- GanZhi
- Bazi
- STEMS
- BRANCHES
- GANZHI_SEXAGESIMAL
- HOUR_STEM_TABLE
- Bazi::from_local
- JiuXing
- JiuXingRawData
- XiaGuaTu
- DIRECTION_TO_JIU_XING
- JIU_XING
- JIU_XING_DI_PAN_POSITIONS
- get_jiuxing_dipan_positions_from_direction
- get_jiuxing_from_index
- normalize_jiuxing
- fly_flying_stars
- get_xiaguatu_from_unpan_index
- Direction
- TwentyFourType
- DIRECTIONS
- OPPOSITE_DIRECTION
- DIRECTION_POSITIONS_IN_CHART
- TWENTYFOUR_DIRECTIONS_TO_INDEX
- TWENTYFOUR_INDEX_TO_DIRECTIONS
- TWENTYFOUR_ORDER_START_NORTH
- TWENTYFOUR_SECTORS
- get_direction_positions_in_chart
- get_opposite_direction
- get_twentyfour_data_from_direction
- get_twentyfour_data_from_index
- get_twentyfour_direction_from_degrees
- get_twentyfour_direction_from_direction
- get_twentyfour_direction_from_index
- get_twentyfour_index_from_direction
RUST_BACKTRACE=1 cargo test -vv -- --nocapture
Looking into rustfmt.toml, you see the setting:
format_strings = true
which works only for the Nightly build.
So, you need:
cargo +nightly fmt
There is absolutely no gurantee about the accuracy of the service, information, or calculated results provided by the program, and the author of the program cannot be held responsible in any ways for any adverse consequences. It is solely for entertaniment only, and your use of the service, information, or calculated results is entirely at your own risks, for which the author of the program shall not be liable. It shall be your own responsibility to ensure the service, information, or calculated results meet your specific requirements.
MIT license (LICENSE)