Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
d204408f
Commit
d204408f
authored
May 18, 2013
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added member functions to point_rotator and point_transform to allow
a user to read the state of these objects.
parent
c4942358
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
2 deletions
+49
-2
point_transforms.h
dlib/geometry/point_transforms.h
+21
-0
point_transforms_abstract.h
dlib/geometry/point_transforms_abstract.h
+26
-2
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