math_functions

math_functions

Synopsis




#define             FLOAT_TO_INT                        (f)
#define             DOUBLE_TO_INT                       (d)
                    Coordinate2D;
                    Coordinate3D;
typedef             MathVector2D;
typedef             MathVector3D;
                    MathBox2D;
typedef             BoundingBox2D;
typedef             BoundingBox;
Coordinate2D*       newCoordinate2D                     (gint x,
                                                         gint y);
Coordinate3D*       newCoordinate3D                     (gint x,
                                                         gint y,
                                                         gint z);
void                coordinate2D_copy                   (Coordinate2D *dest,
                                                         Coordinate2D *src);
void                coordinate3D_copy                   (Coordinate3D *dest,
                                                         Coordinate3D *src);
void                coordinate2D_set                    (Coordinate2D *coord,
                                                         gint x,
                                                         gint y);
void                coordinate3D_set                    (Coordinate3D *coord,
                                                         gint x,
                                                         gint y,
                                                         gint z);
MathVector2D*       coordinate2D_to_mathVector2D        (MathVector2D *vec,
                                                         Coordinate2D *start,
                                                         Coordinate2D *end);
MathVector3D*       coordinate3D_to_mathVector3D        (MathVector3D *vec,
                                                         Coordinate3D *start,
                                                         Coordinate3D *end);
gchar*              coordinate2D_to_string              (Coordinate2D *coord);
gchar*              coordinate3D_to_string              (Coordinate3D *coord);
gdouble             coordinate2D_cosine                 (Coordinate2D *coord1,
                                                         Coordinate2D *angleCoord,
                                                         Coordinate2D *coord2);
gdouble             coordinate3D_cosine                 (Coordinate3D *coord1,
                                                         Coordinate3D *angleCoord,
                                                         Coordinate3D *coord2);
Coordinate2D*       coordinate2D_midpoint               (Coordinate2D *result,
                                                         Coordinate2D *c1,
                                                         Coordinate2D *c2);
Coordinate3D*       coordinate3D_midpoint               (Coordinate3D *result,
                                                         Coordinate3D *c1,
                                                         Coordinate3D *c2);
gdouble             triangle2D_area_given_Coordinate2D  (Coordinate2D *c1,
                                                         Coordinate2D *c2,
                                                         Coordinate2D *c3);
gdouble             triangle2D_area_given_points        (gint p1_x,
                                                         gint p1_y,
                                                         gint p2_x,
                                                         gint p2_y,
                                                         gint p3_x,
                                                         gint p3_y);
gdouble             distance2D_between_point_and_line   (Coordinate2D *p,
                                                         Coordinate2D *l1,
                                                         Coordinate2D *l2);
gdouble             distance2D_between_points           (Coordinate2D *l1,
                                                         Coordinate2D *l2);
MathVector3D*       mathVector2D_to_mathVector3D        (MathVector3D *vec,
                                                         MathVector2D *src);
MathVector2D*       mathVector2D_plus                   (MathVector2D *result,
                                                         MathVector2D *v1,
                                                         MathVector2D *v2);
MathVector3D*       mathVector3D_plus                   (MathVector3D *result,
                                                         MathVector3D *v1,
                                                         MathVector3D *v2);
MathVector2D*       mathVector2D_minus                  (MathVector2D *result,
                                                         MathVector2D *v1,
                                                         MathVector2D *v2);
MathVector3D*       mathVector3D_minus                  (MathVector3D *result,
                                                         MathVector3D *v1,
                                                         MathVector3D *v2);
MathVector2D*       mathVector2D_scale                  (MathVector2D *result,
                                                         MathVector2D *v,
                                                         gdouble scale);
MathVector3D*       mathVector3D_scale                  (MathVector3D *result,
                                                         MathVector3D *v,
                                                         gdouble scale);
MathVector2D*       mathVector2D_project                (MathVector2D *result,
                                                         MathVector2D *v1,
                                                         MathVector2D *v2);
MathVector3D*       mathVector3D_project                (MathVector3D *result,
                                                         MathVector3D *v1,
                                                         MathVector3D *v2);
gboolean            mathVector2D_is_counterclockwise    (MathVector2D *src,
                                                         MathVector2D *target);
gdouble             mathVector2D_sine                   (MathVector2D *v1,
                                                         MathVector2D *v2);
gdouble             mathVector3D_sine                   (MathVector3D *v1,
                                                         MathVector3D *v2);
gdouble             mathVector2D_cosine                 (MathVector2D *v1,
                                                         MathVector2D *v2);
gdouble             mathVector3D_cosine                 (MathVector3D *v1,
                                                         MathVector3D *v2);
gdouble             mathVector2D_includedAngle          (MathVector2D *v1,
                                                         MathVector2D *v2);
gint                mathVector2D_dotProduct             (MathVector2D *v1,
                                                         MathVector2D *v2);
gint                mathVector3D_dotProduct             (MathVector3D *v1,
                                                         MathVector3D *v2);
gdouble             mathVector3D_includedAngle          (MathVector3D *v1,
                                                         MathVector3D *v2);
MathVector3D*       vector_crossProduct                 (MathVector3D *result,
                                                         MathVector3D *v1,
                                                         MathVector3D *v2);
MathVector3D*       vectorPoint_crossProduct            (MathVector3D *result,
                                                         Coordinate3D *v1_start,
                                                         Coordinate3D *v1_end,
                                                         Coordinate3D *v2_start,
                                                         Coordinate3D *v2_end);
gdouble             mathVector3D_EuclideanNorm          (MathVector3D *vec);
gdouble             mathVector2D_EuclideanNorm          (MathVector2D *vec);
void                mathBox2D_set                       (MathBox2D *box,
                                                         gint left,
                                                         gint top,
                                                         gint right,
                                                         gint bottom);
void                mathBox2D_copy                      (MathBox2D *dest,
                                                         MathBox2D *src);
gchar*              mathBox2D_to_string                 (MathBox2D *box);
MathBox2D*          mathBox2D_from_string               (MathBox2D *box,
                                                         const gchar *str);
MathBox2D*          mathBox2D_union                     (MathBox2D *resultBox,
                                                         MathBox2D *box1,
                                                         MathBox2D *box2);

Description

Details

FLOAT_TO_INT()

#define FLOAT_TO_INT(f) (gint) rintf(f)

f :


DOUBLE_TO_INT()

#define DOUBLE_TO_INT(d) (gint) rint(d)

d :


Coordinate2D

typedef struct {
    gint x;
    gint y;
} Coordinate2D;


Coordinate3D

typedef struct {
    gint x;
    gint y;
    gint z;
} Coordinate3D;


MathVector2D

typedef Coordinate2D MathVector2D;


MathVector3D

typedef Coordinate3D MathVector3D;


MathBox2D

typedef struct {
    gint left;
    gint right;
    gint top;
    gint bottom;
} MathBox2D;


BoundingBox2D

typedef MathBox2D BoundingBox2D;


BoundingBox

typedef BoundingBox2D BoundingBox;


newCoordinate2D ()

Coordinate2D*       newCoordinate2D                     (gint x,
                                                         gint y);

x :

y :

Returns :


newCoordinate3D ()

Coordinate3D*       newCoordinate3D                     (gint x,
                                                         gint y,
                                                         gint z);

x :

y :

z :

Returns :


coordinate2D_copy ()

void                coordinate2D_copy                   (Coordinate2D *dest,
                                                         Coordinate2D *src);

dest :

src :


coordinate3D_copy ()

void                coordinate3D_copy                   (Coordinate3D *dest,
                                                         Coordinate3D *src);

dest :

src :


coordinate2D_set ()

void                coordinate2D_set                    (Coordinate2D *coord,
                                                         gint x,
                                                         gint y);

coord :

x :

y :


coordinate3D_set ()

void                coordinate3D_set                    (Coordinate3D *coord,
                                                         gint x,
                                                         gint y,
                                                         gint z);

coord :

x :

y :

z :


coordinate2D_to_mathVector2D ()

MathVector2D*       coordinate2D_to_mathVector2D        (MathVector2D *vec,
                                                         Coordinate2D *start,
                                                         Coordinate2D *end);

vec :

start :

end :

Returns :


coordinate3D_to_mathVector3D ()

MathVector3D*       coordinate3D_to_mathVector3D        (MathVector3D *vec,
                                                         Coordinate3D *start,
                                                         Coordinate3D *end);

vec :

start :

end :

Returns :


coordinate2D_to_string ()

gchar*              coordinate2D_to_string              (Coordinate2D *coord);

coord :

Returns :


coordinate3D_to_string ()

gchar*              coordinate3D_to_string              (Coordinate3D *coord);

coord :

Returns :


coordinate2D_cosine ()

gdouble             coordinate2D_cosine                 (Coordinate2D *coord1,
                                                         Coordinate2D *angleCoord,
                                                         Coordinate2D *coord2);

coord1 :

angleCoord :

coord2 :

Returns :


coordinate3D_cosine ()

gdouble             coordinate3D_cosine                 (Coordinate3D *coord1,
                                                         Coordinate3D *angleCoord,
                                                         Coordinate3D *coord2);

coord1 :

angleCoord :

coord2 :

Returns :


coordinate2D_midpoint ()

Coordinate2D*       coordinate2D_midpoint               (Coordinate2D *result,
                                                         Coordinate2D *c1,
                                                         Coordinate2D *c2);

result :

c1 :

c2 :

Returns :


coordinate3D_midpoint ()

Coordinate3D*       coordinate3D_midpoint               (Coordinate3D *result,
                                                         Coordinate3D *c1,
                                                         Coordinate3D *c2);

result :

c1 :

c2 :

Returns :


triangle2D_area_given_Coordinate2D ()

gdouble             triangle2D_area_given_Coordinate2D  (Coordinate2D *c1,
                                                         Coordinate2D *c2,
                                                         Coordinate2D *c3);

c1 :

c2 :

c3 :

Returns :


triangle2D_area_given_points ()

gdouble             triangle2D_area_given_points        (gint p1_x,
                                                         gint p1_y,
                                                         gint p2_x,
                                                         gint p2_y,
                                                         gint p3_x,
                                                         gint p3_y);

p1_x :

p1_y :

p2_x :

p2_y :

p3_x :

p3_y :

Returns :


distance2D_between_point_and_line ()

gdouble             distance2D_between_point_and_line   (Coordinate2D *p,
                                                         Coordinate2D *l1,
                                                         Coordinate2D *l2);

p :

l1 :

l2 :

Returns :


distance2D_between_points ()

gdouble             distance2D_between_points           (Coordinate2D *l1,
                                                         Coordinate2D *l2);

l1 :

l2 :

Returns :


mathVector2D_to_mathVector3D ()

MathVector3D*       mathVector2D_to_mathVector3D        (MathVector3D *vec,
                                                         MathVector2D *src);

vec :

src :

Returns :


mathVector2D_plus ()

MathVector2D*       mathVector2D_plus                   (MathVector2D *result,
                                                         MathVector2D *v1,
                                                         MathVector2D *v2);

result :

v1 :

v2 :

Returns :


mathVector3D_plus ()

MathVector3D*       mathVector3D_plus                   (MathVector3D *result,
                                                         MathVector3D *v1,
                                                         MathVector3D *v2);

result :

v1 :

v2 :

Returns :


mathVector2D_minus ()

MathVector2D*       mathVector2D_minus                  (MathVector2D *result,
                                                         MathVector2D *v1,
                                                         MathVector2D *v2);

result :

v1 :

v2 :

Returns :


mathVector3D_minus ()

MathVector3D*       mathVector3D_minus                  (MathVector3D *result,
                                                         MathVector3D *v1,
                                                         MathVector3D *v2);

result :

v1 :

v2 :

Returns :


mathVector2D_scale ()

MathVector2D*       mathVector2D_scale                  (MathVector2D *result,
                                                         MathVector2D *v,
                                                         gdouble scale);

result :

v :

scale :

Returns :


mathVector3D_scale ()

MathVector3D*       mathVector3D_scale                  (MathVector3D *result,
                                                         MathVector3D *v,
                                                         gdouble scale);

result :

v :

scale :

Returns :


mathVector2D_project ()

MathVector2D*       mathVector2D_project                (MathVector2D *result,
                                                         MathVector2D *v1,
                                                         MathVector2D *v2);

result :

v1 :

v2 :

Returns :


mathVector3D_project ()

MathVector3D*       mathVector3D_project                (MathVector3D *result,
                                                         MathVector3D *v1,
                                                         MathVector3D *v2);

result :

v1 :

v2 :

Returns :


mathVector2D_is_counterclockwise ()

gboolean            mathVector2D_is_counterclockwise    (MathVector2D *src,
                                                         MathVector2D *target);

src :

target :

Returns :


mathVector2D_sine ()

gdouble             mathVector2D_sine                   (MathVector2D *v1,
                                                         MathVector2D *v2);

v1 :

v2 :

Returns :


mathVector3D_sine ()

gdouble             mathVector3D_sine                   (MathVector3D *v1,
                                                         MathVector3D *v2);

v1 :

v2 :

Returns :


mathVector2D_cosine ()

gdouble             mathVector2D_cosine                 (MathVector2D *v1,
                                                         MathVector2D *v2);

v1 :

v2 :

Returns :


mathVector3D_cosine ()

gdouble             mathVector3D_cosine                 (MathVector3D *v1,
                                                         MathVector3D *v2);

v1 :

v2 :

Returns :


mathVector2D_includedAngle ()

gdouble             mathVector2D_includedAngle          (MathVector2D *v1,
                                                         MathVector2D *v2);

v1 :

v2 :

Returns :


mathVector2D_dotProduct ()

gint                mathVector2D_dotProduct             (MathVector2D *v1,
                                                         MathVector2D *v2);

v1 :

v2 :

Returns :


mathVector3D_dotProduct ()

gint                mathVector3D_dotProduct             (MathVector3D *v1,
                                                         MathVector3D *v2);

v1 :

v2 :

Returns :


mathVector3D_includedAngle ()

gdouble             mathVector3D_includedAngle          (MathVector3D *v1,
                                                         MathVector3D *v2);

v1 :

v2 :

Returns :


vector_crossProduct ()

MathVector3D*       vector_crossProduct                 (MathVector3D *result,
                                                         MathVector3D *v1,
                                                         MathVector3D *v2);

result :

v1 :

v2 :

Returns :


vectorPoint_crossProduct ()

MathVector3D*       vectorPoint_crossProduct            (MathVector3D *result,
                                                         Coordinate3D *v1_start,
                                                         Coordinate3D *v1_end,
                                                         Coordinate3D *v2_start,
                                                         Coordinate3D *v2_end);

result :

v1_start :

v1_end :

v2_start :

v2_end :

Returns :


mathVector3D_EuclideanNorm ()

gdouble             mathVector3D_EuclideanNorm          (MathVector3D *vec);

vec :

Returns :


mathVector2D_EuclideanNorm ()

gdouble             mathVector2D_EuclideanNorm          (MathVector2D *vec);

vec :

Returns :


mathBox2D_set ()

void                mathBox2D_set                       (MathBox2D *box,
                                                         gint left,
                                                         gint top,
                                                         gint right,
                                                         gint bottom);

box :

left :

top :

right :

bottom :


mathBox2D_copy ()

void                mathBox2D_copy                      (MathBox2D *dest,
                                                         MathBox2D *src);

dest :

src :


mathBox2D_to_string ()

gchar*              mathBox2D_to_string                 (MathBox2D *box);

box :

Returns :


mathBox2D_from_string ()

MathBox2D*          mathBox2D_from_string               (MathBox2D *box,
                                                         const gchar *str);

box :

str :

Returns :


mathBox2D_union ()

MathBox2D*          mathBox2D_union                     (MathBox2D *resultBox,
                                                         MathBox2D *box1,
                                                         MathBox2D *box2);

resultBox :

box1 :

box2 :

Returns :