Добавление документации по трёхмерным векторам и исправления
This commit is contained in:
parent
e15070ce45
commit
02bcb1bd33
24 changed files with 593 additions and 132 deletions
|
|
@ -5,40 +5,40 @@ You can set the coordinates of vectors either directly or using functions. The f
|
|||
Function for **BgcVector2FP32**:
|
||||
|
||||
```c
|
||||
inline void bgc_vector2_set_values_fp32(const float x1, const float x2, BgcVector2FP32* to);
|
||||
inline void bgc_vector2_set_values_fp32(const float x1, const float x2, BgcVector2FP32* to);
|
||||
```
|
||||
|
||||
Function for **BgcVector2FP32**:
|
||||
|
||||
```c
|
||||
inline void bgc_vector2_set_values_fp64(const double x1, const double x2, BgcVector2FP64* to);
|
||||
inline void bgc_vector2_set_values_fp64(const double x1, const double x2, BgcVector2FP64* to);
|
||||
```
|
||||
|
||||
Each of these functions is equivalent to the following lines of code:
|
||||
|
||||
```c
|
||||
vector->x1 = x1;
|
||||
vector->x2 = x2;
|
||||
to->x1 = x1;
|
||||
to->x2 = x2;
|
||||
```
|
||||
|
||||
You should not pass invalid pointers to these functions. The value NULL (0) is also considered invalid.
|
||||
Invalid pointers should not be passed in the **to** parameter. The NULL (0) value is also considered invalid.
|
||||
|
||||
Example of use:
|
||||
|
||||
```c
|
||||
#include <stdio.h>
|
||||
#include <basic-geometry.h>
|
||||
#include <stdio.h>
|
||||
#include <basic-geometry.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
BgcVector2FP32 my_vector;
|
||||
int main()
|
||||
{
|
||||
BgcVector2FP32 my_vector;
|
||||
|
||||
bgc_vector2_set_values_fp32(-2, 7, &my_vector);
|
||||
bgc_vector2_set_values_fp32(-2, 7, &my_vector);
|
||||
|
||||
printf("x1 = %f, x2 = %f\n", my_vector.x1, my_vector.x2);
|
||||
printf("x1 = %f, x2 = %f\n", my_vector.x1, my_vector.x2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
[Documentation](../intro-eng.md) / [2D vectors](../vector2-eng.md)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue