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
c8907ff5
Commit
c8907ff5
authored
Dec 08, 2014
by
Davis King
Browse files
Added a length_squared() member to vector.
parent
db78a499
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
0 deletions
+22
-0
dlib/geometry/vector.h
dlib/geometry/vector.h
+15
-0
dlib/geometry/vector_abstract.h
dlib/geometry/vector_abstract.h
+7
-0
No files found.
dlib/geometry/vector.h
View file @
c8907ff5
...
...
@@ -345,6 +345,14 @@ namespace dlib
// ---------------------------------------
double
length_squared
(
)
const
{
return
(
double
)(
x
()
*
x
()
+
y
()
*
y
()
+
z
()
*
z
());
}
// ---------------------------------------
typename
vc_rebind
<
double
,
3
>::
type
normalize
(
)
const
{
...
...
@@ -697,6 +705,13 @@ namespace dlib
// ---------------------------------------
double
length_squared
(
)
const
{
return
(
double
)(
x
()
*
x
()
+
y
()
*
y
());
}
// ---------------------------------------
typename
vc_rebind
<
double
,
2
>::
type
normalize
(
)
const
...
...
dlib/geometry/vector_abstract.h
View file @
c8907ff5
...
...
@@ -152,6 +152,13 @@ namespace dlib
- returns the length of the vector
!*/
double
length_squared
(
)
const
;
/*!
ensures
- returns length()*length()
!*/
T
&
x
(
);
/*!
...
...
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