| 1 | /************************************************************************* |
| 2 | * * |
| 3 | * Vega FEM Simulation Library Version 3.1 * |
| 4 | * * |
| 5 | * "macros" include files, Copyright (C) 2007 CMU, 2009 MIT, 2016 USC * |
| 6 | * All rights reserved. * |
| 7 | * * |
| 8 | * Code author: Jernej Barbic * |
| 9 | * http://www.jernejbarbic.com/code * |
| 10 | * * |
| 11 | * Research: Jernej Barbic, Fun Shing Sin, Daniel Schroeder, * |
| 12 | * Doug L. James, Jovan Popovic * |
| 13 | * * |
| 14 | * Funding: National Science Foundation, Link Foundation, * |
| 15 | * Singapore-MIT GAMBIT Game Lab, * |
| 16 | * Zumberge Research and Innovation Fund at USC * |
| 17 | * * |
| 18 | * This library is free software; you can redistribute it and/or * |
| 19 | * modify it under the terms of the BSD-style license that is * |
| 20 | * included with this library in the file LICENSE.txt * |
| 21 | * * |
| 22 | * This library is distributed in the hope that it will be useful, * |
| 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the file * |
| 25 | * LICENSE.TXT for more details. * |
| 26 | * * |
| 27 | *************************************************************************/ |
| 28 | |
| 29 | #ifndef _MACROS_H_ |
| 30 | #define _MACROS_H_ |
| 31 | |
| 32 | #ifndef PI |
| 33 | #define PI 3.141592653589793238462643 |
| 34 | #endif |
| 35 | |
| 36 | #ifndef M_PI |
| 37 | #define M_PI 3.141592653589793238462643 |
| 38 | #endif |
| 39 | |
| 40 | #define DOTPRODUCT(x1,y1,z1,x2,y2,z2)\ |
| 41 | \ |
| 42 | ((x1)*(x2) + (y1)*(y2) + (z1)*(z2)) |
| 43 | |
| 44 | #define CROSSPRODUCT(x1,y1,z1,x2,y2,z2,x,y,z)\ |
| 45 | \ |
| 46 | x = (y1) * (z2) - (y2) * (z1);\ |
| 47 | y = (x2) * (z1) - (x1) * (z2);\ |
| 48 | z = (x1) * (y2) - (x2) * (y1) |
| 49 | |
| 50 | #define CROSSPRODUCT_ADD(x1,y1,z1,x2,y2,z2,x,y,z)\ |
| 51 | \ |
| 52 | (x) += (y1) * (z2) - (y2) * (z1);\ |
| 53 | (y) += (x2) * (z1) - (x1) * (z2);\ |
| 54 | (z) += (x1) * (y2) - (x2) * (y1) |
| 55 | |
| 56 | #define XSTR11(s) STR11(s) |
| 57 | #define STR11(s) #s |
| 58 | |
| 59 | #endif |
| 60 |