/* PIKA - Photo and Image Kooker Application
 * a rebranding of The GNU Image Manipulation Program (created with heckimp)
 * A derived work which may be trivial. However, any changes may be (C)2023 by Aldercone Studio
 *
 * Original copyright, applying to most contents (license remains unchanged): 
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
 *
 * pika-3d-transform-utils.h
 * Copyright (C) 2019 Ell
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */

#ifndef __PIKA_TRANSFORM_3D_UTILS_H__
#define __PIKA_TRANSFORM_3D_UTILS_H__


gdouble       pika_transform_3d_angle_of_view_to_focal_length   (gdouble            angle_of_view,
                                                                 gdouble            width,
                                                                 gdouble            height);
gdouble       pika_transform_3d_focal_length_to_angle_of_view   (gdouble            focal_length,
                                                                 gdouble            width,
                                                                 gdouble            height);

gint          pika_transform_3d_permutation_to_rotation_order   (const gint         permutation[3]);
void          pika_transform_3d_rotation_order_to_permutation   (gint               rotation_order,
                                                                 gint               permutation[3]);
gint          pika_transform_3d_rotation_order_reverse          (gint               rotation_order);

void          pika_transform_3d_vector3_rotate                  (PikaVector3       *vector,
                                                                 const PikaVector3 *axis);
PikaVector3   pika_transform_3d_vector3_rotate_val              (PikaVector3        vector,
                                                                 PikaVector3        axis);

void          pika_transform_3d_matrix3_to_matrix4              (const PikaMatrix3 *matrix3,
                                                                 PikaMatrix4       *matrix4,
                                                                 gint               axis);
void          pika_transform_3d_matrix4_to_matrix3              (const PikaMatrix4 *matrix4,
                                                                 PikaMatrix3       *matrix3,
                                                                 gint               axis);

void          pika_transform_3d_matrix4_translate               (PikaMatrix4       *matrix,
                                                                 gdouble            x,
                                                                 gdouble            y,
                                                                 gdouble            z);

void          pika_transform_3d_matrix4_rotate                  (PikaMatrix4       *matrix,
                                                                 const PikaVector3 *axis);
void          pika_transform_3d_matrix4_rotate_standard         (PikaMatrix4       *matrix,
                                                                 gint               axis,
                                                                 gdouble            angle);

void          pika_transform_3d_matrix4_rotate_euler            (PikaMatrix4       *matrix,
                                                                 gint               rotation_order,
                                                                 gdouble            angle_x,
                                                                 gdouble            angle_y,
                                                                 gdouble            angle_z,
                                                                 gdouble            pivot_x,
                                                                 gdouble            pivot_y,
                                                                 gdouble            pivot_z);
void          pika_transform_3d_matrix4_rotate_euler_decompose  (PikaMatrix4       *matrix,
                                                                 gint               rotation_order,
                                                                 gdouble           *angle_x,
                                                                 gdouble           *angle_y,
                                                                 gdouble           *angle_z);

void          pika_transform_3d_matrix4_perspective             (PikaMatrix4       *matrix,
                                                                 gdouble            camera_x,
                                                                 gdouble            camera_y,
                                                                 gdouble            camera_z);

void          pika_transform_3d_matrix                          (PikaMatrix3       *matrix,
                                                                 gdouble            camera_x,
                                                                 gdouble            camera_y,
                                                                 gdouble            camera_z,
                                                                 gdouble            offset_x,
                                                                 gdouble            offset_y,
                                                                 gdouble            offset_z,
                                                                 gint               rotation_order,
                                                                 gdouble            angle_x,
                                                                 gdouble            angle_y,
                                                                 gdouble            angle_z,
                                                                 gdouble            pivot_x,
                                                                 gdouble            pivot_y,
                                                                 gdouble            pivot_z);


#endif /* __PIKA_TRANSFORM_3D_UTILS_H__ */
