00001 /* -*- Mode: CC; indent-tabs-mode: nil; c-basic-offset: 5 -*- */ 00002 00016 /* 00017 -----BEGIN PGP SIGNED MESSAGE----- 00018 Hash: SHA1 00019 00020 Created by Daniel Aarno on Tue Nov 25 2003. 00021 Copyright (c) 2004 by Daniel Aarno - <macbishop@users.sf.net> 00022 M. Sc. in Electrical Engineering - http://www.e.kth.se/~e98_aar 00023 00024 All Rights Reserved 00025 ATTRIBUTION ASSURANCE LICENSE (adapted from the original BSD license) 00026 Redistribution and use in source and binary forms, with or without 00027 modification, are permitted provided that the conditions below are met. 00028 These conditions require a modest attribution to (the 00029 "Author"), who hopes that its promotional value may help justify the 00030 thousands of dollars in otherwise billable time invested in writing 00031 this and other freely available, open-source software. 00032 00033 1. Redistributions of source code, in whole or part and with or without 00034 modification (the "Code"), must prominently display this GPG-signed 00035 text in verifiable form. 00036 2. Redistributions of the Code in binary form must be accompanied by 00037 this GPG-signed text in any documentation and, each time the resulting 00038 executable program or a program dependent thereon is launched, a 00039 prominent display (e.g., splash screen or banner text) of the Author's 00040 attribution information, which includes: 00041 (a) Name ("Daniel Aarno"), 00042 (b) Professional identification ("M. Sc. in Electrical Engineering"), and 00043 (c) URL ("http://www.e.kth.se/~e98_aar"). 00044 3. Neither the name nor any trademark of the Author may be used to 00045 endorse or promote products derived from this software without specific 00046 prior written permission. 00047 4. Users are entirely responsible, to the exclusion of the Author and 00048 any other persons, for compliance with (1) regulations set by owners or 00049 administrators of employed equipment, (2) licensing terms of any other 00050 software, and (3) local regulations regarding use, including those 00051 regarding import, export, and use of encryption software. 00052 00053 THIS FREE SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND 00054 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00055 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 00056 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 00057 EVENT SHALL THE AUTHOR OR ANY CONTRIBUTOR BE LIABLE FOR 00058 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00059 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00060 EFFECTS OF UNAUTHORIZED OR MALICIOUS NETWORK ACCESS; 00061 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00062 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 00063 AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00064 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00065 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 00066 IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00067 -----BEGIN PGP SIGNATURE----- 00068 Version: GnuPG v1.2.4 (GNU/Linux) 00069 00070 iD8DBQFB+7jgi6ECThHTSIkRAuJFAKCXjyB/7HxUEKqvIXry38bquCySZQCfUNbk 00071 XEaqordUUTUdgKj87lhewM8= 00072 =tkIO 00073 -----END PGP SIGNATURE----- 00074 */ 00075 00076 #ifndef _V_VECTOR_ 00077 #define _V_VECTOR_ 00078 00080 typedef float f3[3]; 00082 typedef double d3[3]; 00083 00084 #ifndef VVECTOR_ENABLE_INLINE 00085 00086 #ifdef __cplusplus 00087 extern "C" { 00088 #endif 00089 //BASIC FUNCTIONS 00090 00091 //Float versions 00092 00094 void VScalarMultiplyf(f3 dest, float scalar, const f3 v); 00096 void VPlusf(f3 dest, const f3 v1, const f3 v2); 00098 void VMinusf(f3 dest, const f3 v1, const f3 v2); 00100 void VCopyf(f3 dest, const f3 src); 00101 00103 float VDotf(const f3 v1, const f3 v2); 00106 void VCrossf(f3 dest, const f3 v1, const f3 v2); 00109 void VProjf(f3 dest, const f3 of, const f3 to); 00112 void VPerpf(f3 dest, const f3 of, const f3 to); 00114 void VRotZf(f3 dest, const f3 v, float angle); 00116 void VRotXf(f3 dest, const f3 v, float angle); 00118 void VRotYf(f3 dest, const f3 v, float angle); 00121 void VRotNf(f3 dest, const f3 v, const f3 n, float angle); 00122 00124 void VNormalizef(f3 v); 00126 float VLengthf(const f3 v); 00127 00128 //Double versions 00129 00131 void VScalarMultiplyd(d3 dest, double scalar, const d3 v); 00133 void VPlusd(d3 dest, const d3 v1, const d3 v2); 00135 void VMinusd(d3 dest, const d3 v1, const d3 v2); 00137 void VCopyd(d3 dest, const d3 src); 00138 00140 double VDotd(const d3 v1, const d3 v2); 00143 void VCrossd(d3 dest, const d3 v1, const d3 v2); 00146 void VProjd(d3 dest, const d3 of, const d3 to); 00149 void VPerpd(d3 dest, const d3 of, const d3 to); 00151 void VRotZd(d3 dest, const d3 v, double angle); 00153 void VRotXd(d3 dest, const d3 v, double angle); 00155 void VRotYd(d3 dest, const d3 v, double angle); 00158 void VRotNd(d3 dest, const d3 v, const d3 n, double angle); 00160 void VNormalized(d3 v); 00162 double VLengthd(const d3 v); 00163 00164 #ifdef __cplusplus 00165 } 00166 #endif 00167 00168 #else // VVECTOR_ENABLE_INLINE 00169 00170 #ifndef VVECTOR_NO_C_INCLUDE 00171 #include "vvector.c" 00172 #endif 00173 00174 #endif //VVECTOR_ENABLE_INLINE 00175 00176 #endif //_V_VECTOR_
1.4.7