forked from richard-evans/vampire
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvmath.hpp
76 lines (67 loc) · 2.85 KB
/
vmath.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
///
/// @file
/// @brief Contains the vmath header namespace for sundry math utilities in zspin.
///
/// @section License
/// Use of this code, either in source or compiled form, is subject to license from the authors.
/// Copyright \htmlonly © \endhtmlonly Richard Evans, 2009-2010. All Rights Reserved.
///
/// @section info File Information
/// @author Richard Evans, [email protected]
/// @version 1.0
/// @date 04/03/2010
/// @internal
/// Created: 04/03/2010
/// Revision: ---
///=====================================================================================
///
#include<vector>
#include <cmath>
/// @namespace ns
/// @brief vmath namespace containing sundry math functions for zspin.
///
/// @internal
///=====================================================================================
///
namespace vmath{
/// @brief Function to determine if point is within a polygon.
///
/// @section License
/// Use of this code, either in source or compiled form, is subject to license from the authors.
/// Copyright \htmlonly © \endhtmlonly Richard Evans, 2009-2010. All Rights Reserved.
///
/// @section Information
/// @author Richard Evans, [email protected]
/// @version 1.0
/// @date 04/03/2010
///
/// @param[in] x x coordinate of point to be tested
/// @param[in] y y coordinate of point to be tested
/// @param[in] *polyX array of x coordinate points for the polygon
/// @param[in] *polyY array of y coordinate points for the polygon
/// @param[in] nsides number of sides of the polygon
/// @return variable returned from the function
///
/// @internal
/// Created: 04/03/2010
/// Revision: ---
///=====================================================================================
///
extern bool point_in_polygon(double, double, double*, double*, int);
extern bool point_in_polygon2(double, double, std::vector<double>&, std::vector<double>&, int);
extern std::vector<std::vector<double> > matmul(std::vector<std::vector<double> > &, std::vector<std::vector<double> > &);
extern std::vector<double> matmul(std::vector<double> &, std::vector<std::vector<double> > &);
extern std::vector<std::vector<double> > transpose(std::vector<std::vector<double> > &);
extern std::vector<std::vector<double> > set_matrix(const unsigned int, const unsigned int, std::vector<double> &);
extern std::vector<std::vector<double> > set_matrix(const unsigned int, const unsigned int);
extern void print_matrix( std::vector<std::vector<double> >&);
extern void set_rotational_matrix(double, double, double, std::vector< std::vector<double> > &, std::vector< std::vector<double> > &, std::vector< std::vector<double> > &);
extern double sign(double);
extern int sign(int);
inline int iround( double value ){
return static_cast<int>(floor( value + 0.5 ));
}
inline int iceil( double value ){
return static_cast<int>(ceil( value ));
}
}