KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
g_util.h
Go to the documentation of this file.
1 /* $Id: g_util.h 18278 2014-11-25 01:42:10Z ksimek $ */
2 /* =========================================================================== *
3  |
4  | Copyright (c) 1994-2010 by Kobus Barnard (author)
5  |
6  | Personal and educational use of this code is granted, provided that this
7  | header is kept intact, and that the authorship is not misrepresented, that
8  | its use is acknowledged in publications, and relevant papers are cited.
9  |
10  | For other use contact the author (kobus AT cs DOT arizona DOT edu).
11  |
12  | Please note that the code in this file has not necessarily been adequately
13  | tested. Naturally, there is no guarantee of performance, support, or fitness
14  | for any particular task. Nonetheless, I am interested in hearing about
15  | problems that you encounter.
16  |
17  | Author: Kyle Simek
18  * =========================================================================== */
19 
20 #ifndef KJB_CPP_G_UTIL
21 #define KJB_CPP_G_UTIL
22 
23 #include <m_cpp/m_vector.h>
24 #include <m_cpp/m_matrix.h>
25 #include <m_cpp/m_vector_d.h>
26 #include <m_cpp/m_matrix_d.h>
27 
28 namespace kjb {
29 namespace geometry {
30 
37 Matrix get_translation_matrix(const Vector& v);
38 
39 
47 Matrix get_rotation_matrix(double theta);
48 
49 
59 Matrix get_rotation_matrix(const Vector& u, const Vector& v);
60 
70 template<size_t D>
71 inline
73 {
74  return Matrix_d<D, D>(
76  Vector(u.begin(), u.end()),
77  Vector(v.begin(), v.end())));
78 }
79 
93 
94 
108 
122 
123 
137 
162 
163 /*
164 polygon_to_mask()
165 
166 Takes a polygon and returns a height by width zero-1 matrix, where the 1's
167 correspond to the area covered by the polygon, and 0's are where the
168 polygon is not.
169 
170 @param
171 poly - a Nx2 Matrix of the points of a Convex Polygon, in a cyclic order.
172 height - height (rows) of mask Matrix
173 width - width (cols) of mask Matrix
174 
175 */
176 Matrix polygon_to_mask(Matrix poly,int height, int width);
177 
178 }} // namespace kjb
179 
180 #endif
181 
Definition: gr_opengl.h:41
Definition for the Matrix class, a thin wrapper on the KJB Matrix struct and its related functionalit...
theta
Definition: APPgetLargeConnectedEdges.m:108
height
Definition: APPgetLargeConnectedEdges.m:33
This class implements vectors, in the linear-algebra sense, with real-valued elements.
Definition: m_vector.h:87
Vector euclidean_to_projective_2d(const Vector &v)
Converts coordinates in (2D) euclidean space to coordinates in (2D) projective space.
Definition: g_util.cpp:135
Vector projective_to_euclidean_2d(const Vector &v)
Converts coordinates in (2D) projective space to coordinates in (2D) euclidean space.
Definition: g_util.cpp:109
REAL * point
Definition: triangle.c:537
Vector euclidean_to_projective(const Vector &v)
Converts coordinates in euclidean space to coordinates in projective space.
Definition: g_util.cpp:122
int poly
Definition: triangle.c:716
Definition: g_quaternion.h:37
bool is_point_in_polygon_new(Matrix poly, Vector point)
Definition: g_util.cpp:150
This class implements matrices, in the linear-algebra sense, with real-valued elements.
Definition: m_matrix.h:94
Matrix get_rotation_matrix(double theta)
Creates a (2D) rotation matrix from the given angle.
Definition: g_util.cpp:41
Vector projective_to_euclidean(const Vector &v)
Converts coordinates in projective space to coordinates in euclidean space.
Definition: g_util.cpp:96
Matrix get_translation_matrix(const Vector &v)
Creates a translation matrix from the given vector.
Definition: g_util.cpp:29
Matrix polygon_to_mask(Matrix poly, int height, int width)
Definition: g_util.cpp:245
Definition for the Vector class, a thin wrapper on the KJB Vector struct and its related functionalit...