From dbe6bf35635c70abdcc3656b3fcb4408fc920c74 Mon Sep 17 00:00:00 2001 From: neoraider Date: Wed, 9 Apr 2008 19:11:05 +0000 Subject: zoomedit: * Added some basic data structures. --- src/Data/Makefile.am | 3 + src/Data/Makefile.in | 438 +++++++++++++++++++++++++++++++++++++++++++++++++ src/Data/Triangle.cpp | 28 ++++ src/Data/Triangle.h | 40 +++++ src/Data/Vector.cpp | 83 ++++++++++ src/Data/Vector.h | 65 ++++++++ src/Data/Vertex.cpp | 63 +++++++ src/Data/Vertex.h | 60 +++++++ src/Gui/Makefile.in | 2 - src/Gui/RenderArea.cpp | 2 +- src/Instance.h | 2 +- src/Makefile.am | 4 +- src/Makefile.in | 10 +- 13 files changed, 788 insertions(+), 12 deletions(-) create mode 100644 src/Data/Makefile.am create mode 100644 src/Data/Makefile.in create mode 100644 src/Data/Triangle.cpp create mode 100644 src/Data/Triangle.h create mode 100644 src/Data/Vector.cpp create mode 100644 src/Data/Vector.h create mode 100644 src/Data/Vertex.cpp create mode 100644 src/Data/Vertex.h (limited to 'src') diff --git a/src/Data/Makefile.am b/src/Data/Makefile.am new file mode 100644 index 0000000..51afca5 --- /dev/null +++ b/src/Data/Makefile.am @@ -0,0 +1,3 @@ +noinst_LTLIBRARIES = libdata.la + +libdata_la_SOURCES = Triangle.cpp Vector.cpp Vertex.cpp \ No newline at end of file diff --git a/src/Data/Makefile.in b/src/Data/Makefile.in new file mode 100644 index 0000000..bcc5af8 --- /dev/null +++ b/src/Data/Makefile.in @@ -0,0 +1,438 @@ +# Makefile.in generated by automake 1.10.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/Data +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/src/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libdata_la_LIBADD = +am_libdata_la_OBJECTS = Triangle.lo Vector.lo Vertex.lo +libdata_la_OBJECTS = $(am_libdata_la_OBJECTS) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libdata_la_SOURCES) +DIST_SOURCES = $(libdata_la_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GREP = @GREP@ +GTKGLEXT_CFLAGS = @GTKGLEXT_CFLAGS@ +GTKGLEXT_LIBS = @GTKGLEXT_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +glademm_CFLAGS = @glademm_CFLAGS@ +glademm_LIBS = @glademm_LIBS@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +noinst_LTLIBRARIES = libdata.la +libdata_la_SOURCES = Triangle.cpp Vector.cpp Vertex.cpp +all: all-am + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Data/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/Data/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libdata.la: $(libdata_la_OBJECTS) $(libdata_la_DEPENDENCIES) + $(CXXLINK) $(libdata_la_OBJECTS) $(libdata_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Triangle.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Vector.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Vertex.Plo@am__quote@ + +.cpp.o: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cpp.obj: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cpp.lo: +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/Data/Triangle.cpp b/src/Data/Triangle.cpp new file mode 100644 index 0000000..9adbaba --- /dev/null +++ b/src/Data/Triangle.cpp @@ -0,0 +1,28 @@ +/* + * Triangle.cpp + * + * Copyright (C) 2008 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include "Triangle.h" + +namespace ZoomEdit { +namespace Data { + + + +} +} diff --git a/src/Data/Triangle.h b/src/Data/Triangle.h new file mode 100644 index 0000000..03e0fa4 --- /dev/null +++ b/src/Data/Triangle.h @@ -0,0 +1,40 @@ +/* + * Triangle.h + * + * Copyright (C) 2008 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef ZOOMEDIT_DATA_TRIANGLE_H_ +#define ZOOMEDIT_DATA_TRIANGLE_H_ + +#include "Vertex.h" + +namespace ZoomEdit { +namespace Data { + +class Triangle { + private: + Vertex a, b, c; + Vector na, nb, nc; + + public: + Triangle(Vertex a0, Vertex b0, Vertex c0) : a(a0), b(b0), c(c0) {} +}; + +} +} + +#endif /*ZOOMEDIT_DATA_TRIANGLE_H_*/ diff --git a/src/Data/Vector.cpp b/src/Data/Vector.cpp new file mode 100644 index 0000000..ad17447 --- /dev/null +++ b/src/Data/Vector.cpp @@ -0,0 +1,83 @@ +/* + * Vector.cpp + * + * Copyright (C) 2008 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include "Vector.h" +#include + +namespace ZoomEdit { +namespace Data { + +float Vector::lengthSq() const { + return x*x + y*y + z*z; +} + +float Vector::length() const { + return std::sqrt(lengthSq()); +} + +Vector Vector::operator+(const Vector &v) const { + return Vector(x + v.x, y + v.y, z + v.z); +} + +Vector Vector::operator-(const Vector &v) const { + return Vector(x - v.x, y - v.y, z - v.z); +} + +Vector Vector::operator*(float f) const { + return Vector(x*f, y*f, z*f); +} + +Vector Vector::operator/(float f) const { + return Vector(x/f, y/f, z/f); +} + +Vector& Vector::operator+=(const Vector &v) { + x += v.x; + y += v.y; + z += v.z; + + return *this; +} + +Vector& Vector::operator-=(const Vector &v) { + x -= v.x; + y -= v.y; + z -= v.z; + + return *this; +} + +Vector& Vector::operator*=(float f) { + x *= f; + y *= f; + z *= f; + + return *this; +} + +Vector& Vector::operator/=(float f) { + x /= f; + y /= f; + z /= f; + + return *this; +} + +} +} diff --git a/src/Data/Vector.h b/src/Data/Vector.h new file mode 100644 index 0000000..5d9fd1e --- /dev/null +++ b/src/Data/Vector.h @@ -0,0 +1,65 @@ +/* + * Vector.h + * + * Copyright (C) 2008 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef ZOOMEDIT_DATA_VECTOR_H_ +#define ZOOMEDIT_DATA_VECTOR_H_ + +namespace ZoomEdit { +namespace Data { + +class Vector { + private: + float x, y, z; + + public: + Vector() : x(0), y(0), z(0) {} + Vector(float x0, float y0, float z0) : x(x0), y(y0), z(z0) {} + + float getX() const {return x;} + void setX(float x0) {x = x0;} + + float getY() const {return y;} + void setY(float y0) {y = y0;} + + float getZ() const {return z;} + void setZ(float z0) {z = z0;} + + float lengthSq() const; + float length() const; + + void normalize() { + if(lengthSq()) + *this /= length(); + } + + Vector operator+(const Vector &v) const; + Vector operator-(const Vector &v) const; + Vector operator*(float f) const; + Vector operator/(float f) const; + + Vector& operator+=(const Vector &v); + Vector& operator-=(const Vector &v); + Vector& operator*=(float f); + Vector& operator/=(float f); +}; + +} +} + +#endif /*ZOOMEDIT_DATA_VECTOR_H_*/ diff --git a/src/Data/Vertex.cpp b/src/Data/Vertex.cpp new file mode 100644 index 0000000..24e34ba --- /dev/null +++ b/src/Data/Vertex.cpp @@ -0,0 +1,63 @@ +/* + * Vertex.cpp + * + * Copyright (C) 2008 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include "Vertex.h" +#include + +namespace ZoomEdit { +namespace Data { + +float Vertex::distanceSq(const Vertex &v) const { + return (x - v.x)*(x - v.x) + (y - v.y)*(y - v.y) + (z - v.z)*(z - v.z); +} + +float Vertex::distance(const Vertex &v) const { + return std::sqrt(distanceSq(v)); +} + +Vector Vertex::operator-(const Vertex &v) const { + return Vector(x - v.x, y - v.y, z - v.z); +} + +Vertex Vertex::operator+(const Vector &v) const { + return Vertex(x + v.getX(), y + v.getY(), z + v.getZ()); +} + +Vertex Vertex::operator-(const Vector &v) const { + return Vertex(x - v.getX(), y - v.getY(), z - v.getZ()); +} + +Vertex& Vertex::operator+=(const Vector &v) { + x += v.getX(); + y += v.getY(); + z += v.getZ(); + + return *this; +} + +Vertex& Vertex::operator-=(const Vector &v) { + x -= v.getX(); + y -= v.getY(); + z -= v.getZ(); + + return *this; +} + +} +} diff --git a/src/Data/Vertex.h b/src/Data/Vertex.h new file mode 100644 index 0000000..a9660c4 --- /dev/null +++ b/src/Data/Vertex.h @@ -0,0 +1,60 @@ +/* + * Vertex.h + * + * Copyright (C) 2008 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef ZOOMEDIT_DATA_VERTEX_H_ +#define ZOOMEDIT_DATA_VERTEX_H_ + +#include "Vector.h" + +namespace ZoomEdit { +namespace Data { + +class Vertex { + private: + float x, y, z; + + public: + Vertex() : x(0), y(0), z(0) {} + Vertex(float x0, float y0, float z0) : x(x0), y(y0), z(z0) {} + + float getX() const {return x;} + void setX(float x0) {x = x0;} + + float getY() const {return y;} + void setY(float y0) {y = y0;} + + float getZ() const {return z;} + void setZ(float z0) {z = z0;} + + float distanceSq(const Vertex &v) const; + float distance(const Vertex &v) const; + + Vector operator-(const Vertex &v) const; + + Vertex operator+(const Vector &v) const; + Vertex operator-(const Vector &v) const; + + Vertex& operator+=(const Vector &v); + Vertex& operator-=(const Vector &v); +}; + +} +} + +#endif /*ZOOMEDIT_DATA_VERTEX_H_*/ diff --git a/src/Gui/Makefile.in b/src/Gui/Makefile.in index 61b6676..267ad62 100644 --- a/src/Gui/Makefile.in +++ b/src/Gui/Makefile.in @@ -81,7 +81,6 @@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ -DSYMUTIL = @DSYMUTIL@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ @@ -107,7 +106,6 @@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ -NMEDIT = @NMEDIT@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ diff --git a/src/Gui/RenderArea.cpp b/src/Gui/RenderArea.cpp index 9e96352..5d0b2b3 100644 --- a/src/Gui/RenderArea.cpp +++ b/src/Gui/RenderArea.cpp @@ -31,7 +31,7 @@ namespace Gui { GdkGLConfig *RenderArea::glconfig = NULL; RenderArea::RenderArea(BaseObjectType *cobject, const Glib::RefPtr &xml) -: Gtk::DrawingArea(cobject), zoomLevel(0), scale(100), xCenter(0), yCenter(0) { +: Gtk::DrawingArea(cobject), xCenter(0), yCenter(0), zoomLevel(0), scale(100) { if(!glconfig) { glconfig = gdk_gl_config_new_by_mode((GdkGLConfigMode)(GDK_GL_MODE_RGB | GDK_GL_MODE_DOUBLE)); if(!glconfig) glconfig = gdk_gl_config_new_by_mode(GDK_GL_MODE_RGB); // Hmm, can't find double buffered config diff --git a/src/Instance.h b/src/Instance.h index c53ac44..ced1fdc 100644 --- a/src/Instance.h +++ b/src/Instance.h @@ -47,7 +47,7 @@ class Instance { // Prevent shallow copy Instance(const Instance &o); - const Instance& operator=(const Instance &o); + Instance& operator=(const Instance &o); }; } diff --git a/src/Makefile.am b/src/Makefile.am index f96563b..91ccb33 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,6 +1,6 @@ -SUBDIRS = Gui +SUBDIRS = Data Gui bin_PROGRAMS = zoomedit zoomedit_SOURCES = zoomedit.cpp Instance.cpp zoomedit_CPPFLAGS = $(glademm_CFLAGS) $(GTKGLEXT_CFLAGS) -zoomedit_LDADD = Gui/libgui.la $(glademm_LIBS) $(GTKGLEXT_LIBS) +zoomedit_LDADD = Data/libdata.la Gui/libgui.la $(glademm_LIBS) $(GTKGLEXT_LIBS) diff --git a/src/Makefile.in b/src/Makefile.in index e9f1003..4b4ab2e 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -50,8 +50,8 @@ am_zoomedit_OBJECTS = zoomedit-zoomedit.$(OBJEXT) \ zoomedit-Instance.$(OBJEXT) zoomedit_OBJECTS = $(am_zoomedit_OBJECTS) am__DEPENDENCIES_1 = -zoomedit_DEPENDENCIES = Gui/libgui.la $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) +zoomedit_DEPENDENCIES = Data/libdata.la Gui/libgui.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @@ -98,7 +98,6 @@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ -DSYMUTIL = @DSYMUTIL@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ @@ -124,7 +123,6 @@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ -NMEDIT = @NMEDIT@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ @@ -193,10 +191,10 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -SUBDIRS = Gui +SUBDIRS = Data Gui zoomedit_SOURCES = zoomedit.cpp Instance.cpp zoomedit_CPPFLAGS = $(glademm_CFLAGS) $(GTKGLEXT_CFLAGS) -zoomedit_LDADD = Gui/libgui.la $(glademm_LIBS) $(GTKGLEXT_LIBS) +zoomedit_LDADD = Data/libdata.la Gui/libgui.la $(glademm_LIBS) $(GTKGLEXT_LIBS) all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive -- cgit v1.2.3