mikaboshi

screenshot screenshot2

1. About

"mikaboshi" is a Rust library for 風水 (风水) (Feng-Shui) calculations. As such, it provides commonly used calculation logic for basic Chinese astrological concepts such as:

As you may have noticed that sample codes in samples are that of a WASM (WebAssembly) app, it does not always have to be a Rust app when using the library. It is amazing how you could easily link your codes written in Rust to JS apps when provided as a WASM app.

The name "mikaboshi" derives from a Marvel character "Amatsu-Mikaboshi" or one of the goddesses in Shinto. "Amatsu-Mikaboshi" means "The Shinning Star in the Sky" when literally translated, which reminds us of Lucifer in the west.

This library depends on sowngwala for calculating sun's position. It also use some structs from sowngwala, namely, Date, DateTime, Time, and Month with which you need to specify as arguments for some functions. Also, they are re-exported for public use.

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"

tricky device rotation

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.

2. Examples

A few examples which may or may not help...

3. Documentation

You may:

cargo doc

however, you will probably get more from documentations bellow:

八卦 (Bagua)

二十四山向 (Er-Shi-Si Shan-Xiang)

干支 (Gan-Zhi)

九星 (Jiu-Xing)

生死衰旺 (Sheng-Si Shuai-Wang)

二十四节气 (Er-Shi-Si Jie-Qi) and 立春 (Li-Chun)

Planets

Time

4. Test

RUST_BACKTRACE=1 cargo test -vv -- --nocapture

5. Dislaimer

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.

6. License

MIT license (LICENSE)

Description
No description provided
Readme MIT 448 KiB
Languages
Rust 100%