PIKApp/libpikamath/pikamatrix.h

158 lines
7.0 KiB
C

/* LIBPIKA - The PIKA Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
*
* pikamatrix.h
* Copyright (C) 1998 Jay Cox <jaycox@gimp.org>
*
* This library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <https://www.gnu.org/licenses/>.
*/
#if !defined (__PIKA_MATH_H_INSIDE__) && !defined (PIKA_MATH_COMPILATION)
#error "Only <libpikamath/pikamath.h> can be included directly."
#endif
#ifndef __PIKA_MATRIX_H__
#define __PIKA_MATRIX_H__
G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
/*****************/
/* PikaMatrix2 */
/*****************/
#define PIKA_TYPE_MATRIX2 (pika_matrix2_get_type ())
#define PIKA_VALUE_HOLDS_MATRIX2(value) (G_TYPE_CHECK_VALUE_TYPE ((value), PIKA_TYPE_MATRIX2))
GType pika_matrix2_get_type (void) G_GNUC_CONST;
#define PIKA_TYPE_PARAM_MATRIX2 (pika_param_matrix2_get_type ())
#define PIKA_IS_PARAM_SPEC_MATRIX2(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), PIKA_TYPE_PARAM_MATRIX2))
GType pika_param_matrix2_get_type (void) G_GNUC_CONST;
GParamSpec * pika_param_spec_matrix2 (const gchar *name,
const gchar *nick,
const gchar *blurb,
const PikaMatrix2 *default_value,
GParamFlags flags);
void pika_matrix2_identity (PikaMatrix2 *matrix);
void pika_matrix2_mult (const PikaMatrix2 *left,
PikaMatrix2 *right);
gdouble pika_matrix2_determinant (const PikaMatrix2 *matrix);
void pika_matrix2_invert (PikaMatrix2 *matrix);
void pika_matrix2_transform_point (const PikaMatrix2 *matrix,
gdouble x,
gdouble y,
gdouble *newx,
gdouble *newy);
/*****************/
/* PikaMatrix3 */
/*****************/
#define PIKA_TYPE_MATRIX3 (pika_matrix3_get_type ())
#define PIKA_VALUE_HOLDS_MATRIX3(value) (G_TYPE_CHECK_VALUE_TYPE ((value), PIKA_TYPE_MATRIX3))
GType pika_matrix3_get_type (void) G_GNUC_CONST;
#define PIKA_TYPE_PARAM_MATRIX3 (pika_param_matrix3_get_type ())
#define PIKA_IS_PARAM_SPEC_MATRIX3(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), PIKA_TYPE_PARAM_MATRIX3))
GType pika_param_matrix3_get_type (void) G_GNUC_CONST;
GParamSpec * pika_param_spec_matrix3 (const gchar *name,
const gchar *nick,
const gchar *blurb,
const PikaMatrix3 *default_value,
GParamFlags flags);
void pika_matrix3_identity (PikaMatrix3 *matrix);
void pika_matrix3_mult (const PikaMatrix3 *left,
PikaMatrix3 *right);
void pika_matrix3_translate (PikaMatrix3 *matrix,
gdouble x,
gdouble y);
void pika_matrix3_scale (PikaMatrix3 *matrix,
gdouble x,
gdouble y);
void pika_matrix3_rotate (PikaMatrix3 *matrix,
gdouble theta);
void pika_matrix3_xshear (PikaMatrix3 *matrix,
gdouble amount);
void pika_matrix3_yshear (PikaMatrix3 *matrix,
gdouble amount);
void pika_matrix3_affine (PikaMatrix3 *matrix,
gdouble a,
gdouble b,
gdouble c,
gdouble d,
gdouble e,
gdouble f);
gdouble pika_matrix3_determinant (const PikaMatrix3 *matrix);
void pika_matrix3_invert (PikaMatrix3 *matrix);
gboolean pika_matrix3_is_identity (const PikaMatrix3 *matrix);
gboolean pika_matrix3_is_diagonal (const PikaMatrix3 *matrix);
gboolean pika_matrix3_is_affine (const PikaMatrix3 *matrix);
gboolean pika_matrix3_is_simple (const PikaMatrix3 *matrix);
gboolean pika_matrix3_equal (const PikaMatrix3 *matrix1,
const PikaMatrix3 *matrix2);
void pika_matrix3_transform_point (const PikaMatrix3 *matrix,
gdouble x,
gdouble y,
gdouble *newx,
gdouble *newy);
/*****************/
/* PikaMatrix4 */
/*****************/
void pika_matrix4_identity (PikaMatrix4 *matrix);
void pika_matrix4_mult (const PikaMatrix4 *left,
PikaMatrix4 *right);
void pika_matrix4_to_deg (const PikaMatrix4 *matrix,
gdouble *a,
gdouble *b,
gdouble *c);
gdouble pika_matrix4_transform_point (const PikaMatrix4 *matrix,
gdouble x,
gdouble y,
gdouble z,
gdouble *newx,
gdouble *newy,
gdouble *newz);
G_END_DECLS
#endif /* __PIKA_MATRIX_H__ */