bgc-c/basic-geometry/types.h

224 lines
4.2 KiB
C

#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;
// =================== Slerp3 =================== //
typedef struct {
BGC_FP32_Quaternion _cosine_weight, _sine_weight;
float radians;
} BGC_FP32_Slerp3;
typedef struct {
BGC_FP64_Quaternion _cosine_weight, _sine_weight;
double radians;
} BGC_FP64_Slerp3;
// ================= Position2 ================== //
typedef struct {
BGC_FP32_Turn2 turn;
BGC_FP32_Vector2 shift;
} BGC_FP32_Position2;
typedef struct {
BGC_FP64_Turn2 turn;
BGC_FP64_Vector2 shift;
} BGC_FP64_Position2;
// ================= Position3 ================== //
typedef struct {
BGC_FP32_Turn3 turn;
BGC_FP32_Vector3 shift;
} BGC_FP32_Position3;
typedef struct {
BGC_FP64_Turn3 turn;
BGC_FP64_Vector3 shift;
} BGC_FP64_Position3;
// ================ Dual Number ================= //
typedef struct {
float real_part, dual_part;
} BGC_FP32_DualNumber;
typedef struct {
double real_part, dual_part;
} BGC_FP64_DualNumber;
// ================ Dual Vector ================= //
typedef struct {
BGC_FP32_Vector3 real_part, dual_part;
} BGC_FP32_DualVector3;
typedef struct {
BGC_FP64_Vector3 real_part, dual_part;
} BGC_FP64_DualVector3;
// ============== Dual Quaternion =============== //
typedef struct {
BGC_FP32_Quaternion real_part, dual_part;
} BGC_FP32_DualQuaternion;
typedef struct {
BGC_FP64_Quaternion real_part, dual_part;
} BGC_FP64_DualQuaternion;
// ================ Rigid Pose3 ================= //
typedef struct {
BGC_FP32_DualQuaternion _versor;
} BGC_FP32_RigidPose3;
typedef struct {
BGC_FP64_DualQuaternion _versor;
} BGC_FP64_RigidPose3;
#endif