Удаление функций set_value для структур с открытыми полями (векторы и кватернионы)
This commit is contained in:
parent
e2bf8d28a8
commit
abf99a7126
25 changed files with 597 additions and 707 deletions
|
|
@ -1,52 +0,0 @@
|
|||
# Setting the coordinates of a two-dimensional vector
|
||||
|
||||
[Русская версия / Russian version](set-values-rus.md)
|
||||
|
||||
You can set the coordinates of vectors either directly or using functions.
|
||||
The functions for setting coordinate values allow you to do this in one line.
|
||||
|
||||
Function for **BGC_FP32_Vector2**:
|
||||
|
||||
```c
|
||||
inline void bgc_fp32_vector2_set_values(BGC_FP32_Vector2* const destination, const float x, const float y);
|
||||
```
|
||||
|
||||
Function for **BGC_FP64_Vector2**:
|
||||
|
||||
```c
|
||||
inline void bgc_fp64_vector2_set_values(BGC_FP64_Vector2* const destination, const double x, const double y);
|
||||
```
|
||||
|
||||
Each of these functions is equivalent to the following lines of code:
|
||||
|
||||
```c
|
||||
destination->x = x;
|
||||
destination->y = y;
|
||||
```
|
||||
|
||||
Valid pointers should pass in the **destination** parameter.
|
||||
The NULL (0) value is considered invalid.
|
||||
|
||||
This function is good for setting up the initial values of coordinates with
|
||||
one-line especially when the values are fixed constants like in the example
|
||||
below.
|
||||
|
||||
Example of use:
|
||||
|
||||
```c
|
||||
#include <stdio.h>
|
||||
#include <basic-geometry.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
BGC_FP32_Vector2 v;
|
||||
|
||||
bgc_fp32_vector2_set_values(&v, -2.2f, 7.1f);
|
||||
|
||||
printf("x = %f, y = %f\n", v.x, v.y);
|
||||
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
[Documentation](../intro-eng.md) / [2D vectors](../vector2-eng.md)
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
# Задание координат двумерного вектора
|
||||
|
||||
[English version / Английская версия](set-values-eng.md)
|
||||
|
||||
Задавать координаты векторов можно как напрямую, так и спомощью функций. Функции
|
||||
задания значений координат позволяют сделать это одной строкой.
|
||||
|
||||
Функция для **BGC_FP32_Vector2**:
|
||||
|
||||
```c
|
||||
inline void bgc_fp32_vector2_set_values(BGC_FP32_Vector2* const destination, const float x, const float y);
|
||||
```
|
||||
|
||||
Функция для **BGC_FP64_Vector2**:
|
||||
|
||||
```c
|
||||
inline void bgc_fp64_vector2_set_values(BGC_FP64_Vector2* const destination, const double x, const double y);
|
||||
```
|
||||
|
||||
Каждая из данных функции эквивалентна следующим строкам кода:
|
||||
|
||||
```c
|
||||
destination->x = x;
|
||||
destination->y = y;
|
||||
```
|
||||
|
||||
В параметре **destination** следует передавать корректные указатели.
|
||||
Значение NULL (0) считается некорректным.
|
||||
|
||||
Данная функция хорошо подходит для заданя значений координат вектора одной
|
||||
строкой. Особенно если надо указать фиксированные значения координат как
|
||||
в примере ниже.
|
||||
|
||||
Пример применения:
|
||||
|
||||
```c
|
||||
#include <stdio.h>
|
||||
#include <basic-geometry.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
BGC_FP32_Vector2 v;
|
||||
|
||||
bgc_fp32_vector2_set_values(&v, -2.2f, 7.1f);
|
||||
|
||||
printf("x = %f, y = %f\n", v.x, v.y);
|
||||
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
[Документация](../intro-rus.md) / [2D векторы](../vector2-rus.md)
|
||||
Loading…
Add table
Add a link
Reference in a new issue