37 min = ( a1 < a2 )? a1 : a2; max = ( a1 > a2 )? a1 : a2;
38 min = ( min < a3 ) ? min : a3; max = ( max > a3 ) ? max : a3;
41 void min_max4(
double a1,
double a2,
double a3,
double a4,
double &
min,
double &
max){
43 min = (min < a4)? min : a4; max = (max > a4)? max : a4;
46 void min_max6(
double a1,
double a2,
double a3,
double a4,
47 double a5,
double a6,
double &
min,
double &
max){
50 min = (min < min2)? min : min2; max = (max > max2)? max : max2;
53 void min_max12(
double a1,
double a2,
double a3,
double a4,
54 double a5,
double a6,
double a7,
double a8,
55 double a9,
double a10,
double a11,
double a12,
double &
min,
double &
max){
57 min_max6(a1,a2,a3,a4,a5,a6,min,max);
min_max6(a7,a8,a9,a10,a11,a12,min2,max2);
58 min = (min < min2)? min : min2; max = (max > max2)? max : max2;
64 dot_product =
dotP(v1,v2);
66 angle =
acos(dot_product/(norm1*norm2));
67 assert(dot_product/(norm1*norm2) <=1 && dot_product/(norm1*norm2)>= -1);
68 angle *= (double)180; angle = angle/M_PI;
73 return double(180) -
angle(v1,v2);
77 cout << v[0] <<
" " << v[1] <<
" " << v[2] << endl;
84 double normalizer =
sqrt(
dotP (v3,v3) );
85 if (normalizer == 0)
return;
86 v3[0] = v3[0]/normalizer; v3[1] = v3[1]/normalizer; v3[2] = v3[2]/normalizer;
90 return sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
99 double s = .5 * (a+b+c);
100 return sqrt( s * (s-a) * (s-b) * (s-c) );
108 return (1/(
double)6) *
abs (
dotP(a,temp) ) ;
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
void min_max4(double a1, double a2, double a3, double a4, double &min, double &max)
Find minimum and maximum of 4 numbers.
*********************************************************************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
T norm2(const NVec< DIM, T > &v)
double f_angle(Vector_3< double > v1, Vector_3< double >v2)
Compute the angle between two faces.
MOP_BEGIN_NAMESPACE void min_max3(double a1, double a2, double a3, double &min, double &max)
Find minimum and maximum of 3 numbers.
double angle(Vector_3< double > v1, Vector_3< double > v2)
Compute the angle between two vectors.
void printv(const Vector_3< double > &v)
Print a vector.
#define MOP_END_NAMESPACE
void crossP(const Vector_3< double > &v1, const Vector_3< double > &v2, Vector_3< double > &v3)
Compute the cross Product of two vectors.
double dotP(const Vector_3< double > &v1, const Vector_3< double > &v2)
Compute the dot Product of two vectors.
Vector_n min(const Array_n_const &v1, const Array_n_const &v2)
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.
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.
#define MOP_BEGIN_NAMESPACE
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.
CImg< _cimg_Tfloat > acos(const CImg< T > &instance)
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.
double edge_length(const Vector_3< double > &v)
Compute the edge length of a vector.
Geometric helper function header file.
long double dot_product(pnt vec1, pnt vec2)
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.