Исправление структуры документации
This commit is contained in:
parent
f8f6b07c81
commit
e15070ce45
20 changed files with 316 additions and 135 deletions
56
docs/versor/set-values-eng.md
Normal file
56
docs/versor/set-values-eng.md
Normal file
|
@ -0,0 +1,56 @@
|
|||
# Versor component assignment functions
|
||||
|
||||
Special functions are provided to specify specific values ??for the versor components.
|
||||
|
||||
For the **BgFP32Versor** type, the function has the form:
|
||||
|
||||
```c
|
||||
inline void bgc_versor_set_values_fp32(const float s0, const float x1, const float x2, const float x3, BgcVersorFP32* versor);
|
||||
```
|
||||
|
||||
For the **BgFP64Versor** type, the function has the form:
|
||||
|
||||
```c
|
||||
inline void bgc_versor_set_values_fp64(const double s0, const double x1, const double x2, const double x3, BgcVersorFP64* versor);
|
||||
```
|
||||
|
||||
These functions set the values ??passed in the **s0**, **x1**, **x2**, and **x3** parameters to the corresponding components of the versor passed by pointer in the **versor** parameter. But if the resulting state is not a normalized quaternion, then the functions normalize the versor.
|
||||
|
||||
The **versor** parameter must be a valid pointer and must not be NULL.
|
||||
|
||||
These functions are also well suited for initializing the state of variables of types **BgFP32Versor** and **BgFP64Versor**, as are the functions [bgc_versor_reset_fp32 and bgc_versor_reset_fp64](./versor-reset-eng.md).
|
||||
|
||||
```c
|
||||
#include <stdio.h>
|
||||
#include <basic-geometry.h>
|
||||
|
||||
int main() {
|
||||
BgcVersorFP64 versor;
|
||||
|
||||
bgc_versor_set_values_fp64(1, 2, 3, 4, &versor);
|
||||
|
||||
printf("Versor: (%lf, %lf, %lf, %lf)\n", versor.s0, versor.x1, versor.x2, versor.x3);
|
||||
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
Result:
|
||||
|
||||
```
|
||||
Versor: (0.182574, 0.365148, 0.547723, 0.730297)
|
||||
```
|
||||
|
||||
If zeros are passed to the function as component values, then the versor, the pointer to which is passed in the **versor** parameter, will be set to the state corresponding to the absence of rotation:
|
||||
|
||||
```c
|
||||
bgc_versor_set_values_fp64(0, 0, 0, 0, &versor);
|
||||
```
|
||||
|
||||
Result:
|
||||
|
||||
```
|
||||
Versor: (1.000000, 0.000000, 0.000000, 0.000000)
|
||||
```
|
||||
|
||||
[Documentation](../intro-eng.md) / [Versors](../versor-eng.md)
|
Loading…
Add table
Add a link
Reference in a new issue