├── .gitignore ├── AUTHORS.md ├── Android.mk ├── CMakeLists.txt ├── ChangeLog ├── LICENSE.md ├── README.md ├── bin └── kaztest_gen ├── cmake_modules └── KAZMATHConfig.cmake ├── debian ├── changelog ├── control ├── copyright ├── rules └── source │ └── format ├── docs ├── html │ ├── aabb_8c-source.html │ ├── aabb_8c.html │ ├── aabb_8h-source.html │ ├── aabb_8h.html │ ├── annotated.html │ ├── classes.html │ ├── doxygen.css │ ├── doxygen.png │ ├── files.html │ ├── functions.html │ ├── functions_vars.html │ ├── globals.html │ ├── globals_0x61.html │ ├── globals_0x63.html │ ├── globals_0x64.html │ ├── globals_0x65.html │ ├── globals_0x67.html │ ├── globals_0x69.html │ ├── globals_0x6b.html │ ├── globals_0x6c.html │ ├── globals_0x6d.html │ ├── globals_0x70.html │ ├── globals_0x71.html │ ├── globals_0x72.html │ ├── globals_0x73.html │ ├── globals_0x74.html │ ├── globals_0x76.html │ ├── globals_defs.html │ ├── globals_enum.html │ ├── globals_eval.html │ ├── globals_func.html │ ├── globals_func_0x61.html │ ├── globals_func_0x64.html │ ├── globals_func_0x67.html │ ├── globals_func_0x6c.html │ ├── globals_func_0x6d.html │ ├── globals_func_0x70.html │ ├── globals_func_0x71.html │ ├── globals_func_0x72.html │ ├── globals_func_0x73.html │ ├── globals_func_0x76.html │ ├── globals_type.html │ ├── globals_vars.html │ ├── graph_legend.dot │ ├── graph_legend.html │ ├── index.html │ ├── kazmath_8h-source.html │ ├── kazmath_8h.html │ ├── mat3_8c-source.html │ ├── mat3_8c.html │ ├── mat3_8h-source.html │ ├── mat3_8h.html │ ├── mat4_8c-source.html │ ├── mat4_8c.html │ ├── mat4_8h-source.html │ ├── mat4_8h.html │ ├── mat4stack_8c-source.html │ ├── mat4stack_8c.html │ ├── mat4stack_8h-source.html │ ├── mat4stack_8h.html │ ├── matrix_8c-source.html │ ├── matrix_8c.html │ ├── matrix_8h-source.html │ ├── matrix_8h.html │ ├── plane_8c-source.html │ ├── plane_8c.html │ ├── plane_8h-source.html │ ├── plane_8h.html │ ├── quaternion_8c-source.html │ ├── quaternion_8c.html │ ├── quaternion_8h-source.html │ ├── quaternion_8h.html │ ├── structkm__mat4__stack.html │ ├── structkm_a_a_b_b.html │ ├── structkm_mat3.html │ ├── structkm_mat4.html │ ├── structkm_plane.html │ ├── structkm_quaternion.html │ ├── structkm_vec2.html │ ├── structkm_vec3.html │ ├── structkm_vec4.html │ ├── structtagkm_mat3.html │ ├── tab_b.gif │ ├── tab_l.gif │ ├── tab_r.gif │ ├── tabs.css │ ├── utility_8c-source.html │ ├── utility_8c.html │ ├── utility_8h-source.html │ ├── utility_8h.html │ ├── vec2_8c-source.html │ ├── vec2_8c.html │ ├── vec2_8h-source.html │ ├── vec2_8h.html │ ├── vec3_8c-source.html │ ├── vec3_8c.html │ ├── vec3_8h-source.html │ ├── vec3_8h.html │ ├── vec4_8c-source.html │ ├── vec4_8c.html │ ├── vec4_8h-source.html │ └── vec4_8h.html └── latex │ ├── FreeSans.ttf │ ├── Makefile │ ├── aabb_8c.tex │ ├── aabb_8h.tex │ ├── annotated.tex │ ├── doxygen.sty │ ├── files.tex │ ├── kazmath_8h.tex │ ├── mat3_8c.tex │ ├── mat3_8h.tex │ ├── mat4_8c.tex │ ├── mat4_8h.tex │ ├── mat4stack_8c.tex │ ├── mat4stack_8h.tex │ ├── matrix_8c.tex │ ├── matrix_8h.tex │ ├── plane_8c.tex │ ├── plane_8h.tex │ ├── quaternion_8c.tex │ ├── quaternion_8h.tex │ ├── refman.tex │ ├── structkm__mat4__stack.tex │ ├── structkm_a_a_b_b.tex │ ├── structkm_mat3.tex │ ├── structkm_mat4.tex │ ├── structkm_plane.tex │ ├── structkm_quaternion.tex │ ├── structkm_vec2.tex │ ├── structkm_vec3.tex │ ├── structkm_vec4.tex │ ├── structtagkm_mat3.tex │ ├── utility_8c.tex │ ├── utility_8h.tex │ ├── vec2_8c.tex │ ├── vec2_8h.tex │ ├── vec3_8c.tex │ ├── vec3_8h.tex │ ├── vec4_8c.tex │ └── vec4_8h.tex ├── java ├── CMakeLists.txt ├── jni │ └── kazmath.c ├── kazmath │ └── jkazmath.java └── sample │ └── test.java ├── kazmath.config ├── kazmath.creator ├── kazmath.files ├── kazmath.includes ├── kazmath.recipe ├── kazmath ├── CMakeLists.txt ├── GL │ ├── mat4stack.c │ ├── mat4stack.h │ ├── matrix.c │ └── matrix.h ├── aabb2.c ├── aabb2.h ├── aabb3.c ├── aabb3.h ├── kazmath.h ├── mat3.c ├── mat3.h ├── mat4.c ├── mat4.h ├── plane.c ├── plane.h ├── quaternion.c ├── quaternion.h ├── ray2.c ├── ray2.h ├── ray3.c ├── ray3.h ├── utility.c ├── utility.h ├── vec2.c ├── vec2.h ├── vec3.c ├── vec3.h ├── vec4.c └── vec4.h ├── kazmathxx ├── CMakeLists.txt ├── aabb2.h ├── boundvec2.h ├── mat3.h ├── mat4.h ├── plane.h ├── quad.h ├── quaternion.h ├── vec2.h ├── vec3.h └── vec4.h ├── lua ├── CMakeLists.txt ├── README.md ├── lkazmath.c ├── test.lua └── unit_test │ ├── mat.lua │ ├── ray.lua │ └── vec.lua ├── test-apps ├── CUnitTest │ ├── CUnitTest.cbp │ ├── CUnitTest.depend │ ├── CUnitTest.layout │ ├── bin │ │ └── Debug │ │ │ └── CUnitTest │ ├── kazmath_mat_stack_test │ │ └── main.cpp │ ├── main.c │ ├── testMat3.c │ ├── testMat4.c │ ├── testMatrixStack.c │ ├── testVec2.c │ ├── testVec3.c │ └── testVec4.c └── PerspectiveMatrix │ ├── PerspectiveMatrix.cbp │ ├── PerspectiveMatrix.depend │ ├── PerspectiveMatrix.layout │ ├── bin │ └── Debug │ │ └── PerspectiveMatrix │ └── src │ ├── basecode │ ├── GLee │ │ ├── GLee.cpp │ │ └── GLee.h │ ├── input.cpp │ ├── input.h │ ├── lesson.cpp │ ├── lesson.h │ ├── window.cpp │ └── window.h │ ├── main.cpp │ ├── perspective_test.cpp │ └── perspective_test.h └── tests ├── CMakeLists.txt ├── kaztest └── kaztest.h ├── test_aabb.h ├── test_mat3.h ├── test_mat4.h ├── test_plane.h ├── test_quaternion.h ├── test_ray2.h ├── test_ray3.h ├── test_vec2.h └── test_vec3.h /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *.orig 3 | *.o 4 | build 5 | tests/main.cpp 6 | -------------------------------------------------------------------------------- /AUTHORS.md: -------------------------------------------------------------------------------- 1 | # Authors 2 | 3 | Kazmath wouldn't have been possible without the following awesome people: 4 | 5 | - Luke Benstead - kazade@gmail.com 6 | - Carsten Haubold 7 | - Carlos Carrasco 8 | - chris 9 | - Cloudef 10 | - Daniel Rosser 11 | - David Givone 12 | - David Hontecillas 13 | - Henry Stratmann III 14 | - Jari Vetoniemi 15 | - starbugs 16 | - Teemu Erkkola 17 | 18 | -------------------------------------------------------------------------------- /Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | include $(CLEAR_VARS) 3 | LOCAL_MODULE := kazmath 4 | LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*/*.c) 5 | LOCAL_SRC_FILES := $(LOCAL_SRC_FILES:$(LOCAL_PATH)/%=%) 6 | LOCAL_CFLAGS := "-std=c99" 7 | include $(BUILD_SHARED_LIBRARY) 8 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Kazmath is a 3D math library aimed at game programming. It is released under the modified BSD license. 2 | 3 | Authors 4 | 5 | Luke Benstead 6 | Carsten Haubold 7 | 8 | License 9 | 10 | Copyright (c) 2008, Luke Benstead. 11 | All rights reserved. 12 | 13 | Redistribution and use in source and binary forms, with or without modification, 14 | are permitted provided that the following conditions are met: 15 | 16 | * Redistributions of source code must retain the above copyright notice, 17 | this list of conditions and the following disclaimer. 18 | * Redistributions in binary form must reproduce the above copyright notice, 19 | this list of conditions and the following disclaimer in the documentation 20 | and/or other materials provided with the distribution. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 23 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 26 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 27 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 29 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 31 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | 34 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # Kazmath 3 | 4 | Kazmath is a simple 3D maths library written in C. It was initially coded for use in my book, Beginning OpenGL Game Programming - Second edition, but rapidly gained a life of its own. Kazmath is now used by many different projects, and apparently is used in 25% of the worlds mobile games (yeah, I don't believe it either - but it's used in Cocos2d-x). 5 | 6 | If you are using Kazmath in a project, I'd be happy to hear about it. Find me on Twitter as @kazade. 7 | 8 | # Compiling 9 | 10 | Compiling is simple using CMake, on Linux: 11 | 12 | mkdir build 13 | cd build 14 | cmake .. 15 | make 16 | sudo make install 17 | 18 | On other platforms use CMake to generate an appropriate project file. 19 | 20 | If you want to build shared libraries you should pass `-DBUILD_SHARED_LIBS=YES` to the cmake command 21 | 22 | # Contributing 23 | 24 | There are many improvements that could be made to kazmath, including: 25 | 26 | - More tests 27 | - More optimizations 28 | - More functions, and primitives 29 | - More bindings (e.g. Python) 30 | 31 | All contributions are welcome. Just send me a pull request on GitHub and I'll review and probably merge! 32 | 33 | # Donations 34 | 35 | If you like what I do, I'm happy to receive donations in DOGE to this address: D6uwEfChxWmWjFGs4jT8VRtabYaza5oAGx :) 36 | 37 | Thank you! 38 | -------------------------------------------------------------------------------- /cmake_modules/KAZMATHConfig.cmake: -------------------------------------------------------------------------------- 1 | FIND_PATH( KAZMATH_INCLUDE_DIRS kazmath/vec3.h /usr/include /usr/local/include $ENV{INCLUDE} ) 2 | FIND_LIBRARY( KAZMATH_LIBRARIES NAMES kazmath PATHS /usr/lib /usr/local/lib ) 3 | 4 | IF(KAZMATH_INCLUDE_DIRS) 5 | MESSAGE(STATUS "Found Kazmath include dir: ${KAZMATH_INCLUDE_DIRS}") 6 | ELSE(KAZMATH_INCLUDE_DIRS) 7 | MESSAGE(STATUS "Could NOT find Kazmath headers.") 8 | ENDIF(KAZMATH_INCLUDE_DIRS) 9 | 10 | IF(KAZMATH_LIBRARIES) 11 | MESSAGE(STATUS "Found Kazmath library: ${KAZMATH_LIBRARIES}") 12 | ELSE(KAZMATH_LIBRARIES) 13 | MESSAGE(STATUS "Could NOT find Kazmath library.") 14 | ENDIF(KAZMATH_LIBRARIES) 15 | 16 | IF(KAZMATH_INCLUDE_DIRS AND KAZMATH_LIBRARIES) 17 | SET(KAZMATH_FOUND "YES") 18 | ELSE(KAZMATH_INCLUDE_DIRS AND KAZMATH_LIBRARIES) 19 | SET(KAZMATH_FOUND "NO") 20 | IF(KAZMATH_FIND_REQUIRED) 21 | MESSAGE(FATAL_ERROR "Could not find Kazmath. Please install Kazmath (http://github.com/kazade/kazmath)") 22 | ENDIF(KAZMATH_FIND_REQUIRED) 23 | ENDIF(KAZMATH_INCLUDE_DIRS AND KAZMATH_LIBRARIES) 24 | -------------------------------------------------------------------------------- /debian/changelog: -------------------------------------------------------------------------------- 1 | libkazmath-dev (1.1.0) maverick; urgency=low 2 | 3 | * Numerous bugfixes 4 | 5 | -- Luke Benstead (Kazade) Sat, 8 Jan 2011 08:59:00 +1100 6 | 7 | libkazmath-dev (1.0.0) jaunty; urgency=low 8 | 9 | * debian/control: 10 | - initial packaged version 11 | 12 | -- Luke Benstead (Kazade) Sat, 04 Apr 2009 13:42:42 +1100 13 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: libkazmath-dev 2 | Priority: optional 3 | Section: libs 4 | Maintainer: Luke Benstead (Kazade) 5 | Build-Depends: dpkg (>= 1.13.2), debhelper (>= 4.0), cmake (>= 2), libunittest++-dev 6 | Standards-Version: 3.9.1 7 | 8 | Package: libkazmath-dev 9 | Architecture: any 10 | Section: libdevel 11 | Description: Kazmath 3D math library development files 12 | Kazmath is a 3D math library written in C. 13 | . 14 | This package contains the files needed to compile and link programs which 15 | use Kazmath. 16 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | This package was debianized by Luke Benstead 2 | Sat, 04 Apr 2009 13:42:42 +1100 3 | 4 | It was downloaded from: http://www.kazade.co.uk/kazmath 5 | 6 | Upstream Author(s): {Name(s) and email address(es) of author(s)} 7 | 8 | Copyright: 9 | Copyright (C) 2008-2009 by Luke Benstead and Carsten Haubold 10 | 11 | License: 12 | Redistribution and use in source and binary forms, with or without modification, 13 | are permitted provided that the following conditions are met: 14 | 15 | * Redistributions of source code must retain the above copyright notice, 16 | this list of conditions and the following disclaimer. 17 | * Redistributions in binary form must reproduce the above copyright notice, 18 | this list of conditions and the following disclaimer in the documentation 19 | and/or other materials provided with the distribution. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 22 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 23 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 25 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 27 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 28 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # Sample debian/rules file - for GNU Hello. 3 | # Copyright 1994,1995 by Ian Jackson. 4 | # I hereby give you perpetual unlimited permission to copy, 5 | # modify and relicense this file, provided that you do not remove 6 | # my name from the file itself. (I assert my moral right of 7 | # paternity under the Copyright, Designs and Patents Act 1988.) 8 | # This file may have to be extensively modified 9 | 10 | package = libkazmath-dev 11 | docdir = debian/tmp/usr/share/doc/$(package) 12 | 13 | CC = gcc 14 | CFLAGS = -g -Wall 15 | INSTALL_PROGRAM = install 16 | 17 | ifeq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) 18 | CFLAGS += -O2 19 | endif 20 | ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) 21 | INSTALL_PROGRAM += -s 22 | endif 23 | 24 | build: 25 | $(checkdir) 26 | cmake -DCMAKE_INSTALL_PREFIX=/usr . 27 | $(MAKE) CC="$(CC)" CFLAGS="$(CFLAGS)" 28 | touch build 29 | 30 | clean: 31 | $(checkdir) 32 | rm -f build 33 | cmake -DCMAKE_INSTALL_PREFIX=/usr . 34 | [ ! -f Makefile ] || $(MAKE) clean 35 | rm -r *.cmake Makefile CMakeFiles CMakeCache.txt 36 | rm -rf *~ debian/tmp debian/*~ debian/files* debian/substvars 37 | 38 | binary-indep: checkroot build 39 | $(checkdir) 40 | # There are no architecture-independent files to be uploaded 41 | # generated by this package. If there were any they would be 42 | # made here. 43 | 44 | binary-arch: checkroot build 45 | $(checkdir) 46 | rm -rf debian/tmp 47 | install -d debian/tmp/DEBIAN $(docdir) 48 | #install -m 755 debian/postinst debian/prerm debian/tmp/DEBIAN 49 | #$(MAKE) INSTALL_PROGRAM="$(INSTALL_PROGRAM)" \ 50 | # prefix=$$(pwd)/debian/tmp/usr install 51 | $(MAKE) DESTDIR=$(CURDIR)/debian/tmp $(INSTALL_PROGRAM) 52 | cp -a debian/copyright $(docdir) 53 | cp -a debian/changelog $(docdir)/changelog.Debian 54 | cp -a ChangeLog $(docdir)/changelog 55 | cd $(docdir) && gzip -9 changelog changelog.Debian 56 | #dpkg-shlibdeps debian/tmp/usr/bin/hello 57 | dpkg-gencontrol -isp 58 | chown -R root:root debian/tmp 59 | chmod -R u+w,go=rX debian/tmp 60 | dpkg --build debian/tmp .. 61 | 62 | define checkdir 63 | test -f CMakeLists.txt -a -f debian/rules 64 | endef 65 | 66 | binary: binary-indep binary-arch 67 | 68 | checkroot: 69 | $(checkdir) 70 | test $$(id -u) = 0 71 | 72 | .PHONY: binary binary-arch binary-indep clean checkroot 73 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 1.0 2 | -------------------------------------------------------------------------------- /docs/html/annotated.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Kazmath: Data Structures 4 | 5 | 6 | 7 | 8 | 25 |
26 |

Data Structures

Here are the data structures with brief descriptions: 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 |
km_mat4_stack
kmAABB
kmMat3
kmMat4
kmPlane
kmQuaternion
kmVec2
kmVec3
kmVec4
kazmathxx::Mat3
kazmathxx::Mat4
kazmathxx::Plane
kazmathxx::Quaternion
kazmathxx::Vec2
kazmathxx::Vec3
43 |
44 |
Generated on Mon Dec 29 18:40:11 2008 for Kazmath by  45 | 46 | doxygen 1.5.6
47 | 48 | 49 | -------------------------------------------------------------------------------- /docs/html/classes.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Kazmath: Alphabetical List 4 | 5 | 6 | 7 | 8 | 23 |
24 |

Data Structure Index

A | M | P | Q | V | _

25 | 26 |
  A  
27 |
kmMat3   kmPlane   
  V  
28 |
kmVec4   
kmAABB   kmMat4   
  Q  
29 |
kmVec2   
  _  
30 |
  M  
31 |
  P  
32 |
kmQuaternion   kmVec3   km_mat4_stack   

A | M | P | Q | V | _

33 |

34 |
Generated on Tue Oct 28 11:00:21 2008 for Kazmath by  35 | 36 | doxygen 1.5.7.1
37 | 38 | 39 | -------------------------------------------------------------------------------- /docs/html/doxygen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kazade/kazmath/48dbc191da47880ea6708b0a7b3c7b69b6352cad/docs/html/doxygen.png -------------------------------------------------------------------------------- /docs/html/globals_0x61.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Kazmath: Data Fields 4 | 5 | 6 | 7 | 8 | 55 |
56 | Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to: 57 |

58 |

- a -

69 |
70 |
Generated on Mon Dec 29 18:40:11 2008 for Kazmath by  71 | 72 | doxygen 1.5.6
73 | 74 | 75 | -------------------------------------------------------------------------------- /docs/html/globals_0x63.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Kazmath: Data Fields 4 | 5 | 6 | 7 | 8 | 55 |
56 | Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to: 57 |

58 |

- c -

    59 |
  • current_stack 60 | : matrix.c 61 |
62 |
63 |
Generated on Mon Dec 29 18:40:11 2008 for Kazmath by  64 | 65 | doxygen 1.5.6
66 | 67 | 68 | -------------------------------------------------------------------------------- /docs/html/globals_0x64.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Kazmath: Data Fields 4 | 5 | 6 | 7 | 8 | 55 |
56 | Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to: 57 |

58 |

- d -

63 |
64 |
Generated on Mon Dec 29 18:40:11 2008 for Kazmath by  65 | 66 | doxygen 1.5.6
67 | 68 | 69 | -------------------------------------------------------------------------------- /docs/html/globals_0x65.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Kazmath: Data Fields 4 | 5 | 6 | 7 | 8 | 55 |
56 | Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to: 57 |

58 |

- e -

62 |
63 |
Generated on Mon Dec 29 18:40:11 2008 for Kazmath by  64 | 65 | doxygen 1.5.6
66 | 67 | 68 | -------------------------------------------------------------------------------- /docs/html/globals_0x69.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Kazmath: Data Fields 4 | 5 | 6 | 7 | 8 | 55 |
56 | Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to: 57 |

58 |

- i -

64 |
65 |
Generated on Mon Dec 29 18:40:11 2008 for Kazmath by  66 | 67 | doxygen 1.5.6
68 | 69 | 70 | -------------------------------------------------------------------------------- /docs/html/globals_0x6b.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Kazmath: Data Fields 4 | 5 | 6 | 7 | 8 | 55 |
56 | Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to: 57 |

58 |

- k -

70 |
71 |
Generated on Mon Dec 29 18:40:11 2008 for Kazmath by  72 | 73 | doxygen 1.5.6
74 | 75 | 76 | -------------------------------------------------------------------------------- /docs/html/globals_0x6c.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Kazmath: Data Fields 4 | 5 | 6 | 7 | 8 | 55 |
56 | Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to: 57 |

58 |

- l -

    59 |
  • lazyInitialize() 60 | : matrix.c 61 |
62 |
63 |
Generated on Mon Dec 29 18:40:11 2008 for Kazmath by  64 | 65 | doxygen 1.5.6
66 | 67 | 68 | -------------------------------------------------------------------------------- /docs/html/globals_0x72.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Kazmath: Data Fields 4 | 5 | 6 | 7 | 8 | 55 |
56 | Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to: 57 |

58 |

- r -

63 |
64 |
Generated on Mon Dec 29 18:40:11 2008 for Kazmath by  65 | 66 | doxygen 1.5.6
67 | 68 | 69 | -------------------------------------------------------------------------------- /docs/html/globals_0x73.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Kazmath: Data Fields 4 | 5 | 6 | 7 | 8 | 55 |
56 | Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to: 57 |

58 |

- s -

67 |
68 |
Generated on Mon Dec 29 18:40:11 2008 for Kazmath by  69 | 70 | doxygen 1.5.6
71 | 72 | 73 | -------------------------------------------------------------------------------- /docs/html/globals_0x74.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Kazmath: Data Fields 4 | 5 | 6 | 7 | 8 | 55 |
56 | Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to: 57 |

58 |

- t -

    59 |
  • texture_matrix_stack 60 | : matrix.c 61 |
62 |
63 |
Generated on Mon Dec 29 18:40:11 2008 for Kazmath by  64 | 65 | doxygen 1.5.6
66 | 67 | 68 | -------------------------------------------------------------------------------- /docs/html/globals_defs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Kazmath: Data Fields 4 | 5 | 6 | 7 | 8 | 35 |
36 |   37 |

38 |

66 |
67 |
Generated on Mon Dec 29 18:40:11 2008 for Kazmath by  68 | 69 | doxygen 1.5.6
70 | 71 | 72 | -------------------------------------------------------------------------------- /docs/html/globals_enum.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Kazmath: Data Fields 4 | 5 | 6 | 7 | 8 | 35 |
36 |   37 |

38 |

    39 |
  • POINT_CLASSIFICATION 40 | : plane.h 41 |
42 |
43 |
Generated on Mon Dec 29 18:40:11 2008 for Kazmath by  44 | 45 | doxygen 1.5.6
46 | 47 | 48 | -------------------------------------------------------------------------------- /docs/html/globals_eval.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Kazmath: Data Fields 4 | 5 | 6 | 7 | 8 | 35 |
36 |   37 |

38 |

    39 |
  • POINT_BEHIND_PLANE 40 | : plane.h 41 |
  • POINT_INFRONT_OF_PLANE 42 | : plane.h 43 |
  • POINT_ON_PLANE 44 | : plane.h 45 |
46 |
47 |
Generated on Mon Dec 29 18:40:11 2008 for Kazmath by  48 | 49 | doxygen 1.5.6
50 | 51 | 52 | -------------------------------------------------------------------------------- /docs/html/globals_func.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Kazmath: Data Fields 4 | 5 | 6 | 7 | 8 | 50 |
51 |   52 |

53 |

- _ -

67 |
68 |
Generated on Mon Dec 29 18:40:11 2008 for Kazmath by  69 | 70 | doxygen 1.5.6
71 | 72 | 73 | -------------------------------------------------------------------------------- /docs/html/globals_func_0x61.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Kazmath: Data Fields 4 | 5 | 6 | 7 | 8 | 50 |
51 |   52 |

53 |

- a -

64 |
65 |
Generated on Mon Dec 29 18:40:11 2008 for Kazmath by  66 | 67 | doxygen 1.5.6
68 | 69 | 70 | -------------------------------------------------------------------------------- /docs/html/globals_func_0x64.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Kazmath: Data Fields 4 | 5 | 6 | 7 | 8 | 50 |
51 |   52 |

53 |

- d -

58 |
59 |
Generated on Mon Dec 29 18:40:11 2008 for Kazmath by  60 | 61 | doxygen 1.5.6
62 | 63 | 64 | -------------------------------------------------------------------------------- /docs/html/globals_func_0x6c.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Kazmath: Data Fields 4 | 5 | 6 | 7 | 8 | 50 |
51 |   52 |

53 |

- l -

    54 |
  • lazyInitialize() 55 | : matrix.c 56 |
57 |
58 |
Generated on Mon Dec 29 18:40:11 2008 for Kazmath by  59 | 60 | doxygen 1.5.6
61 | 62 | 63 | -------------------------------------------------------------------------------- /docs/html/globals_func_0x72.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Kazmath: Data Fields 4 | 5 | 6 | 7 | 8 | 50 |
51 |   52 |

53 |

- r -

58 |
59 |
Generated on Mon Dec 29 18:40:11 2008 for Kazmath by  60 | 61 | doxygen 1.5.6
62 | 63 | 64 | -------------------------------------------------------------------------------- /docs/html/globals_func_0x73.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Kazmath: Data Fields 4 | 5 | 6 | 7 | 8 | 50 |
51 |   52 |

53 |

- s -

58 |
59 |
Generated on Mon Dec 29 18:40:11 2008 for Kazmath by  60 | 61 | doxygen 1.5.6
62 | 63 | 64 | -------------------------------------------------------------------------------- /docs/html/globals_type.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Kazmath: Data Fields 4 | 5 | 6 | 7 | 8 | 35 |
36 |   37 |

38 |

42 |
43 |
Generated on Mon Dec 29 18:40:11 2008 for Kazmath by  44 | 45 | doxygen 1.5.6
46 | 47 | 48 | -------------------------------------------------------------------------------- /docs/html/globals_vars.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Kazmath: Data Fields 4 | 5 | 6 | 7 | 8 | 35 |
36 |   37 |

38 |

    39 |
  • current_stack 40 | : matrix.c 41 |
  • modelview_matrix_stack 42 | : matrix.c 43 |
  • projection_matrix_stack 44 | : matrix.c 45 |
  • texture_matrix_stack 46 | : matrix.c 47 |
48 |
49 |
Generated on Mon Dec 29 18:40:11 2008 for Kazmath by  50 | 51 | doxygen 1.5.6
52 | 53 | 54 | -------------------------------------------------------------------------------- /docs/html/graph_legend.dot: -------------------------------------------------------------------------------- 1 | digraph G 2 | { 3 | edge [fontname="FreeSans",fontsize="10",labelfontname="FreeSans",labelfontsize="10"]; 4 | node [fontname="FreeSans",fontsize="10",shape=record]; 5 | Node9 [shape="box",label="Inherited",fontsize="10",height=0.2,width=0.4,fontname="FreeSans",fillcolor="grey75",style="filled" fontcolor="black"]; 6 | Node10 -> Node9 [dir=back,color="midnightblue",fontsize="10",style="solid",fontname="FreeSans"]; 7 | Node10 [shape="box",label="PublicBase",fontsize="10",height=0.2,width=0.4,fontname="FreeSans",color="black",URL="$classPublicBase.html"]; 8 | Node11 -> Node10 [dir=back,color="midnightblue",fontsize="10",style="solid",fontname="FreeSans"]; 9 | Node11 [shape="box",label="Truncated",fontsize="10",height=0.2,width=0.4,fontname="FreeSans",color="red",URL="$classTruncated.html"]; 10 | Node13 -> Node9 [dir=back,color="darkgreen",fontsize="10",style="solid",fontname="FreeSans"]; 11 | Node13 [shape="box",label="ProtectedBase",fontsize="10",height=0.2,width=0.4,fontname="FreeSans",color="black",URL="$classProtectedBase.html"]; 12 | Node14 -> Node9 [dir=back,color="firebrick4",fontsize="10",style="solid",fontname="FreeSans"]; 13 | Node14 [shape="box",label="PrivateBase",fontsize="10",height=0.2,width=0.4,fontname="FreeSans",color="black",URL="$classPrivateBase.html"]; 14 | Node15 -> Node9 [dir=back,color="midnightblue",fontsize="10",style="solid",fontname="FreeSans"]; 15 | Node15 [shape="box",label="Undocumented",fontsize="10",height=0.2,width=0.4,fontname="FreeSans",color="grey75"]; 16 | Node16 -> Node9 [dir=back,color="midnightblue",fontsize="10",style="solid",fontname="FreeSans"]; 17 | Node16 [shape="box",label="Templ< int >",fontsize="10",height=0.2,width=0.4,fontname="FreeSans",color="black",URL="$classTempl.html"]; 18 | Node17 -> Node16 [dir=back,color="orange",fontsize="10",style="dashed",label="< int >",fontname="FreeSans"]; 19 | Node17 [shape="box",label="Templ< T >",fontsize="10",height=0.2,width=0.4,fontname="FreeSans",color="black",URL="$classTempl.html"]; 20 | Node18 -> Node9 [dir=back,color="darkorchid3",fontsize="10",style="dashed",label="m_usedClass",fontname="FreeSans"]; 21 | Node18 [shape="box",label="Used",fontsize="10",height=0.2,width=0.4,fontname="FreeSans",color="black",URL="$classUsed.html"]; 22 | } 23 | -------------------------------------------------------------------------------- /docs/html/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Kazmath: Main Page 4 | 5 | 6 | 7 | 8 | 18 |
19 |

Kazmath Documentation

20 |

21 |

0.1

22 |
Generated on Mon Dec 29 18:40:10 2008 for Kazmath by  23 | 24 | doxygen 1.5.6
25 | 26 | 27 | -------------------------------------------------------------------------------- /docs/html/kazmath_8h.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Kazmath: /ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/kazmath.h File Reference 4 | 5 | 6 | 7 | 8 | 18 |
19 |

/ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/kazmath.h File Reference

#include "vec2.h"
20 | #include "vec3.h"
21 | #include "mat3.h"
22 | #include "mat4.h"
23 | #include "utility.h"
24 | #include "quaternion.h"
25 | #include "plane.h"
26 | #include "aabb.h"
27 | 28 |

29 | Go to the source code of this file. 30 | 31 |
32 |

33 |
Generated on Mon Dec 29 18:40:11 2008 for Kazmath by  34 | 35 | doxygen 1.5.6
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/tab_b.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kazade/kazmath/48dbc191da47880ea6708b0a7b3c7b69b6352cad/docs/html/tab_b.gif -------------------------------------------------------------------------------- /docs/html/tab_l.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kazade/kazmath/48dbc191da47880ea6708b0a7b3c7b69b6352cad/docs/html/tab_l.gif -------------------------------------------------------------------------------- /docs/html/tab_r.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kazade/kazmath/48dbc191da47880ea6708b0a7b3c7b69b6352cad/docs/html/tab_r.gif -------------------------------------------------------------------------------- /docs/html/tabs.css: -------------------------------------------------------------------------------- 1 | /* tabs styles, based on http://www.alistapart.com/articles/slidingdoors */ 2 | 3 | DIV.tabs 4 | { 5 | float : left; 6 | width : 100%; 7 | background : url("tab_b.gif") repeat-x bottom; 8 | margin-bottom : 4px; 9 | } 10 | 11 | DIV.tabs UL 12 | { 13 | margin : 0px; 14 | padding-left : 10px; 15 | list-style : none; 16 | } 17 | 18 | DIV.tabs LI, DIV.tabs FORM 19 | { 20 | display : inline; 21 | margin : 0px; 22 | padding : 0px; 23 | } 24 | 25 | DIV.tabs FORM 26 | { 27 | float : right; 28 | } 29 | 30 | DIV.tabs A 31 | { 32 | float : left; 33 | background : url("tab_r.gif") no-repeat right top; 34 | border-bottom : 1px solid #84B0C7; 35 | font-size : x-small; 36 | font-weight : bold; 37 | text-decoration : none; 38 | } 39 | 40 | DIV.tabs A:hover 41 | { 42 | background-position: 100% -150px; 43 | } 44 | 45 | DIV.tabs A:link, DIV.tabs A:visited, 46 | DIV.tabs A:active, DIV.tabs A:hover 47 | { 48 | color: #1A419D; 49 | } 50 | 51 | DIV.tabs SPAN 52 | { 53 | float : left; 54 | display : block; 55 | background : url("tab_l.gif") no-repeat left top; 56 | padding : 5px 9px; 57 | white-space : nowrap; 58 | } 59 | 60 | DIV.tabs INPUT 61 | { 62 | float : right; 63 | display : inline; 64 | font-size : 1em; 65 | } 66 | 67 | DIV.tabs TD 68 | { 69 | font-size : x-small; 70 | font-weight : bold; 71 | text-decoration : none; 72 | } 73 | 74 | 75 | 76 | /* Commented Backslash Hack hides rule from IE5-Mac \*/ 77 | DIV.tabs SPAN {float : none;} 78 | /* End IE5-Mac hack */ 79 | 80 | DIV.tabs A:hover SPAN 81 | { 82 | background-position: 0% -150px; 83 | } 84 | 85 | DIV.tabs LI.current A 86 | { 87 | background-position: 100% -150px; 88 | border-width : 0px; 89 | } 90 | 91 | DIV.tabs LI.current SPAN 92 | { 93 | background-position: 0% -150px; 94 | padding-bottom : 6px; 95 | } 96 | 97 | DIV.navpath 98 | { 99 | background : none; 100 | border : none; 101 | border-bottom : 1px solid #84B0C7; 102 | } 103 | -------------------------------------------------------------------------------- /docs/latex/FreeSans.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kazade/kazmath/48dbc191da47880ea6708b0a7b3c7b69b6352cad/docs/latex/FreeSans.ttf -------------------------------------------------------------------------------- /docs/latex/Makefile: -------------------------------------------------------------------------------- 1 | all: clean refman.pdf 2 | 3 | pdf: refman.pdf 4 | 5 | refman.pdf: refman.tex 6 | pdflatex refman.tex 7 | makeindex refman.idx 8 | pdflatex refman.tex 9 | latex_count=5 ; \ 10 | while egrep -s 'Rerun (LaTeX|to get cross-references right)' refman.log && [ $$latex_count -gt 0 ] ;\ 11 | do \ 12 | echo "Rerunning latex...." ;\ 13 | pdflatex refman.tex ;\ 14 | latex_count=`expr $$latex_count - 1` ;\ 15 | done 16 | 17 | 18 | clean: 19 | rm -f *.ps *.dvi *.aux *.toc *.idx *.ind *.ilg *.log *.out refman.pdf 20 | -------------------------------------------------------------------------------- /docs/latex/aabb_8c.tex: -------------------------------------------------------------------------------- 1 | \hypertarget{aabb_8c}{ 2 | \section{/ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/aabb.c File Reference} 3 | \label{aabb_8c}\index{/ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/aabb.c@{/ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/aabb.c}} 4 | } 5 | {\tt \#include \char`\"{}aabb.h\char`\"{}}\par 6 | \subsection*{Functions} 7 | \begin{CompactItemize} 8 | \item 9 | int \hyperlink{aabb_8c_14642b5cca95df665f561512357742ba}{kmAABBPointInBox} (const \hyperlink{structkm_vec3}{kmVec3} $\ast$pPoint, const \hyperlink{structkm_a_a_b_b}{kmAABB} $\ast$pBox) 10 | \item 11 | \hyperlink{structkm_a_a_b_b}{kmAABB} $\ast$ \hyperlink{aabb_8c_8fd86991f5245c1d724e2fb4dd819a85}{kmAABBAssign} (\hyperlink{structkm_a_a_b_b}{kmAABB} $\ast$pOut, const \hyperlink{structkm_a_a_b_b}{kmAABB} $\ast$pIn) 12 | \item 13 | \hyperlink{structkm_a_a_b_b}{kmAABB} $\ast$ \hyperlink{aabb_8c_50e6223b653e3a64f99e26e8e3134253}{kmAABBScale} (\hyperlink{structkm_a_a_b_b}{kmAABB} $\ast$pOut, const \hyperlink{structkm_a_a_b_b}{kmAABB} $\ast$pIn, kmScalar s) 14 | \end{CompactItemize} 15 | 16 | 17 | \subsection{Function Documentation} 18 | \hypertarget{aabb_8c_8fd86991f5245c1d724e2fb4dd819a85}{ 19 | \index{aabb.c@{aabb.c}!kmAABBAssign@{kmAABBAssign}} 20 | \index{kmAABBAssign@{kmAABBAssign}!aabb.c@{aabb.c}} 21 | \subsubsection[kmAABBAssign]{\setlength{\rightskip}{0pt plus 5cm}{\bf kmAABB}$\ast$ kmAABBAssign ({\bf kmAABB} $\ast$ {\em pOut}, \/ const {\bf kmAABB} $\ast$ {\em pIn})}} 22 | \label{aabb_8c_8fd86991f5245c1d724e2fb4dd819a85} 23 | 24 | 25 | Assigns pIn to pOut, returns pOut. 26 | 27 | Definition at line 41 of file aabb.c.\hypertarget{aabb_8c_14642b5cca95df665f561512357742ba}{ 28 | \index{aabb.c@{aabb.c}!kmAABBPointInBox@{kmAABBPointInBox}} 29 | \index{kmAABBPointInBox@{kmAABBPointInBox}!aabb.c@{aabb.c}} 30 | \subsubsection[kmAABBPointInBox]{\setlength{\rightskip}{0pt plus 5cm}int kmAABBPointInBox (const {\bf kmVec3} $\ast$ {\em pPoint}, \/ const {\bf kmAABB} $\ast$ {\em pBox})}} 31 | \label{aabb_8c_14642b5cca95df665f561512357742ba} 32 | 33 | 34 | Returns KM\_\-TRUE if point is in the specified AABB, returns KM\_\-FALSE otherwise. 35 | 36 | Definition at line 32 of file aabb.c. 37 | 38 | References KM\_\-FALSE.\hypertarget{aabb_8c_50e6223b653e3a64f99e26e8e3134253}{ 39 | \index{aabb.c@{aabb.c}!kmAABBScale@{kmAABBScale}} 40 | \index{kmAABBScale@{kmAABBScale}!aabb.c@{aabb.c}} 41 | \subsubsection[kmAABBScale]{\setlength{\rightskip}{0pt plus 5cm}{\bf kmAABB}$\ast$ kmAABBScale ({\bf kmAABB} $\ast$ {\em pOut}, \/ const {\bf kmAABB} $\ast$ {\em pIn}, \/ kmScalar {\em s})}} 42 | \label{aabb_8c_50e6223b653e3a64f99e26e8e3134253} 43 | 44 | 45 | Scales pIn by s, stores the resulting AABB in pOut. Returns pOut 46 | 47 | Definition at line 50 of file aabb.c. -------------------------------------------------------------------------------- /docs/latex/aabb_8h.tex: -------------------------------------------------------------------------------- 1 | \hypertarget{aabb_8h}{ 2 | \section{/ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/aabb.h File Reference} 3 | \label{aabb_8h}\index{/ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/aabb.h@{/ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/aabb.h}} 4 | } 5 | {\tt \#include \char`\"{}vec3.h\char`\"{}}\par 6 | {\tt \#include \char`\"{}utility.h\char`\"{}}\par 7 | \subsection*{Data Structures} 8 | \begin{CompactItemize} 9 | \item 10 | struct \hyperlink{structkm_a_a_b_b}{kmAABB} 11 | \end{CompactItemize} 12 | \subsection*{Functions} 13 | \begin{CompactItemize} 14 | \item 15 | int \hyperlink{aabb_8h_14642b5cca95df665f561512357742ba}{kmAABBPointInBox} (const \hyperlink{structkm_vec3}{kmVec3} $\ast$pPoint, const \hyperlink{structkm_a_a_b_b}{kmAABB} $\ast$pBox) 16 | \item 17 | \hyperlink{structkm_a_a_b_b}{kmAABB} $\ast$ \hyperlink{aabb_8h_8fd86991f5245c1d724e2fb4dd819a85}{kmAABBAssign} (\hyperlink{structkm_a_a_b_b}{kmAABB} $\ast$pOut, const \hyperlink{structkm_a_a_b_b}{kmAABB} $\ast$pIn) 18 | \item 19 | \hyperlink{structkm_a_a_b_b}{kmAABB} $\ast$ \hyperlink{aabb_8h_50e6223b653e3a64f99e26e8e3134253}{kmAABBScale} (\hyperlink{structkm_a_a_b_b}{kmAABB} $\ast$pOut, const \hyperlink{structkm_a_a_b_b}{kmAABB} $\ast$pIn, kmScalar s) 20 | \end{CompactItemize} 21 | 22 | 23 | \subsection{Function Documentation} 24 | \hypertarget{aabb_8h_8fd86991f5245c1d724e2fb4dd819a85}{ 25 | \index{aabb.h@{aabb.h}!kmAABBAssign@{kmAABBAssign}} 26 | \index{kmAABBAssign@{kmAABBAssign}!aabb.h@{aabb.h}} 27 | \subsubsection[kmAABBAssign]{\setlength{\rightskip}{0pt plus 5cm}{\bf kmAABB}$\ast$ kmAABBAssign ({\bf kmAABB} $\ast$ {\em pOut}, \/ const {\bf kmAABB} $\ast$ {\em pIn})}} 28 | \label{aabb_8h_8fd86991f5245c1d724e2fb4dd819a85} 29 | 30 | 31 | Assigns pIn to pOut, returns pOut. 32 | 33 | Definition at line 41 of file aabb.c.\hypertarget{aabb_8h_14642b5cca95df665f561512357742ba}{ 34 | \index{aabb.h@{aabb.h}!kmAABBPointInBox@{kmAABBPointInBox}} 35 | \index{kmAABBPointInBox@{kmAABBPointInBox}!aabb.h@{aabb.h}} 36 | \subsubsection[kmAABBPointInBox]{\setlength{\rightskip}{0pt plus 5cm}int kmAABBPointInBox (const {\bf kmVec3} $\ast$ {\em pPoint}, \/ const {\bf kmAABB} $\ast$ {\em pBox})}} 37 | \label{aabb_8h_14642b5cca95df665f561512357742ba} 38 | 39 | 40 | Returns KM\_\-TRUE if point is in the specified AABB, returns KM\_\-FALSE otherwise. 41 | 42 | Definition at line 32 of file aabb.c. 43 | 44 | References KM\_\-FALSE.\hypertarget{aabb_8h_50e6223b653e3a64f99e26e8e3134253}{ 45 | \index{aabb.h@{aabb.h}!kmAABBScale@{kmAABBScale}} 46 | \index{kmAABBScale@{kmAABBScale}!aabb.h@{aabb.h}} 47 | \subsubsection[kmAABBScale]{\setlength{\rightskip}{0pt plus 5cm}{\bf kmAABB}$\ast$ kmAABBScale ({\bf kmAABB} $\ast$ {\em pOut}, \/ const {\bf kmAABB} $\ast$ {\em pIn}, \/ kmScalar {\em s})}} 48 | \label{aabb_8h_50e6223b653e3a64f99e26e8e3134253} 49 | 50 | 51 | Scales pIn by s, stores the resulting AABB in pOut. Returns pOut 52 | 53 | Definition at line 50 of file aabb.c. -------------------------------------------------------------------------------- /docs/latex/annotated.tex: -------------------------------------------------------------------------------- 1 | \section{Data Structures} 2 | Here are the data structures with brief descriptions:\begin{CompactList} 3 | \item\contentsline{section}{\hyperlink{structkm__mat4__stack}{km\_\-mat4\_\-stack} }{\pageref{structkm__mat4__stack}}{} 4 | \item\contentsline{section}{\hyperlink{structkm_a_a_b_b}{kmAABB} }{\pageref{structkm_a_a_b_b}}{} 5 | \item\contentsline{section}{\hyperlink{structkm_mat3}{kmMat3} }{\pageref{structkm_mat3}}{} 6 | \item\contentsline{section}{\hyperlink{structkm_mat4}{kmMat4} }{\pageref{structkm_mat4}}{} 7 | \item\contentsline{section}{\hyperlink{structkm_plane}{kmPlane} }{\pageref{structkm_plane}}{} 8 | \item\contentsline{section}{\hyperlink{structkm_quaternion}{kmQuaternion} }{\pageref{structkm_quaternion}}{} 9 | \item\contentsline{section}{\hyperlink{structkm_vec2}{kmVec2} }{\pageref{structkm_vec2}}{} 10 | \item\contentsline{section}{\hyperlink{structkm_vec3}{kmVec3} }{\pageref{structkm_vec3}}{} 11 | \item\contentsline{section}{\hyperlink{structkm_vec4}{kmVec4} }{\pageref{structkm_vec4}}{} 12 | \item\contentsline{section}{\hyperlink{structkazmathxx_1_1_mat3}{kazmathxx::Mat3} }{\pageref{structkazmathxx_1_1_mat3}}{} 13 | \item\contentsline{section}{\hyperlink{structkazmathxx_1_1_mat4}{kazmathxx::Mat4} }{\pageref{structkazmathxx_1_1_mat4}}{} 14 | \item\contentsline{section}{\hyperlink{structkazmathxx_1_1_plane}{kazmathxx::Plane} }{\pageref{structkazmathxx_1_1_plane}}{} 15 | \item\contentsline{section}{\hyperlink{structkazmathxx_1_1_quaternion}{kazmathxx::Quaternion} }{\pageref{structkazmathxx_1_1_quaternion}}{} 16 | \item\contentsline{section}{\hyperlink{structkazmathxx_1_1_vec2}{kazmathxx::Vec2} }{\pageref{structkazmathxx_1_1_vec2}}{} 17 | \item\contentsline{section}{\hyperlink{structkazmathxx_1_1_vec3}{kazmathxx::Vec3} }{\pageref{structkazmathxx_1_1_vec3}}{} 18 | \end{CompactList} 19 | -------------------------------------------------------------------------------- /docs/latex/doxygen.sty: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e} 2 | \ProvidesPackage{doxygen} 3 | \RequirePackage{calc} 4 | \RequirePackage{array} 5 | \pagestyle{fancyplain} 6 | \newcommand{\clearemptydoublepage}{\newpage{\pagestyle{empty}\cleardoublepage}} 7 | \renewcommand{\chaptermark}[1]{\markboth{#1}{}} 8 | \renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}} 9 | \lhead[\fancyplain{}{\bfseries\thepage}] 10 | {\fancyplain{}{\bfseries\rightmark}} 11 | \rhead[\fancyplain{}{\bfseries\leftmark}] 12 | {\fancyplain{}{\bfseries\thepage}} 13 | \rfoot[\fancyplain{}{\bfseries\scriptsize Generated on Mon Dec 29 18:40:10 2008 for Kazmath by Doxygen }]{} 14 | \lfoot[]{\fancyplain{}{\bfseries\scriptsize Generated on Mon Dec 29 18:40:10 2008 for Kazmath by Doxygen }} 15 | \cfoot{} 16 | \newenvironment{Code} 17 | {\footnotesize} 18 | {\normalsize} 19 | \newcommand{\doxyref}[3]{\textbf{#1} (\textnormal{#2}\,\pageref{#3})} 20 | \newenvironment{DocInclude} 21 | {\footnotesize} 22 | {\normalsize} 23 | \newenvironment{VerbInclude} 24 | {\footnotesize} 25 | {\normalsize} 26 | \newenvironment{Image} 27 | {\begin{figure}[H]} 28 | {\end{figure}} 29 | \newenvironment{ImageNoCaption}{}{} 30 | \newenvironment{CompactList} 31 | {\begin{list}{}{ 32 | \setlength{\leftmargin}{0.5cm} 33 | \setlength{\itemsep}{0pt} 34 | \setlength{\parsep}{0pt} 35 | \setlength{\topsep}{0pt} 36 | \renewcommand{\makelabel}{\hfill}}} 37 | {\end{list}} 38 | \newenvironment{CompactItemize} 39 | { 40 | \begin{itemize} 41 | \setlength{\itemsep}{-3pt} 42 | \setlength{\parsep}{0pt} 43 | \setlength{\topsep}{0pt} 44 | \setlength{\partopsep}{0pt} 45 | } 46 | {\end{itemize}} 47 | \newcommand{\PBS}[1]{\let\temp=\\#1\let\\=\temp} 48 | \newlength{\tmplength} 49 | \newenvironment{TabularC}[1] 50 | { 51 | \setlength{\tmplength} 52 | {\linewidth/(#1)-\tabcolsep*2-\arrayrulewidth*(#1+1)/(#1)} 53 | \par\begin{tabular*}{\linewidth} 54 | {*{#1}{|>{\PBS\raggedright\hspace{0pt}}p{\the\tmplength}}|} 55 | } 56 | {\end{tabular*}\par} 57 | \newcommand{\entrylabel}[1]{ 58 | {\parbox[b]{\labelwidth-4pt}{\makebox[0pt][l]{\textbf{#1}}\vspace{1.5\baselineskip}}}} 59 | \newenvironment{Desc} 60 | {\begin{list}{} 61 | { 62 | \settowidth{\labelwidth}{40pt} 63 | \setlength{\leftmargin}{\labelwidth} 64 | \setlength{\parsep}{0pt} 65 | \setlength{\itemsep}{-4pt} 66 | \renewcommand{\makelabel}{\entrylabel} 67 | } 68 | } 69 | {\end{list}} 70 | \newenvironment{Indent} 71 | {\begin{list}{}{\setlength{\leftmargin}{0.5cm}} 72 | \item[]\ignorespaces} 73 | {\unskip\end{list}} 74 | \setlength{\parindent}{0cm} 75 | \setlength{\parskip}{0.2cm} 76 | \addtocounter{secnumdepth}{1} 77 | \sloppy 78 | \usepackage[T1]{fontenc} 79 | -------------------------------------------------------------------------------- /docs/latex/files.tex: -------------------------------------------------------------------------------- 1 | \section{File List} 2 | Here is a list of all files with brief descriptions:\begin{CompactList} 3 | \item\contentsline{section}{/ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/\hyperlink{aabb_8c}{aabb.c} }{\pageref{aabb_8c}}{} 4 | \item\contentsline{section}{/ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/\hyperlink{aabb_8h}{aabb.h} }{\pageref{aabb_8h}}{} 5 | \item\contentsline{section}{/ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/\hyperlink{kazmath_8h}{kazmath.h} }{\pageref{kazmath_8h}}{} 6 | \item\contentsline{section}{/ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/\hyperlink{kazmathxx_8h}{kazmathxx.h} }{\pageref{kazmathxx_8h}}{} 7 | \item\contentsline{section}{/ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/\hyperlink{mat3_8c}{mat3.c} }{\pageref{mat3_8c}}{} 8 | \item\contentsline{section}{/ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/\hyperlink{mat3_8h}{mat3.h} }{\pageref{mat3_8h}}{} 9 | \item\contentsline{section}{/ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/\hyperlink{mat4_8c}{mat4.c} }{\pageref{mat4_8c}}{} 10 | \item\contentsline{section}{/ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/\hyperlink{mat4_8h}{mat4.h} }{\pageref{mat4_8h}}{} 11 | \item\contentsline{section}{/ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/\hyperlink{plane_8c}{plane.c} }{\pageref{plane_8c}}{} 12 | \item\contentsline{section}{/ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/\hyperlink{plane_8h}{plane.h} }{\pageref{plane_8h}}{} 13 | \item\contentsline{section}{/ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/\hyperlink{quaternion_8c}{quaternion.c} }{\pageref{quaternion_8c}}{} 14 | \item\contentsline{section}{/ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/\hyperlink{quaternion_8h}{quaternion.h} }{\pageref{quaternion_8h}}{} 15 | \item\contentsline{section}{/ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/\hyperlink{utility_8c}{utility.c} }{\pageref{utility_8c}}{} 16 | \item\contentsline{section}{/ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/\hyperlink{utility_8h}{utility.h} }{\pageref{utility_8h}}{} 17 | \item\contentsline{section}{/ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/\hyperlink{vec2_8c}{vec2.c} }{\pageref{vec2_8c}}{} 18 | \item\contentsline{section}{/ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/\hyperlink{vec2_8h}{vec2.h} }{\pageref{vec2_8h}}{} 19 | \item\contentsline{section}{/ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/\hyperlink{vec3_8c}{vec3.c} }{\pageref{vec3_8c}}{} 20 | \item\contentsline{section}{/ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/\hyperlink{vec3_8h}{vec3.h} }{\pageref{vec3_8h}}{} 21 | \item\contentsline{section}{/ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/\hyperlink{vec4_8c}{vec4.c} }{\pageref{vec4_8c}}{} 22 | \item\contentsline{section}{/ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/\hyperlink{vec4_8h}{vec4.h} }{\pageref{vec4_8h}}{} 23 | \item\contentsline{section}{/ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/GL/\hyperlink{mat4stack_8c}{mat4stack.c} }{\pageref{mat4stack_8c}}{} 24 | \item\contentsline{section}{/ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/GL/\hyperlink{mat4stack_8h}{mat4stack.h} }{\pageref{mat4stack_8h}}{} 25 | \item\contentsline{section}{/ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/GL/\hyperlink{matrix_8c}{matrix.c} }{\pageref{matrix_8c}}{} 26 | \item\contentsline{section}{/ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/GL/\hyperlink{matrix_8h}{matrix.h} }{\pageref{matrix_8h}}{} 27 | \end{CompactList} 28 | -------------------------------------------------------------------------------- /docs/latex/kazmath_8h.tex: -------------------------------------------------------------------------------- 1 | \hypertarget{kazmath_8h}{ 2 | \section{/ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/kazmath.h File Reference} 3 | \label{kazmath_8h}\index{/ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/kazmath.h@{/ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/kazmath.h}} 4 | } 5 | {\tt \#include \char`\"{}vec2.h\char`\"{}}\par 6 | {\tt \#include \char`\"{}vec3.h\char`\"{}}\par 7 | {\tt \#include \char`\"{}mat3.h\char`\"{}}\par 8 | {\tt \#include \char`\"{}mat4.h\char`\"{}}\par 9 | {\tt \#include \char`\"{}utility.h\char`\"{}}\par 10 | {\tt \#include \char`\"{}quaternion.h\char`\"{}}\par 11 | {\tt \#include \char`\"{}plane.h\char`\"{}}\par 12 | {\tt \#include \char`\"{}aabb.h\char`\"{}}\par 13 | -------------------------------------------------------------------------------- /docs/latex/refman.tex: -------------------------------------------------------------------------------- 1 | \documentclass[a4paper]{book} 2 | \usepackage{a4wide} 3 | \usepackage{makeidx} 4 | \usepackage{fancyhdr} 5 | \usepackage{graphicx} 6 | \usepackage{multicol} 7 | \usepackage{float} 8 | \usepackage{textcomp} 9 | \usepackage{alltt} 10 | \usepackage{times} 11 | \usepackage{ifpdf} 12 | \ifpdf 13 | \usepackage[pdftex, 14 | pagebackref=true, 15 | colorlinks=true, 16 | linkcolor=blue, 17 | unicode 18 | ]{hyperref} 19 | \else 20 | \usepackage[ps2pdf, 21 | pagebackref=true, 22 | colorlinks=true, 23 | linkcolor=blue, 24 | unicode 25 | ]{hyperref} 26 | \usepackage{pspicture} 27 | \fi 28 | \usepackage[utf8]{inputenc} 29 | \usepackage{doxygen} 30 | \makeindex 31 | \setcounter{tocdepth}{3} 32 | \renewcommand{\footrulewidth}{0.4pt} 33 | \begin{document} 34 | \begin{titlepage} 35 | \vspace*{7cm} 36 | \begin{center} 37 | {\Large Kazmath \\[1ex]\large 0.1 }\\ 38 | \vspace*{1cm} 39 | {\large Generated by Doxygen 1.5.6}\\ 40 | \vspace*{0.5cm} 41 | {\small Mon Dec 29 18:40:10 2008}\\ 42 | \end{center} 43 | \end{titlepage} 44 | \clearemptydoublepage 45 | \pagenumbering{roman} 46 | \tableofcontents 47 | \clearemptydoublepage 48 | \pagenumbering{arabic} 49 | \chapter{Namespace Index} 50 | \input{namespaces} 51 | \chapter{Data Structure Index} 52 | \input{hierarchy} 53 | \chapter{Data Structure Index} 54 | \input{annotated} 55 | \chapter{File Index} 56 | \input{files} 57 | \chapter{Namespace Documentation} 58 | \input{namespacekazmathxx} 59 | \chapter{Data Structure Documentation} 60 | \input{structkm__mat4__stack} 61 | \include{structkm_a_a_b_b} 62 | \include{structkm_mat3} 63 | \include{structkm_mat4} 64 | \include{structkm_plane} 65 | \include{structkm_quaternion} 66 | \include{structkm_vec2} 67 | \include{structkm_vec3} 68 | \include{structkm_vec4} 69 | \include{structkazmathxx_1_1_mat3} 70 | \include{structkazmathxx_1_1_mat4} 71 | \include{structkazmathxx_1_1_plane} 72 | \include{structkazmathxx_1_1_quaternion} 73 | \include{structkazmathxx_1_1_vec2} 74 | \include{structkazmathxx_1_1_vec3} 75 | \chapter{File Documentation} 76 | \input{aabb_8c} 77 | \include{aabb_8h} 78 | \include{mat4stack_8c} 79 | \include{mat4stack_8h} 80 | \include{matrix_8c} 81 | \include{matrix_8h} 82 | \include{kazmath_8h} 83 | \include{kazmathxx_8h} 84 | \include{mat3_8c} 85 | \include{mat3_8h} 86 | \include{mat4_8c} 87 | \include{mat4_8h} 88 | \include{plane_8c} 89 | \include{plane_8h} 90 | \include{quaternion_8c} 91 | \include{quaternion_8h} 92 | \include{utility_8c} 93 | \include{utility_8h} 94 | \include{vec2_8c} 95 | \include{vec2_8h} 96 | \include{vec3_8c} 97 | \include{vec3_8h} 98 | \include{vec4_8c} 99 | \include{vec4_8h} 100 | \printindex 101 | \end{document} 102 | -------------------------------------------------------------------------------- /docs/latex/structkm__mat4__stack.tex: -------------------------------------------------------------------------------- 1 | \hypertarget{structkm__mat4__stack}{ 2 | \section{km\_\-mat4\_\-stack Struct Reference} 3 | \label{structkm__mat4__stack}\index{km\_\-mat4\_\-stack@{km\_\-mat4\_\-stack}} 4 | } 5 | {\tt \#include $<$mat4stack.h$>$} 6 | 7 | \subsection*{Data Fields} 8 | \begin{CompactItemize} 9 | \item 10 | int \hyperlink{structkm__mat4__stack_069785a0a19481b635a91076f78547c7}{capacity} 11 | \item 12 | int \hyperlink{structkm__mat4__stack_a29b07b2cae7bb1a8fbb699ec0ee3383}{item\_\-count} 13 | \item 14 | \hyperlink{structkm_mat4}{kmMat4} $\ast$ \hyperlink{structkm__mat4__stack_487ba8aa0a0176eb21899bd8bc38f153}{top} 15 | \item 16 | \hyperlink{structkm_mat4}{kmMat4} $\ast$ \hyperlink{structkm__mat4__stack_a8b2b968718d212c80d7923d9de6a0a8}{stack} 17 | \end{CompactItemize} 18 | 19 | 20 | \subsection{Detailed Description} 21 | 22 | 23 | Definition at line 31 of file mat4stack.h. 24 | 25 | \subsection{Field Documentation} 26 | \hypertarget{structkm__mat4__stack_069785a0a19481b635a91076f78547c7}{ 27 | \index{km\_\-mat4\_\-stack@{km\_\-mat4\_\-stack}!capacity@{capacity}} 28 | \index{capacity@{capacity}!km_mat4_stack@{km\_\-mat4\_\-stack}} 29 | \subsubsection[capacity]{\setlength{\rightskip}{0pt plus 5cm}int {\bf km\_\-mat4\_\-stack::capacity}}} 30 | \label{structkm__mat4__stack_069785a0a19481b635a91076f78547c7} 31 | 32 | 33 | 34 | 35 | Definition at line 32 of file mat4stack.h. 36 | 37 | Referenced by km\_\-mat4\_\-stack\_\-initialize(), km\_\-mat4\_\-stack\_\-push(), and km\_\-mat4\_\-stack\_\-release().\hypertarget{structkm__mat4__stack_a29b07b2cae7bb1a8fbb699ec0ee3383}{ 38 | \index{km\_\-mat4\_\-stack@{km\_\-mat4\_\-stack}!item\_\-count@{item\_\-count}} 39 | \index{item\_\-count@{item\_\-count}!km_mat4_stack@{km\_\-mat4\_\-stack}} 40 | \subsubsection[item\_\-count]{\setlength{\rightskip}{0pt plus 5cm}int {\bf km\_\-mat4\_\-stack::item\_\-count}}} 41 | \label{structkm__mat4__stack_a29b07b2cae7bb1a8fbb699ec0ee3383} 42 | 43 | 44 | 45 | 46 | Definition at line 33 of file mat4stack.h. 47 | 48 | Referenced by km\_\-mat4\_\-stack\_\-initialize(), km\_\-mat4\_\-stack\_\-pop(), km\_\-mat4\_\-stack\_\-push(), and km\_\-mat4\_\-stack\_\-release().\hypertarget{structkm__mat4__stack_487ba8aa0a0176eb21899bd8bc38f153}{ 49 | \index{km\_\-mat4\_\-stack@{km\_\-mat4\_\-stack}!top@{top}} 50 | \index{top@{top}!km_mat4_stack@{km\_\-mat4\_\-stack}} 51 | \subsubsection[top]{\setlength{\rightskip}{0pt plus 5cm}{\bf kmMat4}$\ast$ {\bf km\_\-mat4\_\-stack::top}}} 52 | \label{structkm__mat4__stack_487ba8aa0a0176eb21899bd8bc38f153} 53 | 54 | 55 | 56 | 57 | Definition at line 34 of file mat4stack.h. 58 | 59 | Referenced by km\_\-mat4\_\-stack\_\-initialize(), km\_\-mat4\_\-stack\_\-pop(), km\_\-mat4\_\-stack\_\-push(), km\_\-mat4\_\-stack\_\-release(), kmGLGetMatrix(), kmGLLoadIdentity(), kmGLMultMatrix(), kmGLPushMatrix(), kmGLRotatef(), kmGLScalef(), and kmGLTranslatef().\hypertarget{structkm__mat4__stack_a8b2b968718d212c80d7923d9de6a0a8}{ 60 | \index{km\_\-mat4\_\-stack@{km\_\-mat4\_\-stack}!stack@{stack}} 61 | \index{stack@{stack}!km_mat4_stack@{km\_\-mat4\_\-stack}} 62 | \subsubsection[stack]{\setlength{\rightskip}{0pt plus 5cm}{\bf kmMat4}$\ast$ {\bf km\_\-mat4\_\-stack::stack}}} 63 | \label{structkm__mat4__stack_a8b2b968718d212c80d7923d9de6a0a8} 64 | 65 | 66 | 67 | 68 | Definition at line 35 of file mat4stack.h. 69 | 70 | Referenced by km\_\-mat4\_\-stack\_\-initialize(), km\_\-mat4\_\-stack\_\-pop(), km\_\-mat4\_\-stack\_\-push(), and km\_\-mat4\_\-stack\_\-release(). 71 | 72 | The documentation for this struct was generated from the following file:\begin{CompactItemize} 73 | \item 74 | /ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/GL/\hyperlink{mat4stack_8h}{mat4stack.h}\end{CompactItemize} 75 | -------------------------------------------------------------------------------- /docs/latex/structkm_a_a_b_b.tex: -------------------------------------------------------------------------------- 1 | \hypertarget{structkm_a_a_b_b}{ 2 | \section{kmAABB Struct Reference} 3 | \label{structkm_a_a_b_b}\index{kmAABB@{kmAABB}} 4 | } 5 | {\tt \#include $<$aabb.h$>$} 6 | 7 | \subsection*{Data Fields} 8 | \begin{CompactItemize} 9 | \item 10 | \hyperlink{structkm_vec3}{kmVec3} \hyperlink{structkm_a_a_b_b_511f76c686209fd071eb8aed2d52b0ac}{min} 11 | \item 12 | \hyperlink{structkm_vec3}{kmVec3} \hyperlink{structkm_a_a_b_b_b408e258b39d873882e2b3b335cf88d7}{max} 13 | \end{CompactItemize} 14 | 15 | 16 | \subsection{Detailed Description} 17 | A struture that represents an axis-aligned bounding box. 18 | 19 | Definition at line 40 of file aabb.h. 20 | 21 | \subsection{Field Documentation} 22 | \hypertarget{structkm_a_a_b_b_511f76c686209fd071eb8aed2d52b0ac}{ 23 | \index{kmAABB@{kmAABB}!min@{min}} 24 | \index{min@{min}!kmAABB@{kmAABB}} 25 | \subsubsection[min]{\setlength{\rightskip}{0pt plus 5cm}{\bf kmVec3} {\bf kmAABB::min}}} 26 | \label{structkm_a_a_b_b_511f76c686209fd071eb8aed2d52b0ac} 27 | 28 | 29 | 30 | 31 | Definition at line 41 of file aabb.h.\hypertarget{structkm_a_a_b_b_b408e258b39d873882e2b3b335cf88d7}{ 32 | \index{kmAABB@{kmAABB}!max@{max}} 33 | \index{max@{max}!kmAABB@{kmAABB}} 34 | \subsubsection[max]{\setlength{\rightskip}{0pt plus 5cm}{\bf kmVec3} {\bf kmAABB::max}}} 35 | \label{structkm_a_a_b_b_b408e258b39d873882e2b3b335cf88d7} 36 | 37 | 38 | The max corner of the box 39 | 40 | Definition at line 42 of file aabb.h. 41 | 42 | The documentation for this struct was generated from the following file:\begin{CompactItemize} 43 | \item 44 | /ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/\hyperlink{aabb_8h}{aabb.h}\end{CompactItemize} 45 | -------------------------------------------------------------------------------- /docs/latex/structkm_mat3.tex: -------------------------------------------------------------------------------- 1 | \hypertarget{structkm_mat3}{ 2 | \section{kmMat3 Struct Reference} 3 | \label{structkm_mat3}\index{kmMat3@{kmMat3}} 4 | } 5 | {\tt \#include $<$mat3.h$>$} 6 | 7 | Inheritance diagram for kmMat3::\begin{figure}[H] 8 | \begin{center} 9 | \leavevmode 10 | \includegraphics[height=2cm]{structkm_mat3} 11 | \end{center} 12 | \end{figure} 13 | \subsection*{Data Fields} 14 | \begin{CompactItemize} 15 | \item 16 | kmScalar \hyperlink{structkm_mat3_e62896cf1c8f7a94e7a18dede8480125}{mat} \mbox{[}9\mbox{]} 17 | \end{CompactItemize} 18 | 19 | 20 | \subsection{Detailed Description} 21 | 22 | 23 | Definition at line 35 of file mat3.h. 24 | 25 | \subsection{Field Documentation} 26 | \hypertarget{structkm_mat3_e62896cf1c8f7a94e7a18dede8480125}{ 27 | \index{kmMat3@{kmMat3}!mat@{mat}} 28 | \index{mat@{mat}!kmMat3@{kmMat3}} 29 | \subsubsection[mat]{\setlength{\rightskip}{0pt plus 5cm}kmScalar {\bf kmMat3::mat}\mbox{[}9\mbox{]}}} 30 | \label{structkm_mat3_e62896cf1c8f7a94e7a18dede8480125} 31 | 32 | 33 | 34 | 35 | Definition at line 36 of file mat3.h. 36 | 37 | Referenced by kmMat3Adjugate(), kmMat3AreEqual(), kmMat3Assign(), kmMat3Determinant(), kmMat3Fill(), kmMat3Identity(), kmMat3IsIdentity(), kmMat3Multiply(), kmMat3Rotation(), kmMat3ScalarMultiply(), kmMat3Scaling(), kmMat3Translation(), kmMat3Transpose(), kazmathxx::Mat3::Mat3(), and kazmathxx::Mat3::operator=(). 38 | 39 | The documentation for this struct was generated from the following file:\begin{CompactItemize} 40 | \item 41 | /ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/\hyperlink{mat3_8h}{mat3.h}\end{CompactItemize} 42 | -------------------------------------------------------------------------------- /docs/latex/structkm_mat4.tex: -------------------------------------------------------------------------------- 1 | \hypertarget{structkm_mat4}{ 2 | \section{kmMat4 Struct Reference} 3 | \label{structkm_mat4}\index{kmMat4@{kmMat4}} 4 | } 5 | {\tt \#include $<$mat4.h$>$} 6 | 7 | Inheritance diagram for kmMat4::\begin{figure}[H] 8 | \begin{center} 9 | \leavevmode 10 | \includegraphics[height=2cm]{structkm_mat4} 11 | \end{center} 12 | \end{figure} 13 | \subsection*{Data Fields} 14 | \begin{CompactItemize} 15 | \item 16 | kmScalar \hyperlink{structkm_mat4_39a393fbd31604045d69a6af0fa3b34a}{mat} \mbox{[}16\mbox{]} 17 | \end{CompactItemize} 18 | 19 | 20 | \subsection{Detailed Description} 21 | 22 | 23 | Definition at line 43 of file mat4.h. 24 | 25 | \subsection{Field Documentation} 26 | \hypertarget{structkm_mat4_39a393fbd31604045d69a6af0fa3b34a}{ 27 | \index{kmMat4@{kmMat4}!mat@{mat}} 28 | \index{mat@{mat}!kmMat4@{kmMat4}} 29 | \subsubsection[mat]{\setlength{\rightskip}{0pt plus 5cm}kmScalar {\bf kmMat4::mat}\mbox{[}16\mbox{]}}} 30 | \label{structkm_mat4_39a393fbd31604045d69a6af0fa3b34a} 31 | 32 | 33 | 34 | 35 | Definition at line 44 of file mat4.h. 36 | 37 | Referenced by kmGLTranslatef(), kmMat4AreEqual(), kmMat4Assign(), kmMat4Fill(), kmMat4GetForwardVec3(), kmMat4GetRightVec3(), kmMat4GetUpVec3(), kmMat4Identity(), kmMat4Inverse(), kmMat4IsIdentity(), kmMat4LookAt(), kmMat4Multiply(), kmMat4OrthographicProjection(), kmMat4PerspectiveProjection(), kmMat4RotationAxis(), kmMat4RotationPitchYawRoll(), kmMat4RotationQuaternion(), kmMat4RotationX(), kmMat4RotationY(), kmMat4RotationZ(), kmMat4Scaling(), kmMat4Translation(), kmMat4Transpose(), kmQuaternionRotationMatrix(), kmVec3InverseTransform(), kmVec3InverseTransformNormal(), kmVec3Transform(), kmVec3TransformNormal(), kmVec4Transform(), kazmathxx::Mat4::Mat4(), and kazmathxx::Mat4::operator=(). 38 | 39 | The documentation for this struct was generated from the following file:\begin{CompactItemize} 40 | \item 41 | /ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/\hyperlink{mat4_8h}{mat4.h}\end{CompactItemize} 42 | -------------------------------------------------------------------------------- /docs/latex/structkm_plane.tex: -------------------------------------------------------------------------------- 1 | \hypertarget{structkm_plane}{ 2 | \section{kmPlane Struct Reference} 3 | \label{structkm_plane}\index{kmPlane@{kmPlane}} 4 | } 5 | {\tt \#include $<$plane.h$>$} 6 | 7 | Inheritance diagram for kmPlane::\begin{figure}[H] 8 | \begin{center} 9 | \leavevmode 10 | \includegraphics[height=2cm]{structkm_plane} 11 | \end{center} 12 | \end{figure} 13 | \subsection*{Data Fields} 14 | \begin{CompactItemize} 15 | \item 16 | kmScalar \hyperlink{structkm_plane_912b0822bfd525570a072d01b0c3b9e1}{a} 17 | \item 18 | kmScalar \hyperlink{structkm_plane_c16b759b0f6973f00c2c742ec418e2d1}{b} 19 | \item 20 | kmScalar \hyperlink{structkm_plane_46fb82aee3e4ccec7bb027ba53998600}{c} 21 | \item 22 | kmScalar \hyperlink{structkm_plane_a3c74528242125229ab0038e9a09b803}{d} 23 | \end{CompactItemize} 24 | 25 | 26 | \subsection{Detailed Description} 27 | 28 | 29 | Definition at line 33 of file plane.h. 30 | 31 | \subsection{Field Documentation} 32 | \hypertarget{structkm_plane_912b0822bfd525570a072d01b0c3b9e1}{ 33 | \index{kmPlane@{kmPlane}!a@{a}} 34 | \index{a@{a}!kmPlane@{kmPlane}} 35 | \subsubsection[a]{\setlength{\rightskip}{0pt plus 5cm}kmScalar {\bf kmPlane::a}}} 36 | \label{structkm_plane_912b0822bfd525570a072d01b0c3b9e1} 37 | 38 | 39 | 40 | 41 | Definition at line 34 of file plane.h. 42 | 43 | Referenced by kmPlaneClassifyPoint(), kmPlaneDot(), kmPlaneDotCoord(), kmPlaneDotNormal(), kmPlaneFromPointNormal(), kmPlaneFromPoints(), kmPlaneNormalize(), kazmathxx::Plane::operator=(), and kazmathxx::Plane::Plane().\hypertarget{structkm_plane_c16b759b0f6973f00c2c742ec418e2d1}{ 44 | \index{kmPlane@{kmPlane}!b@{b}} 45 | \index{b@{b}!kmPlane@{kmPlane}} 46 | \subsubsection[b]{\setlength{\rightskip}{0pt plus 5cm}kmScalar {\bf kmPlane::b}}} 47 | \label{structkm_plane_c16b759b0f6973f00c2c742ec418e2d1} 48 | 49 | 50 | 51 | 52 | Definition at line 34 of file plane.h. 53 | 54 | Referenced by kmPlaneClassifyPoint(), kmPlaneDot(), kmPlaneDotCoord(), kmPlaneDotNormal(), kmPlaneFromPointNormal(), kmPlaneFromPoints(), kmPlaneNormalize(), kazmathxx::Plane::operator=(), and kazmathxx::Plane::Plane().\hypertarget{structkm_plane_46fb82aee3e4ccec7bb027ba53998600}{ 55 | \index{kmPlane@{kmPlane}!c@{c}} 56 | \index{c@{c}!kmPlane@{kmPlane}} 57 | \subsubsection[c]{\setlength{\rightskip}{0pt plus 5cm}kmScalar {\bf kmPlane::c}}} 58 | \label{structkm_plane_46fb82aee3e4ccec7bb027ba53998600} 59 | 60 | 61 | 62 | 63 | Definition at line 34 of file plane.h. 64 | 65 | Referenced by kmPlaneClassifyPoint(), kmPlaneDot(), kmPlaneDotCoord(), kmPlaneDotNormal(), kmPlaneFromPointNormal(), kmPlaneFromPoints(), kmPlaneNormalize(), kazmathxx::Plane::operator=(), and kazmathxx::Plane::Plane().\hypertarget{structkm_plane_a3c74528242125229ab0038e9a09b803}{ 66 | \index{kmPlane@{kmPlane}!d@{d}} 67 | \index{d@{d}!kmPlane@{kmPlane}} 68 | \subsubsection[d]{\setlength{\rightskip}{0pt plus 5cm}kmScalar {\bf kmPlane::d}}} 69 | \label{structkm_plane_a3c74528242125229ab0038e9a09b803} 70 | 71 | 72 | 73 | 74 | Definition at line 34 of file plane.h. 75 | 76 | Referenced by kmPlaneClassifyPoint(), kmPlaneDot(), kmPlaneDotCoord(), kmPlaneFromPointNormal(), kmPlaneFromPoints(), kmPlaneNormalize(), kazmathxx::Plane::operator=(), and kazmathxx::Plane::Plane(). 77 | 78 | The documentation for this struct was generated from the following file:\begin{CompactItemize} 79 | \item 80 | /ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/\hyperlink{plane_8h}{plane.h}\end{CompactItemize} 81 | -------------------------------------------------------------------------------- /docs/latex/structkm_vec2.tex: -------------------------------------------------------------------------------- 1 | \hypertarget{structkm_vec2}{ 2 | \section{kmVec2 Struct Reference} 3 | \label{structkm_vec2}\index{kmVec2@{kmVec2}} 4 | } 5 | {\tt \#include $<$vec2.h$>$} 6 | 7 | Inheritance diagram for kmVec2::\begin{figure}[H] 8 | \begin{center} 9 | \leavevmode 10 | \includegraphics[height=2cm]{structkm_vec2} 11 | \end{center} 12 | \end{figure} 13 | \subsection*{Data Fields} 14 | \begin{CompactItemize} 15 | \item 16 | kmScalar \hyperlink{structkm_vec2_8f17399ac844ce3b973d09d28e78429a}{x} 17 | \item 18 | kmScalar \hyperlink{structkm_vec2_21eee8f77413b24dd6a8a19314d61fed}{y} 19 | \end{CompactItemize} 20 | 21 | 22 | \subsection{Detailed Description} 23 | 24 | 25 | Definition at line 37 of file vec2.h. 26 | 27 | \subsection{Field Documentation} 28 | \hypertarget{structkm_vec2_8f17399ac844ce3b973d09d28e78429a}{ 29 | \index{kmVec2@{kmVec2}!x@{x}} 30 | \index{x@{x}!kmVec2@{kmVec2}} 31 | \subsubsection[x]{\setlength{\rightskip}{0pt plus 5cm}kmScalar {\bf kmVec2::x}}} 32 | \label{structkm_vec2_8f17399ac844ce3b973d09d28e78429a} 33 | 34 | 35 | 36 | 37 | Definition at line 38 of file vec2.h. 38 | 39 | Referenced by kmVec2Add(), kmVec2AreEqual(), kmVec2Dot(), kmVec2Fill(), kmVec2Length(), kmVec2LengthSq(), kmVec2Normalize(), kmVec2Scale(), kmVec2Subtract(), kazmathxx::Vec2::operator$\ast$(), kazmathxx::Vec2::operator$\ast$=(), kazmathxx::Vec2::operator+(), kazmathxx::Vec2::operator+=(), kazmathxx::Vec2::operator-(), kazmathxx::Vec2::operator-=(), kazmathxx::Vec2::operator/(), kazmathxx::Vec2::operator/=(), kazmathxx::Vec2::operator=(), and kazmathxx::Vec2::Vec2().\hypertarget{structkm_vec2_21eee8f77413b24dd6a8a19314d61fed}{ 40 | \index{kmVec2@{kmVec2}!y@{y}} 41 | \index{y@{y}!kmVec2@{kmVec2}} 42 | \subsubsection[y]{\setlength{\rightskip}{0pt plus 5cm}kmScalar {\bf kmVec2::y}}} 43 | \label{structkm_vec2_21eee8f77413b24dd6a8a19314d61fed} 44 | 45 | 46 | 47 | 48 | Definition at line 39 of file vec2.h. 49 | 50 | Referenced by kmVec2Add(), kmVec2AreEqual(), kmVec2Dot(), kmVec2Fill(), kmVec2Length(), kmVec2LengthSq(), kmVec2Normalize(), kmVec2Scale(), kmVec2Subtract(), kazmathxx::Vec2::operator$\ast$(), kazmathxx::Vec2::operator$\ast$=(), kazmathxx::Vec2::operator+(), kazmathxx::Vec2::operator+=(), kazmathxx::Vec2::operator-(), kazmathxx::Vec2::operator-=(), kazmathxx::Vec2::operator/(), kazmathxx::Vec2::operator/=(), kazmathxx::Vec2::operator=(), and kazmathxx::Vec2::Vec2(). 51 | 52 | The documentation for this struct was generated from the following file:\begin{CompactItemize} 53 | \item 54 | /ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/\hyperlink{vec2_8h}{vec2.h}\end{CompactItemize} 55 | -------------------------------------------------------------------------------- /docs/latex/structkm_vec4.tex: -------------------------------------------------------------------------------- 1 | \hypertarget{structkm_vec4}{ 2 | \section{kmVec4 Struct Reference} 3 | \label{structkm_vec4}\index{kmVec4@{kmVec4}} 4 | } 5 | {\tt \#include $<$vec4.h$>$} 6 | 7 | \subsection*{Data Fields} 8 | \begin{CompactItemize} 9 | \item 10 | kmScalar \hyperlink{structkm_vec4_2f05daa4b1ff4cdb6f5340d0ff28c6ac}{x} 11 | \item 12 | kmScalar \hyperlink{structkm_vec4_166ea934d56eca30a97b190d365b62b8}{y} 13 | \item 14 | kmScalar \hyperlink{structkm_vec4_f4e022632723b68a304ac40d308cceab}{z} 15 | \item 16 | kmScalar \hyperlink{structkm_vec4_b002db65c3793806ec266f2cc348879f}{w} 17 | \end{CompactItemize} 18 | 19 | 20 | \subsection{Detailed Description} 21 | 22 | 23 | Definition at line 36 of file vec4.h. 24 | 25 | \subsection{Field Documentation} 26 | \hypertarget{structkm_vec4_2f05daa4b1ff4cdb6f5340d0ff28c6ac}{ 27 | \index{kmVec4@{kmVec4}!x@{x}} 28 | \index{x@{x}!kmVec4@{kmVec4}} 29 | \subsubsection[x]{\setlength{\rightskip}{0pt plus 5cm}kmScalar {\bf kmVec4::x}}} 30 | \label{structkm_vec4_2f05daa4b1ff4cdb6f5340d0ff28c6ac} 31 | 32 | 33 | 34 | 35 | Definition at line 37 of file vec4.h. 36 | 37 | Referenced by kmPlaneDot(), kmVec4Add(), kmVec4AreEqual(), kmVec4Dot(), kmVec4Fill(), kmVec4Length(), kmVec4LengthSq(), kmVec4Normalize(), kmVec4Scale(), kmVec4Subtract(), and kmVec4Transform().\hypertarget{structkm_vec4_166ea934d56eca30a97b190d365b62b8}{ 38 | \index{kmVec4@{kmVec4}!y@{y}} 39 | \index{y@{y}!kmVec4@{kmVec4}} 40 | \subsubsection[y]{\setlength{\rightskip}{0pt plus 5cm}kmScalar {\bf kmVec4::y}}} 41 | \label{structkm_vec4_166ea934d56eca30a97b190d365b62b8} 42 | 43 | 44 | 45 | 46 | Definition at line 38 of file vec4.h. 47 | 48 | Referenced by kmPlaneDot(), kmVec4Add(), kmVec4AreEqual(), kmVec4Dot(), kmVec4Fill(), kmVec4Length(), kmVec4LengthSq(), kmVec4Normalize(), kmVec4Scale(), kmVec4Subtract(), and kmVec4Transform().\hypertarget{structkm_vec4_f4e022632723b68a304ac40d308cceab}{ 49 | \index{kmVec4@{kmVec4}!z@{z}} 50 | \index{z@{z}!kmVec4@{kmVec4}} 51 | \subsubsection[z]{\setlength{\rightskip}{0pt plus 5cm}kmScalar {\bf kmVec4::z}}} 52 | \label{structkm_vec4_f4e022632723b68a304ac40d308cceab} 53 | 54 | 55 | 56 | 57 | Definition at line 39 of file vec4.h. 58 | 59 | Referenced by kmPlaneDot(), kmVec4Add(), kmVec4AreEqual(), kmVec4Dot(), kmVec4Fill(), kmVec4Length(), kmVec4LengthSq(), kmVec4Normalize(), kmVec4Scale(), kmVec4Subtract(), and kmVec4Transform().\hypertarget{structkm_vec4_b002db65c3793806ec266f2cc348879f}{ 60 | \index{kmVec4@{kmVec4}!w@{w}} 61 | \index{w@{w}!kmVec4@{kmVec4}} 62 | \subsubsection[w]{\setlength{\rightskip}{0pt plus 5cm}kmScalar {\bf kmVec4::w}}} 63 | \label{structkm_vec4_b002db65c3793806ec266f2cc348879f} 64 | 65 | 66 | 67 | 68 | Definition at line 40 of file vec4.h. 69 | 70 | Referenced by kmPlaneDot(), kmVec4Add(), kmVec4AreEqual(), kmVec4Dot(), kmVec4Fill(), kmVec4Length(), kmVec4LengthSq(), kmVec4Normalize(), kmVec4Scale(), kmVec4Subtract(), and kmVec4Transform(). 71 | 72 | The documentation for this struct was generated from the following file:\begin{CompactItemize} 73 | \item 74 | /ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/\hyperlink{vec4_8h}{vec4.h}\end{CompactItemize} 75 | -------------------------------------------------------------------------------- /docs/latex/structtagkm_mat3.tex: -------------------------------------------------------------------------------- 1 | \hypertarget{structtagkm_mat3}{ 2 | \section{tagkmMat3 Struct Reference} 3 | \label{structtagkm_mat3}\index{tagkmMat3@{tagkmMat3}} 4 | } 5 | {\tt \#include $<$mat3.h$>$} 6 | 7 | \subsection*{Data Fields} 8 | \begin{CompactItemize} 9 | \item 10 | kmScalar \hyperlink{structtagkm_mat3_ac23f88b2167a10907728e8f216788e0}{mat} \mbox{[}9\mbox{]} 11 | \end{CompactItemize} 12 | 13 | 14 | \subsection{Detailed Description} 15 | 16 | 17 | Definition at line 35 of file mat3.h. 18 | 19 | \subsection{Field Documentation} 20 | \hypertarget{structtagkm_mat3_ac23f88b2167a10907728e8f216788e0}{ 21 | \index{tagkmMat3@{tagkmMat3}!mat@{mat}} 22 | \index{mat@{mat}!tagkmMat3@{tagkmMat3}} 23 | \subsubsection[{mat}]{\setlength{\rightskip}{0pt plus 5cm}kmScalar {\bf tagkmMat3::mat}\mbox{[}9\mbox{]}}} 24 | \label{structtagkm_mat3_ac23f88b2167a10907728e8f216788e0} 25 | 26 | 27 | 28 | 29 | Definition at line 36 of file mat3.h. 30 | 31 | Referenced by kmMat3Adjugate(), kmMat3AreEqual(), kmMat3Assign(), kmMat3Determinant(), kmMat3Fill(), kmMat3Identity(), kmMat3IsIdentity(), kmMat3Multiply(), kmMat3Rotation(), kmMat3ScalarMultiply(), kmMat3Scaling(), kmMat3Translation(), kmMat3Transpose(), kmMat4AreEqual(), kmMat4Inverse(), and kmMat4Multiply(). 32 | 33 | The documentation for this struct was generated from the following file:\begin{CompactItemize} 34 | \item 35 | C:/Users/luke/Desktop/KazMath/kazmath/src/\hyperlink{mat3_8h}{mat3.h}\end{CompactItemize} 36 | -------------------------------------------------------------------------------- /docs/latex/utility_8c.tex: -------------------------------------------------------------------------------- 1 | \hypertarget{utility_8c}{ 2 | \section{/ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/utility.c File Reference} 3 | \label{utility_8c}\index{/ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/utility.c@{/ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/utility.c}} 4 | } 5 | {\tt \#include \char`\"{}utility.h\char`\"{}}\par 6 | \subsection*{Functions} 7 | \begin{CompactItemize} 8 | \item 9 | kmScalar \hyperlink{utility_8c_baccba26e1ee8a40c74692818ae84fd4}{kmSQR} (kmScalar s) 10 | \item 11 | kmScalar \hyperlink{utility_8c_b0ea21c5e13f71fd8bdcf404c7cbcf34}{kmDegreesToRadians} (kmScalar degrees) 12 | \item 13 | kmScalar \hyperlink{utility_8c_10cf11f45b8ce07219996467c7a27d10}{kmRadiansToDegrees} (kmScalar radians) 14 | \end{CompactItemize} 15 | 16 | 17 | \subsection{Function Documentation} 18 | \hypertarget{utility_8c_b0ea21c5e13f71fd8bdcf404c7cbcf34}{ 19 | \index{utility.c@{utility.c}!kmDegreesToRadians@{kmDegreesToRadians}} 20 | \index{kmDegreesToRadians@{kmDegreesToRadians}!utility.c@{utility.c}} 21 | \subsubsection[kmDegreesToRadians]{\setlength{\rightskip}{0pt plus 5cm}kmScalar kmDegreesToRadians (kmScalar {\em degrees})}} 22 | \label{utility_8c_b0ea21c5e13f71fd8bdcf404c7cbcf34} 23 | 24 | 25 | Returns degrees as radians. 26 | 27 | Definition at line 38 of file utility.c. 28 | 29 | References kmPIOver180. 30 | 31 | Referenced by kmGLRotatef(), kmMat4PerspectiveProjection(), and kmQuaternionRotationYawPitchRoll().\hypertarget{utility_8c_10cf11f45b8ce07219996467c7a27d10}{ 32 | \index{utility.c@{utility.c}!kmRadiansToDegrees@{kmRadiansToDegrees}} 33 | \index{kmRadiansToDegrees@{kmRadiansToDegrees}!utility.c@{utility.c}} 34 | \subsubsection[kmRadiansToDegrees]{\setlength{\rightskip}{0pt plus 5cm}kmScalar kmRadiansToDegrees (kmScalar {\em radians})}} 35 | \label{utility_8c_10cf11f45b8ce07219996467c7a27d10} 36 | 37 | 38 | Returns radians as degrees 39 | 40 | Definition at line 45 of file utility.c. 41 | 42 | References kmPIUnder180.\hypertarget{utility_8c_baccba26e1ee8a40c74692818ae84fd4}{ 43 | \index{utility.c@{utility.c}!kmSQR@{kmSQR}} 44 | \index{kmSQR@{kmSQR}!utility.c@{utility.c}} 45 | \subsubsection[kmSQR]{\setlength{\rightskip}{0pt plus 5cm}kmScalar kmSQR (kmScalar {\em s})}} 46 | \label{utility_8c_baccba26e1ee8a40c74692818ae84fd4} 47 | 48 | 49 | Returns the square of s (e.g. s$\ast$s) 50 | 51 | Definition at line 31 of file utility.c. 52 | 53 | Referenced by kmQuaternionSlerp(), kmQuaternionToAxisAngle(), kmVec2Length(), kmVec2LengthSq(), kmVec3Length(), kmVec3LengthSq(), kmVec4Length(), and kmVec4LengthSq(). -------------------------------------------------------------------------------- /java/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | FIND_PACKAGE(Java) #Find the java executables 3 | 4 | IF(JAVA_FOUND) 5 | 6 | FIND_PACKAGE(JNI) 7 | 8 | IF(JNI_FOUND) 9 | MESSAGE("Building JNI wrapper") 10 | 11 | SET(JKAZMATH_CLASS kazmath/jkazmath.class) 12 | SET(JKAZMATH_HEADER jni/kazmath_jkazmath.h) 13 | SET(JKAZMATH_JAR kazmath.jar) 14 | 15 | FILE(GLOB_RECURSE KAZMATH_C_FILES ${CMAKE_SOURCE_DIR}/kazmath/*.c ${CMAKE_CURRENT_SOURCE_DIR}/jni/*.c) 16 | 17 | ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${JKAZMATH_CLASS} COMMAND ${Java_JAVAC_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/kazmath/jkazmath.java -d ${CMAKE_CURRENT_BINARY_DIR}) 18 | ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${JKAZMATH_HEADER} COMMAND ${Java_JAVAH_EXECUTABLE} -classpath ${CMAKE_CURRENT_BINARY_DIR} -d jni kazmath.jkazmath DEPENDS ${JKAZMATH_CLASS}) 19 | 20 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/jni ${JNI_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/kazmath) 21 | 22 | SET(CMAKE_SHARED_LINKER_FLAGS "-lm -lc") 23 | SET(CMAKE_POSITION_INDEPENDENT_CODE ON) 24 | 25 | ADD_LIBRARY(Jkazmath SHARED ${KAZMATH_C_FILES} ${JKAZMATH_HEADER}) 26 | ADD_CUSTOM_COMMAND(TARGET Jkazmath POST_BUILD COMMAND ${Java_JAR_EXECUTABLE} cvf kazmath.jar kazmath) 27 | 28 | INSTALL(TARGETS Jkazmath LIBRARY DESTINATION ${INSTALL_LIB_DIR}) 29 | INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/kazmath.jar DESTINATION ${CMAKE_INSTALL_PREFIX}/share/java) 30 | ELSE(JNI_FOUND) 31 | MESSAGE("Not building JNI wrapper. Couldn't find JNI") 32 | ENDIF(JNI_FOUND) 33 | 34 | ENDIF(JAVA_FOUND) 35 | -------------------------------------------------------------------------------- /java/sample/test.java: -------------------------------------------------------------------------------- 1 | 2 | import static kazmath.jkazmath.*; 3 | 4 | import java.nio.FloatBuffer; 5 | import java.text.DecimalFormat; 6 | 7 | public class test { 8 | 9 | 10 | 11 | public static void main(String[] args) { 12 | test t=new test(); 13 | t.run(); 14 | } 15 | 16 | // do some splurious kazmath operations to show it in use... 17 | 18 | public void run() { 19 | // create a mat4 struct... 20 | FloatBuffer mat = kmCreateKmMat4(); 21 | 22 | kmMat4Identity(mat); 23 | 24 | // vec3 structs 25 | FloatBuffer eye = kmCreateKmVec3(); 26 | FloatBuffer centre = kmCreateKmVec3(); 27 | FloatBuffer up = kmCreateKmVec3(); 28 | 29 | 30 | kmVec3Fill(eye, 0, 0, 0); 31 | kmVec3Fill(centre, 0, 0,-5); 32 | kmVec3Fill(up, 0, 1, 0); 33 | 34 | 35 | kmMat4LookAt(mat, eye, centre, up); 36 | kmMat4RotationYawPitchRoll(mat, 0.1f,0.2f,0.3f); 37 | 38 | DecimalFormat df = new DecimalFormat("' '0.000;'-'0.000"); 39 | 40 | // dump the end result 41 | System.out.println(df.format(mat.get( 0))+", "+df.format(mat.get( 1))+", "+df.format(mat.get( 2))+", "+df.format(mat.get( 3))); 42 | System.out.println(df.format(mat.get( 4))+", "+df.format(mat.get( 5))+", "+df.format(mat.get( 6))+", "+df.format(mat.get( 7))); 43 | System.out.println(df.format(mat.get( 8))+", "+df.format(mat.get( 9))+", "+df.format(mat.get(10))+", "+df.format(mat.get(11))); 44 | System.out.println(df.format(mat.get(12))+", "+df.format(mat.get(13))+", "+df.format(mat.get(14))+", "+df.format(mat.get(15))); 45 | 46 | FloatBuffer v1 = kmCreateKmVec3(); 47 | FloatBuffer v2 = kmCreateKmVec3(); 48 | 49 | kmVec3Fill(v1, 0, 0, 0); 50 | kmVec3Fill(v2, 1, 2, 3); 51 | 52 | kmVec3Lerp(v1, v1, v2, 0.5f); 53 | 54 | System.out.println("\n" + df.format(v1.get( 0))+", "+df.format(v1.get( 1))+", "+df.format(v1.get( 2))); 55 | 56 | 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /kazmath.config: -------------------------------------------------------------------------------- 1 | /* ADD PREDEFINED MACROS HERE! */ 2 | -------------------------------------------------------------------------------- /kazmath.creator: -------------------------------------------------------------------------------- 1 | [General] 2 | -------------------------------------------------------------------------------- /kazmath.files: -------------------------------------------------------------------------------- 1 | cmake_modules/FindKAZMATH.cmake 2 | java/jni/kazmath.c 3 | java/kazmath/jkazmath.java 4 | java/sample/test.class 5 | java/sample/test.java 6 | java/CMakeLists.txt 7 | kazmath/GL/mat4stack.c 8 | kazmath/GL/mat4stack.c.orig 9 | kazmath/GL/mat4stack.h 10 | kazmath/GL/matrix.c 11 | kazmath/GL/matrix.h 12 | kazmath/aabb.c 13 | kazmath/aabb.h 14 | kazmath/CMakeLists.txt 15 | kazmath/kazmath.h 16 | kazmath/mat3.c 17 | kazmath/mat3.h 18 | kazmath/mat4.c 19 | kazmath/mat4.h 20 | kazmath/plane.c 21 | kazmath/plane.h 22 | kazmath/quaternion.c 23 | kazmath/quaternion.h 24 | kazmath/ray2.c 25 | kazmath/ray2.h 26 | kazmath/utility.c 27 | kazmath/utility.h 28 | kazmath/vec2.c 29 | kazmath/vec2.h 30 | kazmath/vec3.c 31 | kazmath/vec3.h 32 | kazmath/vec4.c 33 | kazmath/vec4.h 34 | kazmathxx/src/aabb.h 35 | kazmathxx/src/CMakeLists.txt 36 | kazmathxx/src/mat3.h 37 | kazmathxx/src/mat4.h 38 | kazmathxx/src/plane.h 39 | kazmathxx/src/quaternion.h 40 | kazmathxx/src/vec2.h 41 | kazmathxx/src/vec3.h 42 | kazmathxx/src/vec4.h 43 | kazmathxx/CMakeLists.txt 44 | test-apps/CUnitTest/bin/Debug/CUnitTest 45 | test-apps/CUnitTest/kazmath_mat_stack_test/main.cpp 46 | test-apps/CUnitTest/CUnitTest.cbp 47 | test-apps/CUnitTest/CUnitTest.depend 48 | test-apps/CUnitTest/CUnitTest.layout 49 | test-apps/CUnitTest/main.c 50 | test-apps/CUnitTest/testMat3.c 51 | test-apps/CUnitTest/testMat4.c 52 | test-apps/CUnitTest/testMatrixStack.c 53 | test-apps/CUnitTest/testVec2.c 54 | test-apps/CUnitTest/testVec3.c 55 | test-apps/CUnitTest/testVec4.c 56 | test-apps/PerspectiveMatrix/bin/Debug/PerspectiveMatrix 57 | test-apps/PerspectiveMatrix/src/basecode/GLee/GLee.cpp 58 | test-apps/PerspectiveMatrix/src/basecode/GLee/GLee.h 59 | test-apps/PerspectiveMatrix/src/basecode/input.cpp 60 | test-apps/PerspectiveMatrix/src/basecode/input.h 61 | test-apps/PerspectiveMatrix/src/basecode/lesson.cpp 62 | test-apps/PerspectiveMatrix/src/basecode/lesson.h 63 | test-apps/PerspectiveMatrix/src/basecode/window.cpp 64 | test-apps/PerspectiveMatrix/src/basecode/window.h 65 | test-apps/PerspectiveMatrix/src/main.cpp 66 | test-apps/PerspectiveMatrix/src/perspective_test.cpp 67 | test-apps/PerspectiveMatrix/src/perspective_test.h 68 | test-apps/PerspectiveMatrix/PerspectiveMatrix.cbp 69 | test-apps/PerspectiveMatrix/PerspectiveMatrix.depend 70 | test-apps/PerspectiveMatrix/PerspectiveMatrix.layout 71 | tests/CMakeLists.txt 72 | tests/test_aabb.h 73 | tests/test_mat3.h 74 | tests/test_mat4.h 75 | tests/test_plane.h 76 | tests/test_ray2.h 77 | tests/test_vec2.h 78 | ChangeLog 79 | CMakeLists.txt 80 | README 81 | tests/test_quaternion.h 82 | kazmath/ray3.h 83 | kazmath/ray3.c 84 | tests/test_ray3.h 85 | tests/test_vec3.h 86 | kazmathxx/vec4.h 87 | kazmathxx/vec3.h 88 | kazmathxx/vec2.h 89 | kazmathxx/quaternion.h 90 | kazmathxx/plane.h 91 | kazmathxx/mat4.h 92 | kazmathxx/mat3.h 93 | kazmathxx/aabb.h 94 | kazmath/aabb2.c 95 | kazmath/aabb2.h 96 | kazmath/aabb3.c 97 | kazmath/aabb3.h 98 | lua/lkazmath.c 99 | lua/CMakeLists.txt 100 | tests/kaztest/kaztest.h -------------------------------------------------------------------------------- /kazmath.includes: -------------------------------------------------------------------------------- 1 | /home/kazade/Git/kazmath/kazmath 2 | /home/kazade/Git/kazmath/kazmath/GL 3 | /home/kazade/Git/kazmath/kazmathxx/src 4 | /home/kazade/Git/kazmath/test-apps/PerspectiveMatrix/src 5 | /home/kazade/Git/kazmath/test-apps/PerspectiveMatrix/src/basecode 6 | /home/kazade/Git/kazmath/test-apps/PerspectiveMatrix/src/basecode/GLee 7 | kazmath 8 | -------------------------------------------------------------------------------- /kazmath.recipe: -------------------------------------------------------------------------------- 1 | # bzr-builder format 0.2 deb-version 1.1.0+{revno} 2 | lp:kazmath 3 | -------------------------------------------------------------------------------- /kazmath/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | #ADD_LIBRARY(Kazmath STATIC ${KAZMATH_SRCS}) 3 | #INSTALL(TARGETS Kazmath ARCHIVE DESTINATION lib) 4 | FIND_PACKAGE(Threads REQUIRED) 5 | 6 | if(BUILD_SHARED_LIBS) 7 | ADD_LIBRARY(kazmath SHARED ${KAZMATH_SOURCES}) 8 | TARGET_LINK_LIBRARIES(kazmath ${CMAKE_THREAD_LIBS_INIT}) 9 | SET_TARGET_PROPERTIES(kazmath 10 | PROPERTIES 11 | VERSION 0.0.1 12 | SOVERSION 1) 13 | else() 14 | ADD_LIBRARY(kazmath STATIC ${KAZMATH_SOURCES}) 15 | endif() 16 | 17 | SET_TARGET_PROPERTIES(kazmath PROPERTIES COMPILE_FLAGS "--std=c99") 18 | 19 | INSTALL(TARGETS kazmath DESTINATION ${INSTALL_LIB_DIR}) 20 | 21 | #ADD_LIBRARY(KazmathGL STATIC ${GL_UTILS_SRCS}) 22 | #INSTALL(TARGETS KazmathGL ARCHIVE DESTINATION lib) 23 | 24 | INSTALL(FILES ${KAZMATH_HEADERS} DESTINATION include/kazmath) 25 | IF (KAZMATH_BUILD_GL_UTILS) 26 | INSTALL(FILES ${GL_UTILS_HEADERS} DESTINATION include/kazmath/GL) 27 | ENDIF (KAZMATH_BUILD_GL_UTILS) 28 | INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../cmake_modules/KAZMATHConfig.cmake DESTINATION ${CMAKE_INSTALL_PREFIX}/share/kazmath) 29 | -------------------------------------------------------------------------------- /kazmath/GL/mat4stack.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008, Luke Benstead. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | #define INITIAL_SIZE 30 32 | #define INCREMENT 50 33 | 34 | #include "mat4stack.h" 35 | 36 | void km_mat4_stack_initialize(km_mat4_stack* stack) { 37 | stack->stack = (kmMat4*) malloc(sizeof(kmMat4) * INITIAL_SIZE); /*allocate the memory*/ 38 | stack->capacity = INITIAL_SIZE; /*Set the capacity to 10*/ 39 | stack->top = NULL; /*Set the top to NULL*/ 40 | stack->item_count = 0; 41 | } 42 | 43 | void km_mat4_stack_push(km_mat4_stack* stack, const kmMat4* item) 44 | { 45 | stack->top = &stack->stack[stack->item_count]; 46 | kmMat4Assign(stack->top, item); 47 | stack->item_count++; 48 | 49 | if(stack->item_count >= stack->capacity) 50 | { 51 | kmMat4* temp = NULL; 52 | stack->capacity += INCREMENT; 53 | temp = stack->stack; 54 | stack->stack = (kmMat4*) malloc(stack->capacity*sizeof(kmMat4)); 55 | memcpy(stack->stack, temp, sizeof(kmMat4)*(stack->capacity - INCREMENT)); 56 | free(temp); 57 | stack->top = &stack->stack[stack->item_count - 1]; 58 | } 59 | } 60 | 61 | void km_mat4_stack_pop(km_mat4_stack* stack, kmMat4* pOut) 62 | { 63 | assert(stack->item_count && "Cannot pop an empty stack"); 64 | 65 | stack->item_count--; 66 | stack->top = &stack->stack[stack->item_count - 1]; 67 | } 68 | 69 | void km_mat4_stack_release(km_mat4_stack* stack) { 70 | free(stack->stack); 71 | stack->top = NULL; 72 | stack->item_count = 0; 73 | stack->capacity = 0; 74 | } 75 | -------------------------------------------------------------------------------- /kazmath/GL/mat4stack.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008, Luke Benstead. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #ifndef C_STACK_H_INCLUDED 27 | #define C_STACK_H_INCLUDED 28 | 29 | #include "../mat4.h" 30 | 31 | typedef struct km_mat4_stack { 32 | int capacity; /*The total item capacity*/ 33 | int item_count; /*The number of items*/ 34 | kmMat4* top; 35 | kmMat4* stack; 36 | } km_mat4_stack; 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | void km_mat4_stack_initialize(km_mat4_stack* stack); 43 | void km_mat4_stack_push(km_mat4_stack* stack, const kmMat4* item); 44 | void km_mat4_stack_pop(km_mat4_stack* stack, kmMat4* pOut); 45 | void km_mat4_stack_release(km_mat4_stack* stack); 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | 51 | #endif /* C_STACK_H_INCLUDED */ 52 | -------------------------------------------------------------------------------- /kazmath/GL/matrix.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008, Luke Benstead. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #ifndef KM_GL_MATRIX_H_INCLUDED 27 | #define KM_GL_MATRIX_H_INCLUDED 28 | 29 | #define KM_GL_MODELVIEW 0x1700 30 | #define KM_GL_PROJECTION 0x1701 31 | #define KM_GL_TEXTURE 0x1702 32 | 33 | typedef unsigned int kmGLEnum; 34 | 35 | #include "../mat4.h" 36 | #include "../vec3.h" 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | /* Added by Tobias Lensing for icedcoffee-framework.org*/ 43 | void kmGLSetCurrentContext(void *contextRef); 44 | void *kmGLGetCurrentContext(); 45 | void kmGLClearCurrentContext(); 46 | void kmGLClearAllContexts(); 47 | 48 | void kmGLPushMatrix(void); 49 | void kmGLPopMatrix(void); 50 | void kmGLMatrixMode(kmGLEnum mode); 51 | void kmGLLoadIdentity(void); 52 | void kmGLLoadMatrix(const kmMat4* pIn); 53 | void kmGLMultMatrix(const kmMat4* pIn); 54 | void kmGLTranslatef(float x, float y, float z); 55 | void kmGLRotatef(float angle, float x, float y, float z); 56 | void kmGLScalef(float x, float y, float z); 57 | void kmGLGetMatrix(kmGLEnum mode, kmMat4* pOut); 58 | 59 | #ifdef __cplusplus 60 | } 61 | #endif 62 | 63 | #endif /* MATRIX_H_INCLUDED */ 64 | -------------------------------------------------------------------------------- /kazmath/aabb3.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008, Luke Benstead. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #ifndef KAZMATH_AABB3D_H_INCLUDED 27 | #define KAZMATH_AABB3D_H_INCLUDED 28 | 29 | #include "vec3.h" 30 | #include "utility.h" 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | /** 37 | * A struture that represents an axis-aligned 38 | * bounding box. 39 | */ 40 | typedef struct kmAABB3 { 41 | kmVec3 min; /** The max corner of the box */ 42 | kmVec3 max; /** The min corner of the box */ 43 | } kmAABB3; 44 | 45 | 46 | /** 47 | Initializes the AABB around a central point. If centre is NULL 48 | then the origin is used. Returns pBox. 49 | */ 50 | kmAABB3* kmAABB3Initialize(kmAABB3* pBox, const kmVec3* centre, 51 | const kmScalar width, const kmScalar height, 52 | const kmScalar depth); 53 | 54 | /** 55 | * Returns KM_TRUE if point is in the specified AABB, returns KM_FALSE 56 | * otherwise. 57 | */ 58 | int kmAABB3ContainsPoint(const kmAABB3* pBox, const kmVec3* pPoint); 59 | 60 | /** 61 | * Assigns pIn to pOut, returns pOut. 62 | */ 63 | kmAABB3* kmAABB3Assign(kmAABB3* pOut, const kmAABB3* pIn); 64 | 65 | /** 66 | * Scales pIn by s, stores the resulting AABB in pOut. Returns pOut 67 | */ 68 | kmAABB3* kmAABB3Scale(kmAABB3* pOut, const kmAABB3* pIn, kmScalar s); 69 | kmBool kmAABB3IntersectsTriangle(kmAABB3* box, const kmVec3* p1, 70 | const kmVec3* p2, const kmVec3* p3); 71 | kmBool kmAABB3IntersectsAABB(const kmAABB3* box, const kmAABB3* other); 72 | kmEnum kmAABB3ContainsAABB(const kmAABB3* container, const kmAABB3* to_check); 73 | kmScalar kmAABB3DiameterX(const kmAABB3* aabb); 74 | kmScalar kmAABB3DiameterY(const kmAABB3* aabb); 75 | kmScalar kmAABB3DiameterZ(const kmAABB3* aabb); 76 | kmVec3* kmAABB3Centre(const kmAABB3* aabb, kmVec3* pOut); 77 | 78 | /** 79 | * @brief kmAABB3ExpandToContain 80 | * @param pOut - The resulting AABB 81 | * @param pIn - The original AABB 82 | * @param other - Another AABB that you want pIn expanded to contain 83 | * @return 84 | */ 85 | kmAABB3* kmAABB3ExpandToContain(kmAABB3* pOut, const kmAABB3* pIn, const kmAABB3* other); 86 | 87 | #ifdef __cplusplus 88 | } 89 | #endif 90 | 91 | #endif 92 | -------------------------------------------------------------------------------- /kazmath/kazmath.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008, Luke Benstead. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #ifndef KAZMATH_H_INCLUDED 27 | #define KAZMATH_H_INCLUDED 28 | 29 | #include "vec2.h" 30 | #include "vec3.h" 31 | #include "vec4.h" 32 | #include "mat3.h" 33 | #include "mat4.h" 34 | #include "utility.h" 35 | #include "quaternion.h" 36 | #include "plane.h" 37 | #include "aabb2.h" 38 | #include "aabb3.h" 39 | #include "ray2.h" 40 | #include "ray3.h" 41 | 42 | #endif /* KAZMATH_H_INCLUDED */ 43 | -------------------------------------------------------------------------------- /kazmath/ray2.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011, Luke Benstead. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #ifndef RAY_2_H 27 | #define RAY_2_H 28 | 29 | #include "utility.h" 30 | #include "vec2.h" 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | typedef struct kmRay2 { 37 | kmVec2 start; 38 | kmVec2 dir; 39 | } kmRay2; 40 | 41 | void kmRay2Fill(kmRay2* ray, kmScalar px, kmScalar py, kmScalar vx, 42 | kmScalar vy); 43 | void kmRay2FillWithEndpoints( kmRay2 *ray, const kmVec2 *start, 44 | const kmVec2 *end ); 45 | 46 | /* 47 | Lines are defined by a pt and a vector. It outputs the vector 48 | multiply factor that gives the intersection point 49 | */ 50 | kmBool kmLine2WithLineIntersection(const kmVec2 *ptA, const kmVec2 *vecA, 51 | const kmVec2 *ptB, const kmVec2 *vecB, 52 | kmScalar *outTA, kmScalar *outTB, 53 | kmVec2 *outIntersection ); 54 | 55 | kmBool kmSegment2WithSegmentIntersection( const kmRay2 *segmentA, 56 | const kmRay2 *segmentB, 57 | kmVec2 *intersection ); 58 | 59 | kmBool kmRay2IntersectLineSegment(const kmRay2* ray, const kmVec2* p1, 60 | const kmVec2* p2, kmVec2* intersection); 61 | kmBool kmRay2IntersectTriangle(const kmRay2* ray, const kmVec2* p1, 62 | const kmVec2* p2, const kmVec2* p3, 63 | kmVec2* intersection, kmVec2* normal_out, 64 | kmScalar* distance); 65 | 66 | kmBool kmRay2IntersectBox(const kmRay2* ray, const kmVec2* p1, 67 | const kmVec2* p2, const kmVec2* p3, 68 | const kmVec2* p4, kmVec2* intersection, 69 | kmVec2* normal_out); 70 | 71 | kmBool kmRay2IntersectCircle(const kmRay2* ray, const kmVec2 centre, 72 | const kmScalar radius, kmVec2* intersection); 73 | 74 | #ifdef __cplusplus 75 | } 76 | #endif 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /kazmath/ray3.h: -------------------------------------------------------------------------------- 1 | #ifndef RAY3_H 2 | #define RAY3_H 3 | 4 | #include "utility.h" 5 | #include "vec3.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | typedef struct kmRay3 { 12 | kmVec3 start; 13 | kmVec3 dir; 14 | } kmRay3; 15 | 16 | struct kmPlane; 17 | struct kmAABB3; 18 | 19 | kmRay3* kmRay3Fill(kmRay3* ray, kmScalar px, kmScalar py, kmScalar pz, kmScalar vx, kmScalar vy, kmScalar vz); 20 | kmRay3* kmRay3FromPointAndDirection(kmRay3* ray, const kmVec3* point, const kmVec3* direction); 21 | kmBool kmRay3IntersectPlane(kmVec3* pOut, const kmRay3* ray, const struct kmPlane* plane); 22 | kmBool kmRay3IntersectTriangle(const kmRay3* ray, const kmVec3* v0, const kmVec3* v1, const kmVec3* v2, kmVec3* intersection, kmVec3* normal, kmScalar* distance); 23 | kmBool kmRay3IntersectAABB3(const kmRay3* ray, const struct kmAABB3* aabb, kmVec3* intersection, kmScalar* distance); 24 | 25 | #ifdef __cplusplus 26 | } 27 | #endif 28 | 29 | #endif /* RAY3_H */ 30 | -------------------------------------------------------------------------------- /kazmath/utility.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008, Luke Benstead. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #include "utility.h" 27 | 28 | kmScalar kmSQR(kmScalar s) { 29 | return s*s; 30 | } 31 | 32 | kmScalar kmDegreesToRadians(kmScalar degrees) { 33 | return degrees * kmPIOver180; 34 | } 35 | 36 | kmScalar kmRadiansToDegrees(kmScalar radians) { 37 | return radians * kmPIUnder180; 38 | } 39 | 40 | kmScalar kmMin(kmScalar lhs, kmScalar rhs) { 41 | return (lhs < rhs)? lhs : rhs; 42 | } 43 | 44 | kmScalar kmMax(kmScalar lhs, kmScalar rhs) { 45 | return (lhs > rhs)? lhs : rhs; 46 | } 47 | 48 | kmBool kmAlmostEqual(kmScalar lhs, kmScalar rhs) { 49 | return (fabs(lhs - rhs) <= kmEpsilon * fmax(1.0f, fmax(lhs, rhs))); 50 | } 51 | 52 | kmScalar kmClamp(kmScalar x, kmScalar min, kmScalar max) 53 | { 54 | return x < min ? min : (x > max ? max : x); 55 | } 56 | 57 | kmScalar kmLerp(kmScalar x, kmScalar y, kmScalar t ) 58 | { 59 | return x + t * ( y - x ); 60 | } 61 | -------------------------------------------------------------------------------- /kazmath/utility.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008, Luke Benstead. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #ifndef UTILITY_H_INCLUDED 27 | #define UTILITY_H_INCLUDED 28 | 29 | #include 30 | #include 31 | 32 | #ifndef kmScalar 33 | #ifdef USE_DOUBLE_PRECISION 34 | #define kmScalar double 35 | #define kmEpsilon DBL_EPSILON 36 | #else 37 | #define kmScalar float 38 | #define kmEpsilon FLT_EPSILON 39 | #endif 40 | 41 | #endif 42 | 43 | #ifndef kmBool 44 | #define kmBool unsigned char 45 | #endif 46 | 47 | #ifndef kmUchar 48 | #define kmUchar unsigned char 49 | #endif 50 | 51 | #ifndef kmEnum 52 | #define kmEnum unsigned int 53 | #endif 54 | 55 | #ifndef kmUint 56 | #define kmUint unsigned int 57 | #endif 58 | 59 | #ifndef kmInt 60 | #define kmInt int 61 | #endif 62 | 63 | #ifndef KM_FALSE 64 | #define KM_FALSE 0 65 | #endif 66 | 67 | #ifndef KM_TRUE 68 | #define KM_TRUE 1 69 | #endif 70 | 71 | #define kmPI 3.14159265358979323846f 72 | #define kmPIOver180 (kmPI / 180.0f) 73 | #define kmPIUnder180 (180.0 / kmPI) 74 | 75 | #define KM_CONTAINS_NONE (kmEnum)0 76 | #define KM_CONTAINS_PARTIAL (kmEnum)1 77 | #define KM_CONTAINS_ALL (kmEnum)2 78 | 79 | #ifdef __cplusplus 80 | extern "C" { 81 | #endif 82 | 83 | /** 84 | * Returns the square of s (e.g. s*s) 85 | */ 86 | extern kmScalar kmSQR(kmScalar s); 87 | 88 | /** 89 | * Returns degrees as radians. 90 | */ 91 | extern kmScalar kmDegreesToRadians(kmScalar degrees); 92 | 93 | /** 94 | * Returns radians as degrees 95 | */ 96 | extern kmScalar kmRadiansToDegrees(kmScalar radians); 97 | 98 | extern kmScalar kmMin(kmScalar lhs, kmScalar rhs); 99 | extern kmScalar kmMax(kmScalar lhs, kmScalar rhs); 100 | extern kmBool kmAlmostEqual(kmScalar lhs, kmScalar rhs); 101 | 102 | extern kmScalar kmClamp(kmScalar x, kmScalar min, kmScalar max); 103 | extern kmScalar kmLerp(kmScalar x, kmScalar y, kmScalar factor); 104 | 105 | #ifdef __cplusplus 106 | } 107 | #endif 108 | 109 | #endif /* UTILITY_H_INCLUDED */ 110 | -------------------------------------------------------------------------------- /kazmathxx/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | SET(KAZMATHXX_HEADERS 2 | vec2.h 3 | vec3.h 4 | vec4.h 5 | mat4.h 6 | mat3.h 7 | plane.h 8 | quaternion.h 9 | aabb.h 10 | ) 11 | 12 | INSTALL(FILES ${KAZMATHXX_HEADERS} DESTINATION include/kazmathxx) 13 | 14 | 15 | -------------------------------------------------------------------------------- /kazmathxx/mat3.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2009, Luke Benstead, Carsten Haubold 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 21 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | #ifndef _KAZMATHXX_MAT3_H 27 | #define _KAZMATHXX_MAT3_H 28 | 29 | #include 30 | #include "vec3.h" 31 | 32 | namespace km 33 | { 34 | class mat3 : public kmMat3 35 | { 36 | /// Constructors 37 | mat3() 38 | { 39 | kmMat3Identity(this); 40 | } 41 | 42 | mat3(const kmScalar* pIn) 43 | { 44 | kmMat3Fill(this,pIn); 45 | } 46 | 47 | void identity() 48 | { 49 | kmMat3Identity(this); 50 | } 51 | 52 | const mat3 inverse() const 53 | { 54 | mat3 result = *this; 55 | kmMat3Inverse(&result, &result); 56 | return result; 57 | } 58 | 59 | const bool isIdentity() const 60 | { 61 | return kmMat3IsIdentity(this); 62 | } 63 | 64 | const mat3 transpose() const 65 | { 66 | mat3 result = *this; 67 | kmMat3Transpose(&result, &result); 68 | return result; 69 | } 70 | 71 | static const mat3 rotation(const kmScalar radians) 72 | { 73 | mat3 result; 74 | kmMat3Rotation(&result, radians); 75 | return result; 76 | } 77 | 78 | static const mat3 scaling(const kmScalar x, const kmScalar y) 79 | { 80 | mat3 result; 81 | kmMat3Scaling(&result, x,y); 82 | return result; 83 | } 84 | 85 | static const mat3 translation(const kmScalar x, const kmScalar y) 86 | { 87 | mat3 result; 88 | kmMat3Translation(&result, x,y); 89 | return result; 90 | } 91 | 92 | /* still missing: 93 | kmMat3* kmMat3Adjugate(kmMat3* pOut, const kmMat3* pIn); 94 | kmScalar kmMat3Determinant(const kmMat3* pIn); 95 | kmMat3* kmMat3ScalarMultiply(kmMat3* pOut, const kmMat3* pM, const kmScalar pFactor); 96 | */ 97 | }; 98 | 99 | ///< Matrix multiplication 100 | inline const mat3 operator*(const mat3& lhs, const mat3& rhs) 101 | { 102 | mat3 result; 103 | kmMat3Multiply(&result, &lhs, &rhs); 104 | return result; 105 | } 106 | 107 | ///< Checks for equality (with a small threshold epsilon) 108 | inline const bool operator==(const mat3& lhs, const mat3& rhs) 109 | { 110 | return kmMat3AreEqual(&lhs,&rhs); 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /kazmathxx/plane.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kazade/kazmath/48dbc191da47880ea6708b0a7b3c7b69b6352cad/kazmathxx/plane.h -------------------------------------------------------------------------------- /kazmathxx/quaternion.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kazade/kazmath/48dbc191da47880ea6708b0a7b3c7b69b6352cad/kazmathxx/quaternion.h -------------------------------------------------------------------------------- /lua/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | MESSAGE("Building lkazmath wrapper") 2 | 3 | FILE(GLOB_RECURSE KAZMATH_C_FILES ${CMAKE_SOURCE_DIR}/kazmath/*.c ${CMAKE_CURRENT_SOURCE_DIR}/*.c) 4 | 5 | INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/kazmath) 6 | 7 | FIND_PACKAGE(Lua51) 8 | 9 | IF(LUA51_FOUND) 10 | SET(CMAKE_POSITION_INDEPENDENT_CODE ON) 11 | 12 | LIST(REMOVE_ITEM KAZMATH_C_FILES ${CMAKE_SOURCE_DIR}/kazmath/GL/mat4stack.c) 13 | LIST(REMOVE_ITEM KAZMATH_C_FILES ${CMAKE_SOURCE_DIR}/kazmath/GL/matrix.c) 14 | 15 | ADD_LIBRARY(lkazmath SHARED ${KAZMATH_C_FILES}) 16 | TARGET_LINK_LIBRARIES(lkazmath ${LUA_LIBRARIES}) 17 | include_directories(${LUA_INCLUDE_DIR}) 18 | 19 | INSTALL(TARGETS lkazmath LIBRARY DESTINATION ${INSTALL_LIB_DIR}) 20 | ELSE() 21 | MESSAGE("Unable to build Lua bindings as lua was not installed on the system") 22 | ENDIF() 23 | -------------------------------------------------------------------------------- /lua/test.lua: -------------------------------------------------------------------------------- 1 | l = require "lkazmath" 2 | 3 | do 4 | local vec2 = l.kmVec2NewWithTbl({x=1,y=2}) 5 | local tbl = vec2:ToTbl() 6 | assert(tbl.x == 1) 7 | assert(tbl.y == 2) 8 | assert(#(vec2:ToArray()) == 2) 9 | assert(vec2.x == tbl.x) 10 | assert(vec2.y == tbl.y) 11 | vec2.x = 0 12 | assert(vec2.x == 0) 13 | -- table.foreach(vec2:ToTbl(), print) 14 | end 15 | 16 | do 17 | local vec3 = l.kmVec3New() 18 | local tbl = vec3:ToTbl() 19 | assert(tbl.x == 0) 20 | assert(tbl.y == 0) 21 | assert(tbl.z == 0) 22 | assert(#(vec3:ToArray()) == 3) 23 | vec3:Fill(5, 6, 7) 24 | assert(vec3.x == 5) 25 | assert(vec3.y == 6) 26 | assert(vec3.z == 7) 27 | vec3.x = 0 28 | local array = vec3:ToArray() 29 | assert(array[1] == 0) 30 | assert(array[2] == 6) 31 | assert(array[3] == 7) 32 | end 33 | 34 | do 35 | local array = {1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6} 36 | local mat4 = l.kmMat4NewWithArray(array) 37 | local newarray = mat4:ToArray() 38 | assert(#array == #newarray) 39 | end 40 | 41 | do 42 | local ray2 = l.kmRay2New() 43 | ray2.px = 1 44 | ray2.py = 2 45 | ray2.vx = 3 46 | ray2.vy = 4 47 | assert(ray2.px == 1) 48 | assert(ray2.py == 2) 49 | assert(ray2.vx == 3) 50 | assert(ray2.vy == 4) 51 | end 52 | 53 | 54 | -------------------------------------------------------------------------------- /lua/unit_test/mat.lua: -------------------------------------------------------------------------------- 1 | local lkazmath = require "lkazmath" 2 | 3 | local dataMap = { 4 | kmMat3 = {}, 5 | kmMat4 = {}, 6 | } 7 | 8 | for i=1, 9 do 9 | table.insert(dataMap.kmMat3, i) 10 | end 11 | 12 | for i=1, 16 do 13 | table.insert(dataMap.kmMat4, i) 14 | end 15 | 16 | function table_size(tbl) 17 | local cnt = 0 18 | for _, _ in pairs(tbl) do 19 | cnt = cnt + 1 20 | end 21 | return cnt 22 | end 23 | 24 | for className, data in pairs (dataMap) do 25 | local newFuncName = string.format("%sNew", className) 26 | local newWithFuncName = string.format("%sNewWithArray", className) 27 | local obj = lkazmath[newFuncName]() 28 | local obj2 = lkazmath[newWithFuncName](data) 29 | for i, v in pairs(obj:ToArray()) do 30 | assert(v == 0) 31 | end 32 | for i, v in pairs(obj2:ToArray()) do 33 | assert(v == i) 34 | end 35 | obj:Fill(obj2:ToArray()) 36 | assert(obj:AreEqual(obj2) == true) 37 | end 38 | 39 | -------------------------------------------------------------------------------- /lua/unit_test/ray.lua: -------------------------------------------------------------------------------- 1 | local lkazmath = require "lkazmath" 2 | 3 | local dataMap = { 4 | kmRay2 = {px=1, py=2, vx=3, vy=4}, 5 | kmRay3 = {px=1, py=2, pz=3, vx=4, vy=5, vz=6}, 6 | } 7 | 8 | function table_size(tbl) 9 | local cnt = 0 10 | for _, _ in pairs(tbl) do 11 | cnt = cnt + 1 12 | end 13 | return cnt 14 | end 15 | 16 | for className, data in pairs (dataMap) do 17 | local newFuncName = string.format("%sNew", className) 18 | local obj = lkazmath[newFuncName]() 19 | for filedName, _ in pairs(data) do 20 | assert(obj[filedName] == 0) 21 | end 22 | for filedName, value in pairs(data) do 23 | obj[filedName] = value 24 | assert(obj[filedName] == value) 25 | end 26 | 27 | local array = {} 28 | for i=1, table_size(data) do 29 | table.insert(array, 0) 30 | end 31 | 32 | obj:Fill(unpack(array)) 33 | for filedName, _ in pairs(data) do 34 | assert(obj[filedName] == 0) 35 | end 36 | end 37 | 38 | -------------------------------------------------------------------------------- /lua/unit_test/vec.lua: -------------------------------------------------------------------------------- 1 | local lkazmath = require "lkazmath" 2 | 3 | local dataMap = { 4 | kmVec2 = {x=1, y=2}, 5 | kmVec3 = {x=1, y=2, z=3}, 6 | kmVec4 = {x=1, y=2, z=3, w=4}, 7 | } 8 | 9 | function table_size(tbl) 10 | local cnt = 0 11 | for _, _ in pairs(tbl) do 12 | cnt = cnt + 1 13 | end 14 | return cnt 15 | end 16 | 17 | for className, data in pairs (dataMap) do 18 | local newFuncName = string.format("%sNew", className) 19 | local obj = lkazmath[newFuncName]() 20 | 21 | for filedName, _ in pairs(data) do 22 | assert(obj[filedName] == 0) 23 | end 24 | 25 | for filedName, value in pairs(data) do 26 | obj[filedName] = value 27 | assert(obj[filedName] == value) 28 | end 29 | 30 | local array = {} 31 | for i=1, table_size(data) do 32 | table.insert(array, i) 33 | end 34 | 35 | obj:Fill(unpack(array)) 36 | for i, v in pairs(obj:ToArray()) do 37 | assert(array[i] == v) 38 | end 39 | 40 | for filedName, v in pairs(obj:ToTbl()) do 41 | assert(obj[filedName] == v) 42 | end 43 | end 44 | 45 | -------------------------------------------------------------------------------- /test-apps/CUnitTest/CUnitTest.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 67 | 68 | -------------------------------------------------------------------------------- /test-apps/CUnitTest/CUnitTest.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /test-apps/CUnitTest/bin/Debug/CUnitTest: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kazade/kazmath/48dbc191da47880ea6708b0a7b3c7b69b6352cad/test-apps/CUnitTest/bin/Debug/CUnitTest -------------------------------------------------------------------------------- /test-apps/CUnitTest/kazmath_mat_stack_test/main.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // main.cpp 3 | // kazmath_mat_stack_test 4 | // 5 | // Created by Carsten Haubold on 6/08/12. 6 | // Copyright (c) 2012 Carsten Haubold. All rights reserved. 7 | // 8 | 9 | #include 10 | -------------------------------------------------------------------------------- /test-apps/CUnitTest/main.c: -------------------------------------------------------------------------------- 1 | /* 2 | CUnit tests for Kazmath 3 | */ 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | /* The suite initialization function. 10 | * Nothing to do here 11 | */ 12 | int init_suite1(void) 13 | { 14 | return 0; 15 | } 16 | 17 | /* The suite cleanup function. 18 | * 19 | */ 20 | int clean_suite1(void) 21 | { 22 | return 0; 23 | } 24 | 25 | extern int addVec2Tests(CU_pSuite suite); 26 | extern int addVec3Tests(CU_pSuite suite); 27 | extern int addVec4Tests(CU_pSuite suite); 28 | extern int addMat3Tests(CU_pSuite suite); 29 | extern int addMat4Tests(CU_pSuite suite); 30 | extern int addMat4StackTests(CU_pSuite suite); 31 | 32 | /* The main() function for setting up and running the tests. 33 | * Returns a CUE_SUCCESS on successful running, another 34 | * CUnit error code on failure. 35 | */ 36 | int main() 37 | { 38 | 39 | /* initialize the CUnit test registry */ 40 | if (CUE_SUCCESS != CU_initialize_registry()) 41 | return CU_get_error(); 42 | 43 | /* add the suites to the registry */ 44 | CU_pSuite vec2testSuite = CU_add_suite("Vec2 - Test - Suite", init_suite1, clean_suite1); 45 | if (NULL == vec2testSuite) { 46 | CU_cleanup_registry(); 47 | return CU_get_error(); 48 | } 49 | addVec2Tests(vec2testSuite); 50 | 51 | CU_pSuite vec3testSuite = CU_add_suite("Vec3 - Test - Suite", init_suite1, clean_suite1); 52 | if (NULL == vec3testSuite) { 53 | CU_cleanup_registry(); 54 | return CU_get_error(); 55 | } 56 | addVec3Tests(vec3testSuite); 57 | 58 | CU_pSuite vec4testSuite = CU_add_suite("Vec4 - Test - Suite", init_suite1, clean_suite1); 59 | if (NULL == vec4testSuite) { 60 | CU_cleanup_registry(); 61 | return CU_get_error(); 62 | } 63 | addVec4Tests(vec4testSuite); 64 | 65 | CU_pSuite mat3testSuite = CU_add_suite("Mat3 - Test - Suite", init_suite1, clean_suite1); 66 | if (NULL == mat3testSuite) { 67 | CU_cleanup_registry(); 68 | return CU_get_error(); 69 | } 70 | addMat3Tests(mat3testSuite); 71 | 72 | CU_pSuite mat4testSuite = CU_add_suite("Mat4 - Test - Suite", init_suite1, clean_suite1); 73 | if (NULL == mat4testSuite) { 74 | CU_cleanup_registry(); 75 | return CU_get_error(); 76 | } 77 | addMat4Tests(mat4testSuite); 78 | 79 | CU_pSuite mat4stackTestSuite = CU_add_suite("Mat4 Stack - Test - Suite", init_suite1, clean_suite1); 80 | if (NULL == mat4stackTestSuite) { 81 | CU_cleanup_registry(); 82 | return CU_get_error(); 83 | } 84 | addMat4StackTests(mat4stackTestSuite); 85 | 86 | /* Run all tests using the CUnit Basic interface */ 87 | CU_basic_set_mode(CU_BRM_VERBOSE); 88 | CU_basic_run_tests(); 89 | CU_cleanup_registry(); 90 | return CU_get_error(); 91 | } 92 | 93 | -------------------------------------------------------------------------------- /test-apps/CUnitTest/testMat3.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | void print_matrix3(const kmMat3* mat) 7 | { 8 | const int max = 3; 9 | printf("\n\n"); 10 | for(int i = 0; i < max; i++) 11 | { 12 | printf("|"); 13 | 14 | for(int j = 0; j < max; j++) 15 | { 16 | if(j > 0) 17 | { 18 | printf("\t"); 19 | } 20 | 21 | printf("%f",mat->mat[i + max*j]); 22 | } 23 | 24 | printf("|\n"); 25 | } 26 | printf("\n"); 27 | } 28 | 29 | void testMat3Inverse1(void) 30 | { 31 | kmMat3 mat; 32 | CU_ASSERT(NULL != kmMat3Identity(&mat)); 33 | print_matrix3(&mat); 34 | printf("\nDeterminant of Identity matrix is: %f\n", kmMat3Determinant(&mat)); 35 | 36 | kmMat3 adj; 37 | CU_ASSERT(NULL != kmMat3Adjugate(&adj, &mat)); 38 | print_matrix3(&adj); 39 | CU_ASSERT(NULL != kmMat3Inverse(&mat, kmMat3Determinant(&mat), &mat)); 40 | print_matrix3(&mat); 41 | CU_ASSERT(kmMat3IsIdentity(&mat)); 42 | } 43 | 44 | void testMat3Transpose(void) 45 | { 46 | kmMat3 mat; 47 | float temp[] = { 0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f }; 48 | memcpy(mat.mat, temp, sizeof(float) * 9); 49 | 50 | print_matrix3(&mat); 51 | 52 | kmMat3 transpose; 53 | float temp2[] = {8.0f, 7.0f, 6.0f, 5.0f, 4.0f, 3.0f, 2.0f, 1.0f, 0.0f}; 54 | memcpy(transpose.mat, temp2, sizeof(float) * 9); 55 | print_matrix3(&transpose); 56 | 57 | kmMat3 result; 58 | CU_ASSERT(NULL != kmMat3Transpose(&result, &mat)); 59 | print_matrix3(&result); 60 | CU_ASSERT(kmMat3AreEqual(&transpose, &result)); 61 | } 62 | 63 | void testMat3AxisAngle(void) { 64 | float radians = 1.0; 65 | kmMat3 a; 66 | kmVec3 axisIn; 67 | kmVec3Fill(&axisIn, 1.0f, 0.0f, 0.0f); 68 | kmMat3RotationAxis(&a, &axisIn, radians); 69 | } 70 | 71 | int addMat3Tests(CU_pSuite suite) 72 | { 73 | /* add the tests to the suite */ 74 | if ((NULL == CU_add_test(suite, "kmMat3Inverse Identity - test", testMat3Inverse1))) 75 | { 76 | CU_cleanup_registry(); 77 | return CU_get_error(); 78 | } 79 | 80 | if ((NULL == CU_add_test(suite, "kmMat3Transpose - test", testMat3Transpose))) 81 | { 82 | CU_cleanup_registry(); 83 | return CU_get_error(); 84 | } 85 | 86 | return CU_get_error(); 87 | } 88 | -------------------------------------------------------------------------------- /test-apps/CUnitTest/testMat4.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | void print_matrix4(const kmMat4* mat) 7 | { 8 | const int max = 4; 9 | printf("\n\n"); 10 | for(int i = 0; i < max; i++) 11 | { 12 | printf("|"); 13 | 14 | for(int j = 0; j < max; j++) 15 | { 16 | if(j > 0) 17 | { 18 | printf("\t"); 19 | } 20 | 21 | printf("%f",mat->mat[i + max*j]); 22 | } 23 | 24 | printf("|\n"); 25 | } 26 | printf("\n"); 27 | } 28 | 29 | void testMat4Inverse1(void) 30 | { 31 | kmMat4 mat; 32 | CU_ASSERT(NULL != kmMat4Identity(&mat)); 33 | print_matrix4(&mat); 34 | CU_ASSERT(NULL != kmMat4Inverse(&mat, &mat)); 35 | print_matrix4(&mat); 36 | CU_ASSERT(kmMat4IsIdentity(&mat)); 37 | } 38 | 39 | int addMat4Tests(CU_pSuite suite) 40 | { 41 | /* add the tests to the suite */ 42 | if ((NULL == CU_add_test(suite, "kmMat4Inverse Identity - test", testMat4Inverse1))) 43 | { 44 | CU_cleanup_registry(); 45 | return CU_get_error(); 46 | } 47 | return CU_get_error(); 48 | } 49 | -------------------------------------------------------------------------------- /test-apps/CUnitTest/testMatrixStack.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | void testMatrixMode(void) 8 | { 9 | kmGLMatrixMode(KM_GL_MODELVIEW); 10 | kmGLLoadIdentity(); 11 | 12 | kmMat4 modelview; 13 | kmMat4RotationX(&modelview, kmDegreesToRadians(45.0f)); 14 | kmGLMultMatrix(&modelview); 15 | 16 | kmMat4 out; 17 | kmGLGetMatrix(KM_GL_MODELVIEW, &out); 18 | 19 | CU_ASSERT(kmMat4AreEqual(&modelview, &out)); 20 | 21 | kmGLMatrixMode(KM_GL_PROJECTION); 22 | kmMat4 identity; 23 | kmMat4Identity(&identity); 24 | 25 | kmGLGetMatrix(KM_GL_PROJECTION, &out); 26 | CU_ASSERT(kmMat4AreEqual(&identity, &out)); 27 | } 28 | 29 | int addMat4StackTests(CU_pSuite suite) 30 | { 31 | /* add the tests to the suite */ 32 | if ((NULL == CU_add_test(suite, "kmGLMatrixMode - test", testMatrixMode))) 33 | { 34 | CU_cleanup_registry(); 35 | return CU_get_error(); 36 | } 37 | return CU_get_error(); 38 | } 39 | -------------------------------------------------------------------------------- /test-apps/CUnitTest/testVec2.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | void testVec2Length(void) 7 | { 8 | kmVec2 vec; 9 | vec.x = 4.0f; 10 | vec.y = 3.0f; 11 | 12 | CU_ASSERT(5.0f == kmVec2Length(&vec)); 13 | } 14 | 15 | int addVec2Tests(CU_pSuite suite) 16 | { 17 | /* add the tests to the suite */ 18 | if ((NULL == CU_add_test(suite, "kmVec2Length - test", testVec2Length))) 19 | { 20 | CU_cleanup_registry(); 21 | return CU_get_error(); 22 | } 23 | return CU_get_error(); 24 | } 25 | -------------------------------------------------------------------------------- /test-apps/CUnitTest/testVec4.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | void testVec4Length(void) 7 | { 8 | kmVec4 vec; 9 | vec.x = 4.0f; 10 | vec.y = 3.0f; 11 | vec.z = 5.7f; 12 | vec.w = 1.0f; 13 | 14 | CU_ASSERT(7.6478755f == kmVec4Length(&vec)); 15 | } 16 | 17 | int addVec4Tests(CU_pSuite suite) 18 | { 19 | /* add the tests to the suite */ 20 | if ((NULL == CU_add_test(suite, "kmVec4Length - test", testVec4Length))) 21 | { 22 | CU_cleanup_registry(); 23 | return CU_get_error(); 24 | } 25 | return CU_get_error(); 26 | } 27 | -------------------------------------------------------------------------------- /test-apps/PerspectiveMatrix/PerspectiveMatrix.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 58 | 59 | -------------------------------------------------------------------------------- /test-apps/PerspectiveMatrix/PerspectiveMatrix.depend: -------------------------------------------------------------------------------- 1 | # depslib dependency file v1.0 2 | 1207083847 source:/home/dumbo/Programmieren/KazadeEngine/NeHeKazmath/kazmath/test-apps/PerspectiveMatrix/src/basecode/GLee/GLee.cpp 3 | 4 | 5 | 6 | "GLee.h" 7 | 8 | 9 | 1207083847 /home/dumbo/Programmieren/KazadeEngine/NeHeKazmath/kazmath/test-apps/PerspectiveMatrix/src/basecode/GLee/GLee.h 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 1217100682 source:/home/dumbo/Programmieren/KazadeEngine/NeHeKazmath/kazmath/test-apps/PerspectiveMatrix/src/basecode/input.cpp 18 | "input.h" 19 | 20 | 1217879974 /home/dumbo/Programmieren/KazadeEngine/NeHeKazmath/kazmath/test-apps/PerspectiveMatrix/src/basecode/input.h 21 | 22 | 23 | 1219006993 source:/home/dumbo/Programmieren/KazadeEngine/NeHeKazmath/kazmath/test-apps/PerspectiveMatrix/src/basecode/lesson.cpp 24 | "lesson.h" 25 | 26 | 1217936250 /home/dumbo/Programmieren/KazadeEngine/NeHeKazmath/kazmath/test-apps/PerspectiveMatrix/src/basecode/lesson.h 27 | "window.h" 28 | 29 | "input.h" 30 | 31 | 1217100537 /home/dumbo/Programmieren/KazadeEngine/NeHeKazmath/kazmath/test-apps/PerspectiveMatrix/src/basecode/window.h 32 | 33 | 34 | "GLee/GLee.h" 35 | 36 | 37 | 38 | 39 | 40 | 1217936250 source:/home/dumbo/Programmieren/KazadeEngine/NeHeKazmath/kazmath/test-apps/PerspectiveMatrix/src/basecode/window.cpp 41 | "window.h" 42 | 43 | 1219005959 source:/home/dumbo/Programmieren/KazadeEngine/NeHeKazmath/kazmath/test-apps/PerspectiveMatrix/src/main.cpp 44 | "perspective_test.h" 45 | 46 | 1219007425 /home/dumbo/Programmieren/KazadeEngine/NeHeKazmath/kazmath/test-apps/PerspectiveMatrix/src/perspective_test.h 47 | "basecode/lesson.h" 48 | 49 | 50 | 51 | 52 | 53 | 54 | 1219007695 source:/home/dumbo/Programmieren/KazadeEngine/NeHeKazmath/kazmath/test-apps/PerspectiveMatrix/src/perspective_test.cpp 55 | "perspective_test.h" 56 | 57 | -------------------------------------------------------------------------------- /test-apps/PerspectiveMatrix/PerspectiveMatrix.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /test-apps/PerspectiveMatrix/bin/Debug/PerspectiveMatrix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kazade/kazmath/48dbc191da47880ea6708b0a7b3c7b69b6352cad/test-apps/PerspectiveMatrix/bin/Debug/PerspectiveMatrix -------------------------------------------------------------------------------- /test-apps/PerspectiveMatrix/src/basecode/input.cpp: -------------------------------------------------------------------------------- 1 | #include "input.h" 2 | 3 | SDLInputSystem::SDLInputSystem() 4 | { 5 | memset(&m_LastKeyState, 0, sizeof(unsigned char) * SDLK_LAST); 6 | memset(&m_CurrentKeyState, 0, sizeof(unsigned char) * SDLK_LAST); 7 | } 8 | 9 | SDLInputSystem::~SDLInputSystem() 10 | { 11 | 12 | } 13 | 14 | void SDLInputSystem::update() 15 | { 16 | //Copy the current state to the last state 17 | memcpy(&m_LastKeyState, &m_CurrentKeyState, sizeof(unsigned char) * SDLK_LAST); 18 | 19 | //Get a pointer to SDLs internal key state 20 | unsigned char* SDLInternalState = SDL_GetKeyState(NULL); 21 | 22 | //Copy SDLs internal keystate to our current array 23 | memcpy(&m_CurrentKeyState, SDLInternalState, sizeof(unsigned char) * SDLK_LAST); 24 | } 25 | -------------------------------------------------------------------------------- /test-apps/PerspectiveMatrix/src/basecode/input.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | class SDLInputSystem 4 | { 5 | public: 6 | SDLInputSystem(); 7 | ~SDLInputSystem(); 8 | 9 | void update(); 10 | 11 | inline bool isKeyDown(SDLKey k) 12 | { 13 | return (!m_LastKeyState[k] && m_CurrentKeyState[k]); 14 | } 15 | 16 | inline bool isKeyUp(SDLKey k) 17 | { 18 | return (m_LastKeyState[k] && !m_CurrentKeyState[k]); 19 | } 20 | 21 | inline bool isKeyStillDown(SDLKey k) 22 | { 23 | return (m_LastKeyState[k] && m_CurrentKeyState[k]); 24 | } 25 | 26 | inline bool isKeyStillUp(SDLKey k) 27 | { 28 | return (!m_LastKeyState[k] && !m_CurrentKeyState[k]); 29 | } 30 | 31 | private: 32 | unsigned char m_LastKeyState[SDLK_LAST]; 33 | unsigned char m_CurrentKeyState[SDLK_LAST]; 34 | }; 35 | -------------------------------------------------------------------------------- /test-apps/PerspectiveMatrix/src/basecode/lesson.cpp: -------------------------------------------------------------------------------- 1 | #include "lesson.h" 2 | 3 | namespace NeHe 4 | { 5 | Lesson::Lesson(): 6 | m_Active(true) 7 | { 8 | } 9 | 10 | Lesson::~Lesson() 11 | { 12 | } 13 | 14 | void Lesson::update(float deltaTime) 15 | { 16 | //Do time based updates before rendering 17 | } 18 | 19 | void Lesson::draw() 20 | { 21 | glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); 22 | glLoadIdentity(); 23 | } 24 | 25 | void Lesson::resize(int x, int y) 26 | { 27 | std::cout << "Resizing Window to " << x << "x" << y << std::endl; 28 | 29 | if (y <= 0) 30 | { 31 | y = 1; 32 | } 33 | 34 | glViewport(0,0,x,y); 35 | 36 | glMatrixMode(GL_PROJECTION); 37 | glLoadIdentity(); 38 | gluPerspective(45.0f,(GLfloat)x/(GLfloat)y,1.0f,100.0f); 39 | 40 | 41 | glMatrixMode(GL_MODELVIEW); 42 | glLoadIdentity(); 43 | } 44 | 45 | bool Lesson::processEvents() 46 | { 47 | SDL_Event event; 48 | 49 | while (SDL_PollEvent(&event))//get all events 50 | { 51 | switch (event.type) 52 | { 53 | // Quit event 54 | case SDL_QUIT: 55 | { 56 | // Return false because we are quitting. 57 | return false; 58 | } 59 | 60 | case SDL_KEYDOWN: 61 | { 62 | SDLKey sym = event.key.keysym.sym; 63 | 64 | if (sym == SDLK_ESCAPE) //Quit if escape was pressed 65 | { 66 | return false; 67 | } 68 | 69 | break; 70 | } 71 | 72 | case SDL_VIDEORESIZE: 73 | { 74 | //the window has been resized so we need to set up our viewport and projection according to the new size 75 | resize(event.resize.w, event.resize.h); 76 | break; 77 | } 78 | case SDL_ACTIVEEVENT: 79 | { 80 | if (event.active.state == SDL_APPACTIVE) 81 | { 82 | if (event.active.gain) 83 | { 84 | m_Active = true; 85 | } 86 | else 87 | { 88 | m_Active = false; 89 | } 90 | } 91 | } 92 | // Default case 93 | default: 94 | { 95 | break; 96 | } 97 | } 98 | } 99 | 100 | return true; 101 | } 102 | 103 | bool Lesson::init() 104 | { 105 | if (!m_Window.createWindow(800, 600, 32, false, "Ne(w)He Lesson")) 106 | { 107 | return false; 108 | } 109 | 110 | glClearColor(0.0, 0.0, 0.0, 1.0); 111 | 112 | return true; 113 | } 114 | 115 | void Lesson::run() 116 | { 117 | while (processEvents()) 118 | { 119 | m_Input.update(); //Get the keyboard state 120 | update(float(m_Window.getElapsedMillisecs()) / 1000.0f); 121 | if (m_Active) 122 | { 123 | draw(); 124 | SDL_GL_SwapBuffers(); 125 | } 126 | } 127 | } 128 | }; 129 | -------------------------------------------------------------------------------- /test-apps/PerspectiveMatrix/src/basecode/lesson.h: -------------------------------------------------------------------------------- 1 | #ifndef _NEHE_LESSON 2 | #define _NEHE_LESSON 3 | 4 | //we need to include window first because GLee needs to be included before GL.h 5 | #include "window.h" 6 | 7 | #include 8 | #include "input.h" 9 | 10 | namespace NeHe 11 | { 12 | class Lesson 13 | { 14 | protected: 15 | Window m_Window; ///< The window for this lesson 16 | SDLInputSystem m_Input; ///< Handles user input 17 | bool m_Active; //Is the window active or minimized? 18 | 19 | virtual void draw(); 20 | virtual void resize(int x, int y); 21 | virtual bool processEvents(); 22 | 23 | public: 24 | Lesson(); 25 | virtual ~Lesson(); 26 | 27 | virtual bool init(); 28 | virtual void update(float deltaTime); 29 | virtual void run(); 30 | }; 31 | }; 32 | 33 | #endif 34 | 35 | -------------------------------------------------------------------------------- /test-apps/PerspectiveMatrix/src/basecode/window.cpp: -------------------------------------------------------------------------------- 1 | #include "window.h" 2 | 3 | namespace NeHe 4 | { 5 | Window::Window(): 6 | m_Width(0), 7 | m_Height(0), 8 | m_Bpp(0), 9 | m_Fullscreen(false), 10 | m_Time(0) 11 | { 12 | 13 | } 14 | 15 | Window::~Window() 16 | { 17 | SDL_Quit(); 18 | } 19 | 20 | bool Window::createWindow(int width, int height, int bpp, bool fullscreen, const string& title) 21 | { 22 | if ( SDL_Init( SDL_INIT_VIDEO ) != 0 ) 23 | { 24 | return false; 25 | } 26 | 27 | //Copy the values incase we need them 28 | m_Height = height; 29 | m_Width = width; 30 | m_Title = title; 31 | m_Fullscreen = fullscreen; 32 | m_Bpp = bpp; 33 | 34 | //all values are "at least"! 35 | SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5); 36 | SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5); 37 | SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5); 38 | SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 5); 39 | SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); 40 | SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); 41 | 42 | // Set the title. 43 | SDL_WM_SetCaption(title.c_str(), title.c_str()); 44 | 45 | // Flags tell SDL about the type of window we are creating. 46 | int flags = SDL_OPENGL; 47 | 48 | if (fullscreen == true) 49 | { 50 | flags |= SDL_FULLSCREEN; 51 | } 52 | 53 | // Create the window 54 | SDL_Surface * screen = SDL_SetVideoMode( width, height, bpp, flags ); 55 | 56 | if (screen == 0) 57 | { 58 | return false; 59 | } 60 | 61 | //SDL doesn't trigger off a ResizeEvent at startup, but as we need this for OpenGL, we do this ourself 62 | SDL_Event resizeEvent; 63 | resizeEvent.type = SDL_VIDEORESIZE; 64 | resizeEvent.resize.w = width; 65 | resizeEvent.resize.h = height; 66 | 67 | SDL_PushEvent(&resizeEvent); 68 | 69 | return true; 70 | } 71 | 72 | void Window::setSize(int width, int height) 73 | { 74 | m_Height = height; 75 | m_Width = width; 76 | } 77 | 78 | int Window::getHeight() 79 | { 80 | return m_Height; 81 | } 82 | 83 | int Window::getWidth() 84 | { 85 | return m_Width; 86 | } 87 | 88 | unsigned int Window::getElapsedMillisecs() 89 | { 90 | //SDL_GetTicks returns the time in milliseconds from the programs startup 91 | unsigned int now = SDL_GetTicks(); 92 | unsigned int delta = now - m_Time; 93 | m_Time = now; 94 | 95 | return delta; 96 | } 97 | }; 98 | -------------------------------------------------------------------------------- /test-apps/PerspectiveMatrix/src/basecode/window.h: -------------------------------------------------------------------------------- 1 | #ifndef _NEHE_WINDOW 2 | #define _NEHE_WINDOW 3 | 4 | #include 5 | #include 6 | 7 | #include "GLee/GLee.h" 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | using std::string; 15 | 16 | namespace NeHe 17 | { 18 | class Window 19 | { 20 | private: 21 | int m_Width; 22 | int m_Height; 23 | int m_Bpp; 24 | bool m_Fullscreen; 25 | string m_Title; 26 | unsigned int m_Time; 27 | 28 | public: 29 | Window(); 30 | ~Window(); 31 | 32 | bool createWindow(int width, int height, int bpp, bool fullscreen, const string& title); 33 | void setSize(int width, int height); 34 | int getHeight(); 35 | int getWidth(); 36 | unsigned int getElapsedMillisecs(); 37 | }; 38 | }; 39 | 40 | #endif 41 | 42 | -------------------------------------------------------------------------------- /test-apps/PerspectiveMatrix/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "perspective_test.h" 2 | 3 | int main(int argc, char **argv) 4 | { 5 | //Create a lesson instance 6 | NeHe::Lesson* lesson = new perspective_test(); 7 | 8 | //If we can initialize the lesson 9 | if(lesson->init()) 10 | { 11 | //Then we run it 12 | lesson->run(); 13 | } 14 | else 15 | { 16 | std::cout << "Lesson initializiation failed!" << std::endl; 17 | } 18 | 19 | //If we can't initialize, or the lesson has quit we delete the instance 20 | delete lesson; 21 | 22 | return 0; 23 | }; 24 | -------------------------------------------------------------------------------- /test-apps/PerspectiveMatrix/src/perspective_test.h: -------------------------------------------------------------------------------- 1 | #ifndef _NEHE_LESSON_1 2 | #define _NEHE_LESSON_1 3 | 4 | #include "basecode/lesson.h" 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | class perspective_test : public NeHe::Lesson 12 | { 13 | /* 14 | * We need a structure to store our vertices in, otherwise we 15 | * just had a huge bunch of floats in the end 16 | */ 17 | struct Vertex 18 | { 19 | float x, y, z; 20 | 21 | Vertex(float x, float y, float z) 22 | { 23 | this->x = x; 24 | this->y = y; 25 | this->z = z; 26 | } 27 | }; 28 | 29 | std::vector m_Vertices; //We have a vector of vertices, each vertex with its 3 coordinates 30 | std::vector m_Colors; //also 3 floats for colors, so we just use the Vertex-struct 31 | 32 | public: 33 | perspective_test(); 34 | virtual bool init(); 35 | 36 | 37 | private: 38 | virtual void draw(); 39 | virtual void resize(int x, int y); 40 | void output_matrix(const kmMat4* matrix); 41 | }; 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/include ) 2 | 3 | FILE(GLOB_RECURSE TEST_FILES *.h) 4 | FILE(GLOB_RECURSE TEST_SOURCES *.cpp) 5 | 6 | SET(KAZTEST_EXECUTABLE ${CMAKE_SOURCE_DIR}/bin/kaztest_gen) 7 | 8 | ADD_CUSTOM_COMMAND( 9 | OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp 10 | COMMAND ${KAZTEST_EXECUTABLE} --output ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp ${TEST_FILES} 11 | DEPENDS ${TEST_FILES} ${KAZTEST_EXECUTABLE} 12 | ) 13 | 14 | ADD_EXECUTABLE(kazmath_tests ${TEST_FILES} ${TEST_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp) 15 | SET_TARGET_PROPERTIES(kazmath_tests PROPERTIES COMPILE_FLAGS "-std=c++11") 16 | 17 | ADD_TEST(kazmath_suite kazmath_tests) 18 | 19 | TARGET_LINK_LIBRARIES( 20 | kazmath_tests 21 | kazmath 22 | ) 23 | -------------------------------------------------------------------------------- /tests/test_aabb.h: -------------------------------------------------------------------------------- 1 | #include "kaztest/kaztest.h" 2 | #include 3 | 4 | #include "../kazmath/aabb3.h" 5 | 6 | class TestAABB : public TestCase { 7 | public: 8 | void test_aabb_expand_to_contain() { 9 | kmAABB3 box; 10 | 11 | box.min.x = -1; 12 | box.min.y = -1; 13 | box.min.z = -1; 14 | 15 | box.max.x = 1; 16 | box.max.y = 1; 17 | box.max.z = 1; 18 | 19 | kmAABB3 other; 20 | 21 | other.max.y = other.min.z = other.max.z = 0; 22 | 23 | other.max.x = 2; 24 | other.min.x = -2; 25 | other.min.y = -2; 26 | 27 | kmAABB3ExpandToContain(&box, &box, &other); 28 | 29 | assert_equal(box.max.x, 2); 30 | assert_equal(box.min.x, -2); 31 | assert_equal(box.max.y, 1); 32 | assert_equal(box.min.y, -2); 33 | } 34 | 35 | void test_aabb_contains() { 36 | kmAABB3 box; 37 | 38 | kmVec3Fill(&box.min, -1, -1, -1); 39 | kmVec3Fill(&box.max, 1, 1, 1); 40 | 41 | kmAABB3 inside; 42 | kmVec3Fill(&inside.min, -0.5, -0.5, -0.5); 43 | kmVec3Fill(&inside.max, 0.5, 0.5, 0.5); 44 | 45 | assert_equal(KM_CONTAINS_ALL, kmAABB3ContainsAABB(&box, &inside)); 46 | assert_equal(KM_CONTAINS_NONE, kmAABB3ContainsAABB(&inside, &box)); 47 | 48 | kmAABB3 partial; 49 | kmVec3Fill(&partial.min, -0.5, -0.5, -0.5); 50 | kmVec3Fill(&partial.max, 1.5, 1.5, 1.5); 51 | assert_equal(KM_CONTAINS_PARTIAL, kmAABB3ContainsAABB(&box, &partial)); 52 | } 53 | 54 | /* 55 | void XXX_test_aabb_triangle_intersection() { 56 | 57 | kmAABB3 box; 58 | box.min.x = -5.0f; 59 | box.min.y = -5.0f; 60 | box.min.z = std::numeric_limits::min(); 61 | 62 | box.max.x = 5.0f; 63 | box.max.y = 5.0f; 64 | box.max.z = std::numeric_limits::max(); 65 | 66 | //Triangle that is entirely within the bounds of the box 67 | kmVec3 tri1 [] = { 68 | { -1.0f, 0.0f, 0.0f }, 69 | { 1.0f, 0.0f, 0.0f }, 70 | { 1.0f, 1.0f, 0.0f }, 71 | }; 72 | 73 | //Should intersect 74 | assert_true(kmAABB3IntersectsTriangle(&box, &tri1[0], &tri1[1], &tri1[2])); 75 | 76 | //Triangle that entirely surrounds the box (should still return true) 77 | kmVec3 tri2 [] = { 78 | { -100.0f, 0.0f, 0.0f }, 79 | { 100.0f, 0.0f, 0.0f }, 80 | { 100.0f, 100.0f, 0.0f }, 81 | }; 82 | assert_true(kmAABB3IntersectsTriangle(&box, &tri2[0], &tri2[1], &tri2[2])); 83 | 84 | //Triangle that is entirely outside of the box (should return false) 85 | kmVec3 tri3 [] = { 86 | { 10.0f, 0.0f, 0.0f }, 87 | { 20.0f, 0.0f, 0.0f }, 88 | { 20.0f, 10.0f, 0.0f }, 89 | }; 90 | 91 | assert_true(!kmAABB3IntersectsTriangle(&box, &tri3[0], &tri3[1], &tri3[2])); 92 | 93 | //Triangle that intersects the box (should return true) 94 | kmVec3 tri4 [] = { 95 | { 0.0f, 0.0f, 0.0f }, 96 | { 10.0f, 0.0f, 0.0f }, 97 | { 10.0f, 10.0f, 0.0f }, 98 | }; 99 | 100 | assert_true(kmAABB3IntersectsTriangle(&box, &tri4[0], &tri4[1], &tri4[2])); 101 | }*/ 102 | }; 103 | -------------------------------------------------------------------------------- /tests/test_plane.h: -------------------------------------------------------------------------------- 1 | #include "kaztest/kaztest.h" 2 | 3 | #include "../kazmath/kazmath.h" 4 | 5 | class TestPlane : public TestCase { 6 | public: 7 | void test_plane_extraction_from_matrix() { 8 | 9 | kmMat4 ortho; 10 | kmMat4OrthographicProjection(&ortho, -1.0, 1.0, -1.0, 1.0, 1.0, 10.0); 11 | 12 | kmPlane p; 13 | kmPlaneExtractFromMat4(&p, &ortho, -2); //-2 == TOP 14 | 15 | assert_equal(p.d, 1.0); //Plane's distance from the origin should be 1 16 | 17 | assert_equal(p.a, 0.0); //Plane's normal should be directly down 18 | assert_equal(p.b, -1.0); 19 | assert_equal(p.c, 0.0); 20 | 21 | kmPlaneExtractFromMat4(&p, &ortho, 2); //Bottom 22 | assert_equal(p.d, 1.0); //Plane's distance from the origin should be 1 23 | 24 | assert_equal(p.a, 0.0); //Plane's normal should be directly up 25 | assert_equal(p.b, 1.0); 26 | assert_equal(p.c, 0.0); 27 | 28 | /* 29 | ExtractPlane(view_frustum[LEFT], MV, 1); 30 | ExtractPlane(view_frustum[RIGHT], MV, -1); 31 | ExtractPlane(view_frustum[BOTTOM], MV, 2); 32 | ExtractPlane(view_frustum[TOP], MV, -2); 33 | ExtractPlane(view_frustum[NEAR], MV, 3); 34 | ExtractPlane(view_frustum[FAR], MV, -3); 35 | */ 36 | } 37 | 38 | void test_three_plane_intersection() { 39 | 40 | kmPlane p1, p2, p3; 41 | 42 | p1.a = 0.0; p1.b = 1.0; p1.c = 0.0; p1.d = 1.0; //Floor 43 | p2.a = 1.0; p2.b = 0.0; p2.c = 0.0; p2.d = 1.0; //Left 44 | p3.a = 0.0; p3.b = 0.0; p3.c = 1.0; p3.d = 1.0; //Back 45 | 46 | kmVec3 p; 47 | assert_true(kmPlaneGetIntersection(&p, &p1, &p2, &p3)); 48 | 49 | assert_equal(-1.0, p.x); 50 | assert_equal(-1.0, p.y); 51 | assert_equal(-1.0, p.z); 52 | 53 | } 54 | }; 55 | -------------------------------------------------------------------------------- /tests/test_ray2.h: -------------------------------------------------------------------------------- 1 | #include "kaztest/kaztest.h" 2 | 3 | #include "../kazmath/ray2.h" 4 | 5 | class TestRay2 : public TestCase { 6 | public: 7 | void test_line_segment_intersection() { 8 | kmVec2 line_start, line_end; 9 | kmVec2Fill(&line_start, -10.0f, 1.0f); 10 | kmVec2Fill(&line_end, 10.0f, 1.0f); 11 | 12 | kmRay2 ray; 13 | kmRay2Fill(&ray, 0.0f, 5.0f, 0.0f, -10.0f); 14 | 15 | kmVec2 intersect; 16 | 17 | assert_true(kmRay2IntersectLineSegment(&ray, &line_start, &line_end, &intersect)); 18 | 19 | assert_close(0.0f, intersect.x, 0.001f); 20 | assert_close(1.0f, intersect.y, 0.001f); 21 | 22 | ray.dir.y = -3.0f; 23 | 24 | //The ray is a point, plus a direction to infinite, so it will 25 | //reach the line too, althought the direction vector is shorter 26 | assert_true(kmRay2IntersectLineSegment(&ray, &line_start, &line_end, &intersect)); 27 | 28 | // if we want to check two line segments are crossing we must 29 | // use the function that interprets the Ray as a segment 30 | kmRay2 lineSegment; 31 | kmRay2FillWithEndpoints(&lineSegment, &line_start, &line_end); 32 | assert_true(!kmSegment2WithSegmentIntersection(&ray, &lineSegment, &intersect)); 33 | 34 | 35 | ray.dir.y = -10.0f; 36 | ray.start.x = -100.0f; 37 | //Shouldn't reach the line (ray is too far to the left) 38 | assert_true(!kmRay2IntersectLineSegment(&ray, &line_start, &line_end, &intersect)); 39 | 40 | line_start.x = -150.0f; 41 | //Should now hit the line as it's been extended 42 | assert_true(kmRay2IntersectLineSegment(&ray, &line_start, &line_end, &intersect)); 43 | 44 | //Check diagonal case 45 | 46 | kmRay2Fill(&ray, 0.0, 1.0f, 0.0f, -1.0f); 47 | kmVec2Fill(&line_start, -1.0f, 0.0f); 48 | kmVec2Fill(&line_end, 10.0f, 5.0f); 49 | 50 | assert_true(kmRay2IntersectLineSegment(&ray, &line_start, &line_end, &intersect)); 51 | assert_close(0.0f, intersect.x, 0.001f); 52 | assert_true(intersect.y > 0.0f); 53 | } 54 | 55 | void test_triangle_intersection() { 56 | kmVec2 p1, p2, p3; 57 | 58 | p1.x = -10.0f; 59 | p1.y = 0.0f; 60 | 61 | p2.x = 10.0f; 62 | p2.y = 0.0f; 63 | 64 | p3.x = 0.0f; 65 | p3.y = -5.0f; 66 | 67 | kmRay2 ray; 68 | ray.start.x = 0.0f; 69 | ray.start.y = 0.3f; 70 | ray.dir.x = 0.0f; 71 | ray.dir.y = -0.5f; 72 | 73 | kmVec2 intersect, normal; 74 | kmScalar dist; 75 | assert_true(kmRay2IntersectTriangle(&ray, &p1, &p2, &p3, &intersect, &normal, &dist)); 76 | assert_close(0.0f, intersect.x, 0.001f); 77 | assert_close(0.0f, intersect.y, 0.001f); 78 | assert_close(0.0f, normal.x, 0.001f); 79 | assert_close(1.0f, normal.y, 0.001f); 80 | } 81 | }; 82 | -------------------------------------------------------------------------------- /tests/test_ray3.h: -------------------------------------------------------------------------------- 1 | #include "kaztest/kaztest.h" 2 | 3 | #include "../kazmath/ray3.h" 4 | #include "../kazmath/plane.h" 5 | #include "../kazmath/aabb3.h" 6 | 7 | class TestRay3 : public TestCase { 8 | public: 9 | void test_ray_aabb_intersection() { 10 | kmAABB3 aabb; 11 | kmAABB3Initialize(&aabb, &KM_VEC3_ZERO, 5, 5, 5); 12 | 13 | kmRay3 ray; 14 | kmVec3Fill(&ray.start, 0, 10, 0); 15 | kmVec3Fill(&ray.dir, 0, -10, 0); 16 | 17 | kmVec3 intersect; 18 | float dist; 19 | 20 | kmBool ret = kmRay3IntersectAABB3(&ray, &aabb, &intersect, &dist); 21 | 22 | assert_true(ret); 23 | assert_close(dist, 7.5, kmEpsilon); 24 | assert_close(intersect.x, 0, kmEpsilon); 25 | assert_close(intersect.y, 2.5, kmEpsilon); 26 | assert_close(intersect.z, 0, kmEpsilon); 27 | } 28 | 29 | void test_ray_plane_intersection() { 30 | kmPlane p; 31 | kmPlaneFromNormalAndDistance(&p, &KM_VEC3_NEG_Z, 0); 32 | 33 | assert_close(-1.0, p.c, 0.0001); 34 | 35 | kmRay3 r; 36 | kmVec3 start; 37 | kmVec3Fill(&start, 0, 10, -10); 38 | kmRay3FromPointAndDirection(&r, &start, &KM_VEC3_POS_Z); 39 | 40 | kmVec3 result; 41 | kmRay3IntersectPlane(&result, &r, &p); 42 | 43 | assert_close(0.0, result.x, 0.0001); 44 | assert_close(10.0, result.y, 0.0001); 45 | assert_close(0.0, result.z, 0.0001); 46 | 47 | 48 | //Now move the ray behind the origin and along the x-axis 49 | //and fire it forward into the plane. 50 | kmVec3Assign(&r.dir, &KM_VEC3_NEG_Z); 51 | 52 | start.x = 10; 53 | start.z = 10; 54 | kmVec3Assign(&r.start, &start); 55 | 56 | kmRay3IntersectPlane(&result, &r, &p); 57 | 58 | assert_close(10.0, result.x, 0.0001); 59 | assert_close(10.0, result.y, 0.0001); 60 | assert_close(0.0, result.z, 0.0001); 61 | } 62 | 63 | void test_ray_triangle_intersection() { 64 | kmRay3 ray; 65 | kmRay3Fill(&ray, 0, 0, 0, 0, -1, 0); 66 | 67 | kmVec3 v0, v1, v2; 68 | kmVec3Fill(&v0, -1, -1, -1); 69 | kmVec3Fill(&v1, 0, -1, 1); 70 | kmVec3Fill(&v2, 1, -1, -1); 71 | 72 | kmScalar dist; 73 | kmVec3 intersect; 74 | kmVec3 normal; 75 | 76 | kmBool ret = kmRay3IntersectTriangle(&ray, &v0, &v1, &v2, &intersect, &normal, &dist); 77 | 78 | assert_true(ret); 79 | assert_close(1.0, dist, 0.001); 80 | assert_close(0, intersect.x, 0.001); 81 | assert_close(-1, intersect.y, 0.001); 82 | assert_close(0, intersect.z, 0.001); 83 | assert_close(0, normal.x, 0.001); 84 | assert_close(1, normal.y, 0.001); 85 | assert_close(0, normal.z, 0.001); 86 | 87 | // Shorten the ray 88 | ray.dir.y = -0.5; 89 | ret = kmRay3IntersectTriangle(&ray, &v0, &v1, &v2, &intersect, &normal, &dist); 90 | assert_true(!ret); 91 | 92 | // Now flip the ray 93 | ray.dir.y = 1; 94 | ret = kmRay3IntersectTriangle(&ray, &v0, &v1, &v2, &intersect, &normal, &dist); 95 | assert_true(!ret); 96 | 97 | ray.start.x = 0; 98 | ray.start.y = 0.01; 99 | ray.start.z = 0; 100 | 101 | ray.dir.x = 0; 102 | ray.dir.y = -0.3; 103 | ray.dir.z = 0; 104 | 105 | v0.y = 0; 106 | v1.y = 0; 107 | v2.y = 0; 108 | 109 | ret = kmRay3IntersectTriangle(&ray, &v0, &v1, &v2, &intersect, &normal, &dist); 110 | assert_true(ret); 111 | } 112 | }; 113 | -------------------------------------------------------------------------------- /tests/test_vec2.h: -------------------------------------------------------------------------------- 1 | #include "kaztest/kaztest.h" 2 | 3 | #include "../kazmath/vec2.h" 4 | #include "../kazmath/utility.h" 5 | #include "../kazmath/mat3.h" 6 | 7 | class TestVec2 : public TestCase { 8 | public: 9 | void test_transform() { 10 | kmVec2 orig; 11 | kmVec2Fill(&orig, 0.0, 1.0f); 12 | 13 | kmMat3 rotate; 14 | kmMat3FromRotationZ(&rotate, kmDegreesToRadians(90.0f)); 15 | 16 | kmVec2 rotated; 17 | kmVec2Transform(&rotated, &orig, &rotate); 18 | 19 | assert_close(1.0f, rotated.x, 0.001f); 20 | assert_close(0.0f, rotated.y, 0.001f); 21 | } 22 | 23 | void test_vec2_reflect() { 24 | kmVec2 incident; 25 | kmVec2Fill(&incident, 1.0f, -1.0f); 26 | 27 | kmVec2 reflected; 28 | kmVec2Reflect(&reflected, &incident, &KM_VEC2_POS_Y); 29 | 30 | assert_close(1.0f, reflected.x, 0.001f); 31 | assert_close(1.0f, reflected.y, 0.001f); 32 | } 33 | 34 | void test_degrees_between() { 35 | kmVec2 v1; 36 | kmVec2 v2; 37 | 38 | kmVec2Fill(&v1, 1, 0); 39 | kmVec2Fill(&v2, 0, 1); 40 | 41 | assert_close(90.0f, kmVec2DegreesBetween(&v1, &v2), 0.001f); 42 | assert_close(-90.0f, kmVec2DegreesBetween(&v2, &v1), 0.001f); 43 | } 44 | 45 | void test_vec2_rotate_by() { 46 | kmVec2 res; 47 | kmVec2RotateBy(&res, &KM_VEC2_POS_Y, 90, &KM_VEC2_ZERO); 48 | 49 | assert_close(-1, res.x, 0.001f); 50 | assert_close(0, res.y, 0.001f); 51 | 52 | kmVec2RotateBy(&res, &KM_VEC2_POS_Y, -90, &KM_VEC2_ZERO); 53 | 54 | assert_close(1, res.x, 0.001f); 55 | assert_close(0, res.y, 0.001f); 56 | 57 | kmVec2RotateBy(&res, &KM_VEC2_POS_Y, 180, &KM_VEC2_ZERO); 58 | 59 | assert_close(0, res.x, 0.001f); 60 | assert_close(-1, res.y, 0.001f); 61 | 62 | } 63 | }; 64 | -------------------------------------------------------------------------------- /tests/test_vec3.h: -------------------------------------------------------------------------------- 1 | #include "kaztest/kaztest.h" 2 | 3 | #include "../kazmath/vec3.h" 4 | #include "../kazmath/plane.h" 5 | 6 | class TestVec3 : public TestCase { 7 | public: 8 | void test_project_onto_plane() { 9 | 10 | kmPlane xy; 11 | kmPlaneFill(&xy, 0, 0, 1, 0); 12 | 13 | kmVec3 point; 14 | kmVec3Fill(&point, 0, 10, 10); 15 | 16 | kmVec3 result; 17 | kmVec3ProjectOnToPlane(&result, &point, &xy); 18 | 19 | assert_close(0.0, result.x, 0.0001); 20 | assert_close(10.0, result.y, 0.0001); 21 | assert_close(0.0, result.z, 0.0001); 22 | } 23 | 24 | void test_vec3_reflect() { 25 | kmVec3 incident; 26 | kmVec3Fill(&incident, 7.0f, -5.0f, 3.0f); 27 | 28 | kmVec3 reflected; 29 | kmVec3Reflect(&reflected, &incident, &KM_VEC3_POS_Y); 30 | 31 | assert_close(7.0f, reflected.x, 0.001f); 32 | assert_close(5.0f, reflected.y, 0.001f); 33 | assert_close(3.0f, reflected.z, 0.001f); 34 | } 35 | 36 | void test_vec3_project_onto_vec3() { 37 | kmVec3 self, other, projection, normalized_projection; 38 | 39 | kmVec3Fill(&self, 0.5, 0.5, 0.0); 40 | kmVec3Fill(&other, 1.0, 0.0, 0.0); 41 | 42 | kmVec3ProjectOnToVec3(&self, &other, &projection); 43 | kmVec3Normalize(&normalized_projection, &projection); 44 | 45 | assert_close(1.0, normalized_projection.x, kmEpsilon); 46 | assert_close(0.0, normalized_projection.y, kmEpsilon); 47 | assert_close(0.0, normalized_projection.z, kmEpsilon); 48 | } 49 | 50 | void test_vec3_project_onto_plane() { 51 | kmPlane plane; 52 | kmPlaneFill(&plane, 0, 1, 0, 0); 53 | 54 | kmVec3 v; 55 | kmVec3Fill(&v, 1.0, 1.0, 0.0); 56 | 57 | kmVec3 o; 58 | kmVec3ProjectOnToPlane(&o, &v, &plane); 59 | 60 | assert_close(o.x, 1, 0.001); 61 | assert_close(o.y, 0, 0.001); 62 | assert_close(o.z, 0, 0.001); 63 | } 64 | }; 65 | --------------------------------------------------------------------------------