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
f8e91c4f
Commit
f8e91c4f
authored
Mar 21, 2015
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made it so you can multiply 2d and 3d point transforms together.
parent
0a4fa534
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
1 deletion
+33
-1
point_transforms.h
dlib/geometry/point_transforms.h
+15
-0
point_transforms_abstract.h
dlib/geometry/point_transforms_abstract.h
+13
-1
geometry.cpp
dlib/test/geometry.cpp
+5
-0
No files found.
dlib/geometry/point_transforms.h
View file @
f8e91c4f
...
...
@@ -682,6 +682,21 @@ namespace dlib
dlib
::
vector
<
double
,
3
>
b
;
};
// ----------------------------------------------------------------------------------------
inline
point_transform_affine3d
operator
*
(
const
point_transform_affine3d
&
lhs
,
const
point_transform_affine
&
rhs
)
{
matrix
<
double
,
3
,
3
>
m
;
m
=
0
;
set_subm
(
m
,
get_rect
(
rhs
.
get_m
()))
=
rhs
.
get_m
();
vector
<
double
,
3
>
b
=
rhs
.
get_b
();
return
point_transform_affine3d
(
lhs
.
get_m
()
*
m
,
lhs
.
get_m
()
*
b
+
lhs
.
get_b
());
}
// ----------------------------------------------------------------------------------------
inline
point_transform_affine3d
operator
*
(
...
...
dlib/geometry/point_transforms_abstract.h
View file @
f8e91c4f
...
...
@@ -482,7 +482,19 @@ namespace dlib
is, for all valid x: TFORM(x) == lhs(rhs(x)).
!*/
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
point_transform_affine3d
operator
*
(
const
point_transform_affine3d
&
lhs
,
const
point_transform_affine
&
rhs
);
/*!
ensures
- returns a transformation TFORM(x) that is equivalent to lhs(rhs(x)). That
is, for all valid x: TFORM(x) == lhs(rhs(x)).
!*/
// ----------------------------------------------------------------------------------------
point_transform_affine3d
inv
(
const
point_transform_affine3d
&
trans
...
...
dlib/test/geometry.cpp
View file @
f8e91c4f
...
...
@@ -831,6 +831,11 @@ namespace
tform
=
rotate_around_x
(
pi
/
2
)
*
rotate_around_z
(
pi
/
2
)
*
translate_point
(
x
);
DLIB_TEST
(
length
(
tform
(
dlib
::
vector
<
double
>
())
-
z
)
<
1e-12
);
DLIB_TEST
(
length
(
inv
(
tform
)(
z
))
<
1e-12
);
point_transform_affine
tform2
;
tform
=
tform
*
tform2
;
// the default tform is the identity mapping so this shouldn't do anything different
DLIB_TEST
(
length
(
tform
(
dlib
::
vector
<
double
>
())
-
z
)
<
1e-12
);
DLIB_TEST
(
length
(
inv
(
tform
)(
z
))
<
1e-12
);
}
// ----------------------------------------------------------------------------------------
...
...
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