Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
geometry.h
Go to the documentation of this file.
1 /* *******************************************************************
2  * Rocstar Simulation Suite *
3  * Copyright@2015, Illinois Rocstar LLC. All rights reserved. *
4  * *
5  * Illinois Rocstar LLC *
6  * Champaign, IL *
7  * www.illinoisrocstar.com *
8  * sales@illinoisrocstar.com *
9  * *
10  * License: See LICENSE file in top level of distribution package or *
11  * http://opensource.org/licenses/NCSA *
12  *********************************************************************/
13 /* *******************************************************************
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
15  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *
16  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *
17  * NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR *
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
20  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
21  * USE OR OTHER DEALINGS WITH THE SOFTWARE. *
22  *********************************************************************/
23 // $Id: geometry.h,v 1.3 2008/12/06 08:45:24 mtcampbe Exp $
24 
29 #ifndef __GEOMETRY_H__
30 #define __GEOMETRY_H__
31 
32 #include "mopbasic.h"
33 #include <cmath>
34 #include <vector>
35 
37 
39 void min_max3(double a1, double a2, double a3, double &min,
40  double &max);
41 
43 void min_max4(double a1, double a2, double a3, double a4,
44  double &min, double &max);
45 
47 void min_max6(double a1, double a2, double a3, double a4,
48  double a5, double a6, double &min, double &max);
49 
51 void min_max12(double a1, double a2, double a3, double a4,
52  double a5, double a6, double a7, double a8,
53  double a9, double a10, double a11, double a12,
54  double &min, double &max);
55 
57 double angle(Vector_3<double> v1,
58  Vector_3<double> v2);
59 
62 
64 inline double dotP(const Vector_3<double> & v1,
65  const Vector_3<double> & v2){
66  return (v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2]);
67 }
68 
70 inline void crossP(const Vector_3<double> & v1,
71  const Vector_3<double> & v2,
72  Vector_3<double> & v3){
73  v3[0]= (v1[1]*v2[2]-v2[1]*v1[2]); v3[1]= (v2[0]*v1[2]-v1[0]*v2[2]);
74  v3[2]= (v1[0]*v2[1]-v2[0]*v1[1]);
75 }
76 
78 void unit_normal(const Vector_3<double> & v1,
79  const Vector_3<double> & v2,
80  Vector_3<double> & v3);
81 
83 double edge_length(const Vector_3<double> & v);
84 
86 double tri_area(const Vector_3<double> & v1,
87  const Vector_3<double> & v2,
88  const Vector_3<double> & v3);
89 
90 
92 double tet_vol(const Vector_3<double> & a,
93  const Vector_3<double> & b,
94  const Vector_3<double> & c);
95 
97 void printv(const Vector_3<double> & v);
98 
100 
101 #endif
102 
103 
104 
105 
106 
107 
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:354
void min_max4(double a1, double a2, double a3, double a4, double &min, double &max)
Find minimum and maximum of 4 numbers.
Definition: geometry.C:41
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed free of to any person **obtaining a copy of this software and associated documentation to deal with the Software without including without limitation the rights to and or **sell copies of the and to permit persons to whom the **Software is furnished to do subject to the following this list of conditions and the following disclaimers ****Redistributions in binary form must reproduce the above **copyright this list of conditions and the following **disclaimers in the documentation and or other materials **provided with the distribution ****Neither the names of the Center for Simulation of Advanced the University of nor the names of its **contributors may be used to endorse or promote products derived **from this Software without specific prior written permission ****THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE v
Definition: roccomf90.h:20
double f_angle(Vector_3< double > v1, Vector_3< double >v2)
Compute the angle between two faces.
Definition: geometry.C:72
MOP_BEGIN_NAMESPACE void min_max3(double a1, double a2, double a3, double &min, double &max)
Find minimum and maximum of 3 numbers.
Definition: geometry.C:36
double angle(Vector_3< double > v1, Vector_3< double > v2)
Compute the angle between two vectors.
Definition: geometry.C:61
void printv(const Vector_3< double > &v)
Print a vector.
Definition: geometry.C:76
#define MOP_END_NAMESPACE
Definition: mopbasic.h:29
void crossP(const Vector_3< double > &v1, const Vector_3< double > &v2, Vector_3< double > &v3)
Compute the cross Product of two vectors.
Definition: geometry.h:70
double dotP(const Vector_3< double > &v1, const Vector_3< double > &v2)
Compute the dot Product of two vectors.
Definition: geometry.h:64
Vector_n min(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:346
double tet_vol(const Vector_3< double > &a, const Vector_3< double > &b, const Vector_3< double > &c)
Compute the volume of a tetrahedron given three edges from a point as vectors.
Definition: geometry.C:103
double tri_area(const Vector_3< double > &v1, const Vector_3< double > &v2, const Vector_3< double > &v3)
Compute the area of a triangle defined by its three sides as vectors.
Definition: geometry.C:93
#define MOP_BEGIN_NAMESPACE
Definition: mopbasic.h:28
void min_max12(double a1, double a2, double a3, double a4, double a5, double a6, double a7, double a8, double a9, double a10, double a11, double a12, double &min, double &max)
Find minimum and maximum of 12 numbers.
Definition: geometry.C:53
void unit_normal(const Vector_3< double > &v1, const Vector_3< double > &v2, Vector_3< double > &v3)
Compute the unit vector normal to two input vectors.
Definition: geometry.C:80
double edge_length(const Vector_3< double > &v)
Compute the edge length of a vector.
Definition: geometry.C:89
void min_max6(double a1, double a2, double a3, double a4, double a5, double a6, double &min, double &max)
Find minimum and maximum of 6 numbers.
Definition: geometry.C:46