[gnome-color-manager] trivial: add gcm_vec3_add() and gcm_vec3_subtract()
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] trivial: add gcm_vec3_add() and gcm_vec3_subtract()
- Date: Sun, 1 Aug 2010 23:02:40 +0000 (UTC)
commit 8b9fbc9dcfe4be535397c0fbbe374265a5f69c7a
Author: Richard Hughes <richard hughsie com>
Date: Sun Aug 1 18:58:31 2010 +0100
trivial: add gcm_vec3_add() and gcm_vec3_subtract()
libcolor-glib/gcm-common.c | 34 ++++++++++++++++++++++++++++++++++
libcolor-glib/gcm-common.h | 6 ++++++
2 files changed, 40 insertions(+), 0 deletions(-)
---
diff --git a/libcolor-glib/gcm-common.c b/libcolor-glib/gcm-common.c
index d2a648a..7d3534a 100644
--- a/libcolor-glib/gcm-common.c
+++ b/libcolor-glib/gcm-common.c
@@ -65,6 +65,40 @@ gcm_vec3_scalar_multiply (const GcmVec3 *src, gdouble value, GcmVec3 *dest)
}
/**
+ * gcm_vec3_add:
+ * @src1: the source
+ * @src2: the other source
+ * @dest: the destination
+ *
+ * Adds two vector quantaties
+ * The arguments @src and @dest can be the same value.
+ **/
+void
+gcm_vec3_add (const GcmVec3 *src1, const GcmVec3 *src2, GcmVec3 *dest)
+{
+ dest->v0 = src1->v0 + src2->v0;
+ dest->v1 = src1->v1 + src2->v1;
+ dest->v2 = src1->v2 + src2->v2;
+}
+
+/**
+ * gcm_vec3_subtract:
+ * @src1: the source
+ * @src2: the other source
+ * @dest: the destination
+ *
+ * Subtracts one vector quantaty from another
+ * The arguments @src and @dest can be the same value.
+ **/
+void
+gcm_vec3_subtract (const GcmVec3 *src1, const GcmVec3 *src2, GcmVec3 *dest)
+{
+ dest->v0 = src1->v0 - src2->v0;
+ dest->v1 = src1->v1 - src2->v1;
+ dest->v2 = src1->v2 - src2->v2;
+}
+
+/**
* gcm_vec3_to_string:
* @src: the source
*
diff --git a/libcolor-glib/gcm-common.h b/libcolor-glib/gcm-common.h
index acdb33e..f561871 100644
--- a/libcolor-glib/gcm-common.h
+++ b/libcolor-glib/gcm-common.h
@@ -41,6 +41,12 @@ typedef struct {
} GcmVec3;
void gcm_vec3_clear (GcmVec3 *src);
+void gcm_vec3_add (const GcmVec3 *src1,
+ const GcmVec3 *src2,
+ GcmVec3 *dest);
+void gcm_vec3_subtract (const GcmVec3 *src1,
+ const GcmVec3 *src2,
+ GcmVec3 *dest);
void gcm_vec3_scalar_multiply (const GcmVec3 *src,
gdouble value,
GcmVec3 *dest);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]