Skip to content

A library for Chinese astrology (written in Rust), specifically, for "Feng-Shui" (風水 or 风水). Provides: 八卦 (Ba-Gua), 干支 (Gan-Zhi), 九星 (Jiu-Xing), 二十四节气 (Er-Shi-Si Jie-Qi), 二十四山向 (Er-Shi-Si Shan-Xiang), 生死衰旺 (Sheng-Si Shuai-Wang), etc.

License

Notifications You must be signed in to change notification settings

minagawah/mikaboshi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mikaboshi

screenshot screenshot2

1. About

"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:

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"

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

I have a few examples which may, or may not help...

3. Documentation

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.

4. Test

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

5. Notes

(1) cargo fmt

Looking into rustfmt.toml, you see the setting:

format_strings = true

which works only for the Nightly build.
So, you need:

cargo +nightly fmt

6. 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.

7. License

MIT license (LICENSE)

About

A library for Chinese astrology (written in Rust), specifically, for "Feng-Shui" (風水 or 风水). Provides: 八卦 (Ba-Gua), 干支 (Gan-Zhi), 九星 (Jiu-Xing), 二十四节气 (Er-Shi-Si Jie-Qi), 二十四山向 (Er-Shi-Si Shan-Xiang), 生死衰旺 (Sheng-Si Shuai-Wang), etc.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages