| 1 | /*************************************************************************** | 
|---|
| 2 | * blitz/tvcross.h      Cross product of TinyVector<N,3>'s | 
|---|
| 3 | * | 
|---|
| 4 | * $Id: tvcross.h,v 1.1.1.1 1999-11-26 16:37:05 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.1.1  1999/04/09  17:59:02  ansari | 
|---|
| 27 | * Creation module DPC/Blitz (blitz 0.4) Reza 09/04/99 | 
|---|
| 28 | * | 
|---|
| 29 | * Revision 1.1  1998/03/14 00:04:47  tveldhui | 
|---|
| 30 | * 0.2-alpha-05 | 
|---|
| 31 | * | 
|---|
| 32 | */ | 
|---|
| 33 |  | 
|---|
| 34 | #ifndef BZ_TVCROSS_H | 
|---|
| 35 | #define BZ_TVCROSS_H | 
|---|
| 36 |  | 
|---|
| 37 | #ifndef BZ_TINYVEC_H | 
|---|
| 38 | #error <blitz/tvcross.h> must be included via <blitz/tinyvec.h> | 
|---|
| 39 | #endif | 
|---|
| 40 |  | 
|---|
| 41 | BZ_NAMESPACE(blitz) | 
|---|
| 42 |  | 
|---|
| 43 | /* | 
|---|
| 44 | * cross product. | 
|---|
| 45 | * | 
|---|
| 46 | * NEEDS_WORK: - cross product of two different vector types | 
|---|
| 47 | *             - cross product involving expressions | 
|---|
| 48 | */ | 
|---|
| 49 |  | 
|---|
| 50 | template<class T_numtype> | 
|---|
| 51 | TinyVector<T_numtype,3> cross(const TinyVector<T_numtype,3>& x, | 
|---|
| 52 | const TinyVector<T_numtype,3>& y) | 
|---|
| 53 | { | 
|---|
| 54 | return TinyVector<T_numtype,3>(x[1]*y[2] - y[1]*x[2], | 
|---|
| 55 | y[0]*x[2] - x[0]*y[2], x[0]*y[1] - y[0]*x[1]); | 
|---|
| 56 | } | 
|---|
| 57 |  | 
|---|
| 58 |  | 
|---|
| 59 | BZ_NAMESPACE_END | 
|---|
| 60 |  | 
|---|
| 61 | #endif // BZ_TVCROSS_H | 
|---|