diff options
author | Boris Chiou <boris.chiou@gmail.com> | 2017-03-18 19:47:04 +0800 |
---|---|---|
committer | Boris Chiou <boris.chiou@gmail.com> | 2017-04-21 11:37:57 +0800 |
commit | 57f87007f22e77bc857261f7be56fb359fd03837 (patch) | |
tree | 662539e0751339c158892ce4045b27c837b72c40 /python/servo/package_commands.py | |
parent | 17dc598d995c71748024cac432b76189722d10ea (diff) | |
download | servo-57f87007f22e77bc857261f7be56fb359fd03837.tar.gz servo-57f87007f22e77bc857261f7be56fb359fd03837.zip |
Bug 1332633 - Part 1: Implement ComputeDistance trait.
Introduce ComputeDistance trait, which implement compute_distance and
compute_squared_distance.
For vector, compute_squared_distance is necessary because we use Euclidean
distance as the distance between two values. The easier way to implement
compute_squared_distance is to square the result from compute_distance, but
for some property values, they may have many components, e.g. (v1, v2, v3).
If we just square the result from compute_distance, the computation is
(sqrt(v1^2 + v2^2 + v3^2))^2. There are two redundant operators:
"square-root" and then "square". In order to avoid this, we should
implement compute_squared_distance separately for these types.
MozReview-Commit-ID: LmmrUXYlDb6
Diffstat (limited to 'python/servo/package_commands.py')
0 files changed, 0 insertions, 0 deletions