bgc-c/docs/intro-eng.md

69 lines
2.2 KiB
Markdown

# Basic Geomtric Computations
[Русская версия / Russian version](intro-rus.md)
## Naming
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.
### Library prefix (the main prefix)
The main prefix is **BGC** which means **B**asic **G**eometric **C**omputations.
The structure types and the contstans have prefix in the form **BGC_**.
For example, structures:
- BGC_FP64_Vector3
- BGC_FP32_Quaternion
- BGC_FP32_Matrix2x2
Constants:
- BGC_FP32_EPSILON
- BGC_FP64_TWO_PI
The functions have prefix in the form **bgc_**, for example:
- bgc_fp32_turn3_combine
- bgc_fp64_matrix3x3_subtract
### Basic type prefix (the secondary prefix)
Prefixs 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 prefixes of types:
- **FP32** - means **F**loating **P**oint, **32** bit, which corresponds to the **float** type of the C programming language.
- **FP64** - means **F**loating **P**oint, **64** bit, which corresponds to the **double** type of the C programming 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 prefix:
- 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 prefix:
- 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.
### Data types
- [2D-vectors](vector2-eng.md)
- [3D-vectors](vector3-eng.md)
- [Quaternions](quaternion-rus.md)