Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
a175aeba
Commit
a175aeba
authored
May 15, 2013
by
Peter Eastman
Browse files
Added division operator to Vec3 and RealVec
parent
65caf22b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
2 deletions
+32
-2
openmmapi/include/openmm/Vec3.h
openmmapi/include/openmm/Vec3.h
+16
-1
platforms/reference/src/SimTKUtilities/RealVec.h
platforms/reference/src/SimTKUtilities/RealVec.h
+16
-1
No files found.
openmmapi/include/openmm/Vec3.h
View file @
a175aeba
...
...
@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008 Stanford University and the Authors.
*
* Portions copyright (c) 2008
-2013
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -126,6 +126,21 @@ public:
data
[
2
]
*=
rhs
;
return
*
this
;
}
// scalar division
Vec3
operator
/
(
double
rhs
)
const
{
const
Vec3
&
lhs
=
*
this
;
double
scale
=
1.0
/
rhs
;
return
Vec3
(
lhs
[
0
]
*
scale
,
lhs
[
1
]
*
scale
,
lhs
[
2
]
*
scale
);
}
Vec3
&
operator
/=
(
double
rhs
)
{
double
scale
=
1.0
/
rhs
;
data
[
0
]
*=
scale
;
data
[
1
]
*=
scale
;
data
[
2
]
*=
scale
;
return
*
this
;
}
// dot product
double
dot
(
const
Vec3
&
rhs
)
const
{
...
...
platforms/reference/src/SimTKUtilities/RealVec.h
View file @
a175aeba
...
...
@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008-201
0
Stanford University and the Authors. *
* Portions copyright (c) 2008-201
3
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -136,6 +136,21 @@ public:
return
*
this
;
}
// scalar division
RealVec
operator
/
(
double
rhs
)
const
{
const
RealVec
&
lhs
=
*
this
;
double
scale
=
1.0
/
rhs
;
return
RealVec
(
lhs
[
0
]
*
scale
,
lhs
[
1
]
*
scale
,
lhs
[
2
]
*
scale
);
}
RealVec
&
operator
/=
(
double
rhs
)
{
double
scale
=
1.0
/
rhs
;
data
[
0
]
*=
scale
;
data
[
1
]
*=
scale
;
data
[
2
]
*=
scale
;
return
*
this
;
}
// dot product
RealOpenMM
dot
(
const
RealVec
&
rhs
)
const
{
const
RealVec
&
lhs
=
*
this
;
...
...
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