From c17292fc068e26bbcefcc8778daa5cb07c82f065 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sun, 2 Dec 2007 23:14:54 +0000 Subject: Fix compile. Don't #include .cpp files! (bzr r4157) --- src/util/Makefile_insert | 1 + src/util/mathfns.h | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 src/util/mathfns.h (limited to 'src/util') diff --git a/src/util/Makefile_insert b/src/util/Makefile_insert index 41d3b9fb4..913dda26b 100644 --- a/src/util/Makefile_insert +++ b/src/util/Makefile_insert @@ -16,6 +16,7 @@ util_libinkutil_a_SOURCES = \ util/list.h \ util/list-container.h \ util/map-list.h \ + util/mathfns.h \ util/reverse-list.h \ util/share.h \ util/share.cpp \ diff --git a/src/util/mathfns.h b/src/util/mathfns.h new file mode 100644 index 000000000..9ebd8bc2f --- /dev/null +++ b/src/util/mathfns.h @@ -0,0 +1,43 @@ +/* + * Inkscape::Util::... some mathmatical functions + * + * Authors: + * Johan Engelen + * + * Copyright (C) 2007 Johan Engelen + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#ifndef SEEN_INKSCAPE_UTIL_MATHFNS_H +#define SEEN_INKSCAPE_UTIL_MATHFNS_H + + +namespace Inkscape { + +namespace Util { + +/** + * Returns area in triangle given by points; may be negative. + */ +inline double +triangle_area (NR::Point p1, NR::Point p2, NR::Point p3) +{ + 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]); +} + +} + +} + +#endif +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : -- cgit v1.2.3