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
f8e91c4f
Commit
f8e91c4f
authored
Mar 21, 2015
by
Davis King
Browse files
Made it so you can multiply 2d and 3d point transforms together.
parent
0a4fa534
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
1 deletion
+33
-1
dlib/geometry/point_transforms.h
dlib/geometry/point_transforms.h
+15
-0
dlib/geometry/point_transforms_abstract.h
dlib/geometry/point_transforms_abstract.h
+13
-1
dlib/test/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