Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
d204408f
Commit
d204408f
authored
May 18, 2013
by
Davis King
Browse files
Added member functions to point_rotator and point_transform to allow
a user to read the state of these objects.
parent
c4942358
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
2 deletions
+49
-2
dlib/geometry/point_transforms.h
dlib/geometry/point_transforms.h
+21
-0
dlib/geometry/point_transforms_abstract.h
dlib/geometry/point_transforms_abstract.h
+26
-2
dlib/test/geometry.cpp
dlib/test/geometry.cpp
+2
-0
No files found.
dlib/geometry/point_transforms.h
View file @
d204408f
...
@@ -37,6 +37,15 @@ namespace dlib
...
@@ -37,6 +37,15 @@ namespace dlib
return
dlib
::
vector
<
double
,
2
>
(
x
,
y
);
return
dlib
::
vector
<
double
,
2
>
(
x
,
y
);
}
}
const
matrix
<
double
,
2
,
2
>
get_m
(
)
const
{
matrix
<
double
,
2
,
2
>
temp
;
temp
=
cos_angle
,
-
sin_angle
,
sin_angle
,
cos_angle
;
return
temp
;
}
private:
private:
double
sin_angle
;
double
sin_angle
;
double
cos_angle
;
double
cos_angle
;
...
@@ -68,6 +77,18 @@ namespace dlib
...
@@ -68,6 +77,18 @@ namespace dlib
return
dlib
::
vector
<
double
,
2
>
(
x
,
y
)
+
translate
;
return
dlib
::
vector
<
double
,
2
>
(
x
,
y
)
+
translate
;
}
}
const
matrix
<
double
,
2
,
2
>
get_m
(
)
const
{
matrix
<
double
,
2
,
2
>
temp
;
temp
=
cos_angle
,
-
sin_angle
,
sin_angle
,
cos_angle
;
return
temp
;
}
const
dlib
::
vector
<
double
,
2
>
get_b
(
)
const
{
return
translate
;
}
private:
private:
double
sin_angle
;
double
sin_angle
;
double
cos_angle
;
double
cos_angle
;
...
...
dlib/geometry/point_transforms_abstract.h
View file @
d204408f
...
@@ -112,8 +112,24 @@ namespace dlib
...
@@ -112,8 +112,24 @@ namespace dlib
)
const
;
)
const
;
/*!
/*!
ensures
ensures
- rotates p, then translates it and returns the result
- rotates p, then translates it and returns the result. The output
of this function is therefore equal to get_m()*p + get_b().
!*/
!*/
const
matrix
<
double
,
2
,
2
>
get_m
(
)
const
;
/*!
ensures
- returns the transformation matrix used by this object.
!*/
const
dlib
::
vector
<
double
,
2
>
get_b
(
)
const
;
/*!
ensures
- returns the offset vector used by this object.
!*/
};
};
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
@@ -145,7 +161,15 @@ namespace dlib
...
@@ -145,7 +161,15 @@ namespace dlib
)
const
;
)
const
;
/*!
/*!
ensures
ensures
- rotates p and returns the result
- rotates p and returns the result. The output of this function is
therefore equal to get_m()*p.
!*/
const
matrix
<
double
,
2
,
2
>
get_m
(
)
const
;
/*!
ensures
- returns the transformation matrix used by this object.
!*/
!*/
};
};
...
...
dlib/test/geometry.cpp
View file @
d204408f
...
@@ -294,6 +294,8 @@ namespace
...
@@ -294,6 +294,8 @@ namespace
point_rotator
rot
(
pi
/
2
);
point_rotator
rot
(
pi
/
2
);
DLIB_TEST
(
rot
(
point
(
1
,
0
))
==
point
(
0
,
1
));
DLIB_TEST
(
rot
(
point
(
1
,
0
))
==
point
(
0
,
1
));
DLIB_TEST
(
rot
(
point
(
0
,
1
))
==
point
(
-
1
,
0
));
DLIB_TEST
(
rot
(
point
(
0
,
1
))
==
point
(
-
1
,
0
));
DLIB_TEST
(
point
(
rot
.
get_m
()
*
(
dlib
::
vector
<
double
,
2
>
(
1
,
0
)))
==
point
(
0
,
1
));
DLIB_TEST
(
point
(
rot
.
get_m
()
*
(
dlib
::
vector
<
double
,
2
>
(
0
,
1
)))
==
point
(
-
1
,
0
));
}
}
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment