| [221] | 1 | /*************************************************************************** | 
|---|
|  | 2 | * blitz/tvcross.h      Cross product of TinyVector<N,3>'s | 
|---|
|  | 3 | * | 
|---|
|  | 4 | * $Id: tvcross.h,v 1.1.1.1 1999-04-09 17:59:02 ansari Exp $ | 
|---|
|  | 5 | * | 
|---|
|  | 6 | * Copyright (C) 1997,1998 Todd Veldhuizen <tveldhui@seurat.uwaterloo.ca> | 
|---|
|  | 7 | * | 
|---|
|  | 8 | * This program is free software; you can redistribute it and/or | 
|---|
|  | 9 | * modify it under the terms of the GNU General Public License | 
|---|
|  | 10 | * as published by the Free Software Foundation; either version 2 | 
|---|
|  | 11 | * of the License, or (at your option) any later version. | 
|---|
|  | 12 | * | 
|---|
|  | 13 | * This program is distributed in the hope that it will be useful, | 
|---|
|  | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
|  | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
|  | 16 | * GNU General Public License for more details. | 
|---|
|  | 17 | * | 
|---|
|  | 18 | * Suggestions:          blitz-suggest@cybervision.com | 
|---|
|  | 19 | * Bugs:                 blitz-bugs@cybervision.com | 
|---|
|  | 20 | * | 
|---|
|  | 21 | * For more information, please see the Blitz++ Home Page: | 
|---|
|  | 22 | *    http://seurat.uwaterloo.ca/blitz/ | 
|---|
|  | 23 | * | 
|---|
|  | 24 | *************************************************************************** | 
|---|
|  | 25 | * $Log: not supported by cvs2svn $ | 
|---|
|  | 26 | * Revision 1.1  1998/03/14 00:04:47  tveldhui | 
|---|
|  | 27 | * 0.2-alpha-05 | 
|---|
|  | 28 | * | 
|---|
|  | 29 | */ | 
|---|
|  | 30 |  | 
|---|
|  | 31 | #ifndef BZ_TVCROSS_H | 
|---|
|  | 32 | #define BZ_TVCROSS_H | 
|---|
|  | 33 |  | 
|---|
|  | 34 | #ifndef BZ_TINYVEC_H | 
|---|
|  | 35 | #error <blitz/tvcross.h> must be included via <blitz/tinyvec.h> | 
|---|
|  | 36 | #endif | 
|---|
|  | 37 |  | 
|---|
|  | 38 | BZ_NAMESPACE(blitz) | 
|---|
|  | 39 |  | 
|---|
|  | 40 | /* | 
|---|
|  | 41 | * cross product. | 
|---|
|  | 42 | * | 
|---|
|  | 43 | * NEEDS_WORK: - cross product of two different vector types | 
|---|
|  | 44 | *             - cross product involving expressions | 
|---|
|  | 45 | */ | 
|---|
|  | 46 |  | 
|---|
|  | 47 | template<class T_numtype> | 
|---|
|  | 48 | TinyVector<T_numtype,3> cross(const TinyVector<T_numtype,3>& x, | 
|---|
|  | 49 | const TinyVector<T_numtype,3>& y) | 
|---|
|  | 50 | { | 
|---|
|  | 51 | return TinyVector<T_numtype,3>(x[1]*y[2] - y[1]*x[2], | 
|---|
|  | 52 | y[0]*x[2] - x[0]*y[2], x[0]*y[1] - y[0]*x[1]); | 
|---|
|  | 53 | } | 
|---|
|  | 54 |  | 
|---|
|  | 55 |  | 
|---|
|  | 56 | BZ_NAMESPACE_END | 
|---|
|  | 57 |  | 
|---|
|  | 58 | #endif // BZ_TVCROSS_H | 
|---|