1.5 KiB
1.5 KiB
Copying of coordinate values
Русская версия / Russian version
The function for BGC_FP32_Vector3:
inline void bgc_fp32_vector3_copy(BGC_FP32_Vector3* const destination, const BGC_FP32_Vector3* const source);
The function for BGC_FP64_Vector3:
inline void bgc_fp64_vector3_copy(BGC_FP64_Vector3* const destination, const BGC_FP64_Vector3* const source);
These functions allow to copy the values of the coordinates of one 3D-vector to another 3D-vector of the same type.
Each of these functions is equivalent to the following lines of code:
destination->x = source->x;
destination->y = source->y;
destination->z = source->z;
Parameters
| Parameter | Direction | Description |
|---|---|---|
| destination | out | A pointer to a vector to set coordinate values from source |
| source | in | A pointer to a vector which coordinates will be copied to destination |
The source and destination parameters must be valid pointers. The NULL (0) value is also considered invalid.
Example
#include <stdio.h>
#include <basic-geometry.h>
int main()
{
BGC_FP32_Vector3 v1, v2;
v1.x = -2.0f;
v1.y = 7.4f;
v1.z = 1.8f;
bgc_fp32_vector3_copy(&v2, &v1);
printf("x = %f, y = %f, z = %f\n", v2.x, v2.y, v2.z);
return 0;
}