bgc-c/docs/intro-eng.md

56 lines
No EOL
2.1 KiB
Markdown

# Basic Geomtric Computations
[Русская версия / Russian version](intro-rus.md)
## Naming
### Prefixes
C programming language does not have namespaces, thus prefixes often play role
of namespaces in C code.
The library uses prefixes in names of types, constants and functions to avoid
name conflict with of othr libraries.
The main prefix is **BGC** which means **B**asic **G**eometric **C**omputations.
The structure types and contstans have prefix in the form **Bgc**. For example:
BGC_FP64_Vector3, BGC_FP32_Quaternion, BGC_FP32_Matrix2x2, BGC_FP32_EPSILON,
BGC_FP64_TWO_PI.
The constants have prefix in the form **BGC_**. For example: BGC_EPSYLON_FP32,
BGC_TWO_PI_FP64.
The functions have prefix in the form **bgc_**. For example:
bgc_fp32_turn3_combine, bgc_fp64_matrix3x3_subtract.
### Suffixes
Suffixs of type ends the names of constats, types and functions of the library.
The library uses two types of floating point numbers: **float** and **double**
(**binary32** and **binary64** types of the **IEEE 754** standard).
Thus there are two suffixes of types:
* **FP32** - means **F**loating **P**oint, **32** bit, which corresponds to the
**float** type of the C language.
* **FP64** - means **F**loating **P**oint, **64** bit, which corresponds to the
**double** type of the C language.
The constants and the types of structures which are based in the **float** type
have **FP32** as the type prefix: BGC_FP32_Vector3, BGC_FP32_Matrix3x2,
BGC_FP32_Quaternion, BGC_FP32_PI, BGC_FP32_EPSILON.
The constants and the types of structures which are based in the **double** type
have **FP64** as the type prefix: BGC_FP64_Vector2, BGC_FP64_Matrix2x3,
BGC_FP64_Turn3, BGC_FP64_HALF_PI, BGC_FP64_ONE_THIRD.
The functions which works with data of the **float** type have **_fp32** as
the type suffix: bcg_fp32_vector2_get_length, bgc_fp32_radians_to_degrees.
The functions which works with data of the **double** type have **_fp64** as
the type suffix: bgc_fp64_vector3_reset, bgc_fp64_normalize_radians.
Using of such prefixes of a basic type allows to enhance the library with new
basic types in future.