source: Sophya/trunk/SophyaExt/Blitz/blitz/tvcross.h@ 2013

Last change on this file since 2013 was 221, checked in by ansari, 26 years ago

Creation module DPC/Blitz (blitz 0.4) Reza 09/04/99

File size: 1.7 KB
RevLine 
[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
38BZ_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
47template<class T_numtype>
48TinyVector<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
56BZ_NAMESPACE_END
57
58#endif // BZ_TVCROSS_H
Note: See TracBrowser for help on using the repository browser.