Реорганизация проекта: перенос определения всех типов в один файл, перегруппировка функций в файлах
This commit is contained in:
parent
c7d9263154
commit
053af33444
45 changed files with 1001 additions and 980 deletions
230
basic-geometry/types.h
Normal file
230
basic-geometry/types.h
Normal file
|
|
@ -0,0 +1,230 @@
|
|||
#ifndef _BGC_TYPES_H_INCLUDED_
|
||||
#define _BGC_TYPES_H_INCLUDED_
|
||||
|
||||
// =================== Vector2 ================== //
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float x1, x2;
|
||||
} BGC_FP32_Vector2;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
double x1, x2;
|
||||
} BGC_FP64_Vector2;
|
||||
|
||||
// ================== Vector3 =================== //
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float x1, x2, x3;
|
||||
} BGC_FP32_Vector3;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
double x1, x2, x3;
|
||||
} BGC_FP64_Vector3;
|
||||
|
||||
// ================== Matrix2x2 ================= //
|
||||
|
||||
typedef struct {
|
||||
float r1c1, r1c2;
|
||||
float r2c1, r2c2;
|
||||
} BGC_FP32_Matrix2x2;
|
||||
|
||||
typedef struct {
|
||||
double r1c1, r1c2;
|
||||
double r2c1, r2c2;
|
||||
} BGC_FP64_Matrix2x2;
|
||||
|
||||
// ================== Matrix2x3 ================= //
|
||||
|
||||
typedef struct {
|
||||
float r1c1, r1c2;
|
||||
float r2c1, r2c2;
|
||||
float r3c1, r3c2;
|
||||
} BGC_FP32_Matrix2x3;
|
||||
|
||||
typedef struct {
|
||||
double r1c1, r1c2;
|
||||
double r2c1, r2c2;
|
||||
double r3c1, r3c2;
|
||||
} BGC_FP64_Matrix2x3;
|
||||
|
||||
// ================== Matrix3x2 ================= //
|
||||
|
||||
typedef struct {
|
||||
float r1c1, r1c2, r1c3;
|
||||
float r2c1, r2c2, r2c3;
|
||||
} BGC_FP32_Matrix3x2;
|
||||
|
||||
typedef struct {
|
||||
double r1c1, r1c2, r1c3;
|
||||
double r2c1, r2c2, r2c3;
|
||||
} BGC_FP64_Matrix3x2;
|
||||
|
||||
// ================== Matrix3x3 ================= //
|
||||
|
||||
typedef struct {
|
||||
float r1c1, r1c2, r1c3;
|
||||
float r2c1, r2c2, r2c3;
|
||||
float r3c1, r3c2, r3c3;
|
||||
} BGC_FP32_Matrix3x3;
|
||||
|
||||
typedef struct {
|
||||
double r1c1, r1c2, r1c3;
|
||||
double r2c1, r2c2, r2c3;
|
||||
double r3c1, r3c2, r3c3;
|
||||
} BGC_FP64_Matrix3x3;
|
||||
|
||||
// ================ Affine Map 2D ================ //
|
||||
|
||||
typedef struct {
|
||||
BGC_FP32_Matrix2x2 distortion;
|
||||
BGC_FP32_Vector2 shift;
|
||||
} BGC_FP32_Affine2;
|
||||
|
||||
typedef struct {
|
||||
BGC_FP64_Matrix2x2 distortion;
|
||||
BGC_FP64_Vector2 shift;
|
||||
} BGC_FP64_Affine2;
|
||||
|
||||
// ================ Affine Map 3D ================ //
|
||||
|
||||
typedef struct {
|
||||
BGC_FP32_Matrix3x3 distortion;
|
||||
BGC_FP32_Vector3 shift;
|
||||
} BGC_FP32_Affine3;
|
||||
|
||||
typedef struct {
|
||||
BGC_FP64_Matrix3x3 distortion;
|
||||
BGC_FP64_Vector3 shift;
|
||||
} BGC_FP64_Affine3;
|
||||
|
||||
// =============== Complex Number =============== //
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float real, imaginary;
|
||||
} BGC_FP32_Complex;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
double real, imaginary;
|
||||
} BGC_FP64_Complex;
|
||||
|
||||
// =================== Turn2 ==================== //
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float _cos, _sin;
|
||||
} BGC_FP32_Turn2;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
double _cos, _sin;
|
||||
} BGC_FP64_Turn2;
|
||||
|
||||
// ================= Quaternion ================= //
|
||||
|
||||
typedef struct {
|
||||
float s0, x1, x2, x3;
|
||||
} BGC_FP32_Quaternion;
|
||||
|
||||
typedef struct {
|
||||
double s0, x1, x2, x3;
|
||||
} BGC_FP64_Quaternion;
|
||||
|
||||
// =================== Turn3 ==================== //
|
||||
|
||||
typedef struct {
|
||||
BGC_FP32_Quaternion _versor;
|
||||
} BGC_FP32_Turn3;
|
||||
|
||||
typedef struct {
|
||||
BGC_FP64_Quaternion _versor;
|
||||
} BGC_FP64_Turn3;
|
||||
|
||||
// ================ Turn3 Slerp ================= //
|
||||
|
||||
typedef struct {
|
||||
float _s0_cos_weight, _s0_sin_weight;
|
||||
float _x1_cos_weight, _x1_sin_weight;
|
||||
float _x2_cos_weight, _x2_sin_weight;
|
||||
float _x3_cos_weight, _x3_sin_weight;
|
||||
float radians;
|
||||
} BGC_FP32_Turn3Slerp;
|
||||
|
||||
typedef struct {
|
||||
double _s0_cos_weight, _s0_sin_weight;
|
||||
double _x1_cos_weight, _x1_sin_weight;
|
||||
double _x2_cos_weight, _x2_sin_weight;
|
||||
double _x3_cos_weight, _x3_sin_weight;
|
||||
double radians;
|
||||
} BGC_FP64_Turn3Slerp;
|
||||
|
||||
// =========== Homogeneous 3D Vector ============ //
|
||||
|
||||
// Homogeneous 3D Vector
|
||||
typedef struct
|
||||
{
|
||||
float x1, x2, x3, d0;
|
||||
} BGC_FP32_HgVector3;
|
||||
|
||||
// Homogeneous 3D Vector
|
||||
typedef struct
|
||||
{
|
||||
double x1, x2, x3, d0;
|
||||
} BGC_FP64_HgVector3;
|
||||
|
||||
// =========== Homogeneous Matrix3x3 ============ //
|
||||
|
||||
// Homogeneous Matrix3x3 based on float type
|
||||
typedef struct
|
||||
{
|
||||
float r1c1, r1c2, r1c3, r1d0;
|
||||
float r2c1, r2c2, r2c3, r2d0;
|
||||
float r3c1, r3c2, r3c3, r3d0;
|
||||
float d0c1, d0c2, d0c3, d0d0;
|
||||
} BGC_FP32_HgMatrix3x3;
|
||||
|
||||
// Homogeneous Matrix3x3 based on double type
|
||||
typedef struct
|
||||
{
|
||||
double r1c1, r1c2, r1c3, r1d0;
|
||||
double r2c1, r2c2, r2c3, r2d0;
|
||||
double r3c1, r3c2, r3c3, r3d0;
|
||||
double d0c1, d0c2, d0c3, d0d0;
|
||||
} BGC_FP64_HgMatrix3x3;
|
||||
|
||||
// ================ Dual Number ================= //
|
||||
|
||||
typedef struct {
|
||||
float real, dual;
|
||||
} BGC_FP32_DualNumber;
|
||||
|
||||
typedef struct {
|
||||
double real, dual;
|
||||
} BGC_FP64_DualNumber;
|
||||
|
||||
// ================ Dual Vector ================= //
|
||||
|
||||
typedef struct {
|
||||
BGC_FP32_Vector3 real, dual;
|
||||
} BGC_FP32_DualVector3;
|
||||
|
||||
typedef struct {
|
||||
BGC_FP64_Vector3 real, dual;
|
||||
} BGC_FP64_DualVector3;
|
||||
|
||||
// ============== Dual Quaternion =============== //
|
||||
|
||||
typedef struct {
|
||||
BGC_FP32_Quaternion real, dual;
|
||||
} BGC_FP32_DualQuaternion;
|
||||
|
||||
typedef struct {
|
||||
BGC_FP64_Quaternion real, dual;
|
||||
} BGC_FP64_DualQuaternion;
|
||||
|
||||
#endif // _BGC_MATRIX_TYPES_H_
|
||||
Loading…
Add table
Add a link
Reference in a new issue