1 /*
2 * Inkscape::Util::... some mathmatical functions
3 *
4 * Authors:
5 * Johan Engelen <goejendaagh@zonnet.nl>
6 *
7 * Copyright (C) 2007 Johan Engelen
8 *
9 * Released under GNU GPL, read the file 'COPYING' for more information
10 */
12 #ifndef SEEN_INKSCAPE_UTIL_MATHFNS_H
13 #define SEEN_INKSCAPE_UTIL_MATHFNS_H
16 namespace Inkscape {
18 namespace Util {
20 /**
21 * Returns area in triangle given by points; may be negative.
22 */
23 inline double
24 triangle_area (NR::Point p1, NR::Point p2, NR::Point p3)
25 {
26 return (p1[NR::X]*p2[NR::Y] + p1[NR::Y]*p3[NR::X] + p2[NR::X]*p3[NR::Y] - p2[NR::Y]*p3[NR::X] - p1[NR::Y]*p2[NR::X] - p1[NR::X]*p3[NR::Y]);
27 }
29 }
31 }
33 #endif
34 /*
35 Local Variables:
36 mode:c++
37 c-file-style:"stroustrup"
38 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
39 indent-tabs-mode:nil
40 fill-column:99
41 End:
42 */
43 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :