Удаление функций set_value для структур с открытыми полями (векторы и кватернионы)
This commit is contained in:
parent
e2bf8d28a8
commit
abf99a7126
25 changed files with 597 additions and 707 deletions
|
|
@ -1,59 +0,0 @@
|
|||
# Setting the coordinates of a three-dimensional vector
|
||||
|
||||
[Русская версия / Russian version](set-values-rus.md)
|
||||
|
||||
The function for **BGC_FP32_Vector3**:
|
||||
|
||||
```c
|
||||
inline void bgc_fp32_vector3_set_values(BGC_FP32_Vector3* const destination, const float x, const float y, const float z);
|
||||
```
|
||||
|
||||
The function for **BGC_FP64_Vector3**:
|
||||
|
||||
```c
|
||||
inline void bgc_fp64_vector3_set_values(BGC_FP64_Vector3* const destination, const double x, const double y, const double z);
|
||||
```
|
||||
|
||||
These functions allow to set the values of coordinates in one-line.
|
||||
|
||||
The functions are especially useful when the values are constants like in the example below.
|
||||
|
||||
Each of these functions is equivalent to the following lines of code:
|
||||
|
||||
```c
|
||||
destination->x = x;
|
||||
destination->y = y;
|
||||
destination->z = z;
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
| Parameter | Direction | Description |
|
||||
| ----------- | --------- | ------------------------------------------------------- |
|
||||
| destination | out | A pointer to a 3D-vector, which coordinates must be set |
|
||||
| x | in | A new value for the X-coordinate |
|
||||
| y | in | A new value for the Y-coordinate |
|
||||
| z | in | A new value for the Z-coordinate |
|
||||
|
||||
The *destination* parameter must be a valid pointer. The NULL (0) value is considered invalid.
|
||||
|
||||
### Example
|
||||
|
||||
```c
|
||||
#include <stdio.h>
|
||||
#include <basic-geometry.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
BGC_FP32_Vector3 v;
|
||||
|
||||
bgc_fp32_vector3_set_values(&v, -2.2f, 7.8f, 10.01f);
|
||||
|
||||
printf("x = %f, y = %f, z = %f\n", v.x, v.y, v.z);
|
||||
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
[Documentation](../intro-eng.md) / [3D vectors](../vector3-eng.md)
|
||||
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
# Задание координат трёхмерного вектора.
|
||||
|
||||
[English version / Английская версия](set-values-eng.md)
|
||||
|
||||
Функция для **BGC_FP32_Vector3**:
|
||||
|
||||
```c
|
||||
inline void bgc_fp32_vector3_set_values(BGC_FP32_Vector3* const destination, const float x, const float y, const float z);
|
||||
```
|
||||
|
||||
Функция для **BGC_FP64_Vector3**:
|
||||
|
||||
```c
|
||||
inline void bgc_fp64_vector3_set_values(BGC_FP64_Vector3* const destination, const double x, const double y, const double z);
|
||||
```
|
||||
|
||||
Данные функции позволяют задать значения координат вектора одной строкой.
|
||||
|
||||
Такая возможность может быть удобна, когда нужно указать значения координат с помощью числовых констант как в примере ниже.
|
||||
|
||||
Каждая из функций аналогична следующим трём строкам кода:
|
||||
|
||||
```c
|
||||
destination->x = x;
|
||||
destination->y = y;
|
||||
destination->z = z;
|
||||
```
|
||||
|
||||
### Параметры
|
||||
|
||||
| Параметр | Направление | Описание |
|
||||
| ----------- | ----------- | -------------------------------------------------------------- |
|
||||
| destination | исходящий | Указатель на вектор, координаты которого будут заданы функцией |
|
||||
| x | входящий | Значение координаты X |
|
||||
| y | входящий | Значение координаты Y |
|
||||
| z | входящий | Значение координаты Z |
|
||||
|
||||
Параметр *destination* должен быть корректным указателем. Значение NULL (0) считается некорректным.
|
||||
|
||||
### Пример
|
||||
|
||||
```c
|
||||
#include <stdio.h>
|
||||
#include <basic-geometry.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
BGC_FP32_Vector3 v;
|
||||
|
||||
bgc_fp32_vector3_set_values(&v, -2.2f, 7.8f, 10.01f);
|
||||
|
||||
printf("x = %f, y = %f, z = %f\n", v.x, v.y, v.z);
|
||||
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
[Документация](../intro-rus.md) / [Трёхмерные векторы](../vector3-rus.md)
|
||||
Loading…
Add table
Add a link
Reference in a new issue