Bug 1501616 - Re-vendor rust dependencies. r=kats

Depends on D9636

Differential Revision: https://phabricator.services.mozilla.com/D9637

--HG--
extra : moz-landing-system : lando
This commit is contained in:
WR Updater Bot 2018-10-24 10:58:32 +00:00
Родитель 84f5ae4259
Коммит 3d54ef4b8e
14 изменённых файлов: 48 добавлений и 17 удалений

6
Cargo.lock сгенерированный
Просмотреть файл

@ -1865,7 +1865,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "plane-split"
version = "0.13.2"
version = "0.13.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"binary-space-partition 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2948,7 +2948,7 @@ dependencies = [
"lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
"plane-split 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)",
"plane-split 0.13.3 (registry+https://github.com/rust-lang/crates.io-index)",
"rayon 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ron 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3289,7 +3289,7 @@ dependencies = [
"checksum phf_shared 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "07e24b0ca9643bdecd0632f2b3da6b1b89bbb0030e0b992afc1113b23a7bc2f2"
"checksum pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3a8b4c6b8165cd1a1cd4b9b120978131389f64bdaf456435caa41e630edba903"
"checksum plain 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6"
"checksum plane-split 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d252db71f3d2109c4936e87d9f29f3c737e89f9ac239999d78866bdd60b9deda"
"checksum plane-split 0.13.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9b1d9a84aa3bbc2dafd06856bdb1dc333eb1d442ad8987b9d596c7344b3ed969"
"checksum podio 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e5422a1ee1bc57cc47ae717b0137314258138f38fd5f3cea083f43a9725383a0"
"checksum precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
"checksum proc-macro2 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "77997c53ae6edd6d187fec07ec41b207063b5ee6f33680e9fa86d405cdd313d4"

Просмотреть файл

@ -1 +1 @@
{"files":{".travis.yml":"b76d49f66f842c652d40825c67791352364a6b6bbb7d8d1009f2ac79eb413e66","Cargo.toml":"641e7f59b524470c415901d3db5c19035172b376a6a26afdaafab8ab79362a93","LICENSE":"b946744aeda89b467929585fe8eeb5461847695220c1b168fb375d8abd4ea3d0","README.md":"a65ed5c817c867fe23bc2029f34baea4a645a07dd5d101a0027e796d2923be58","benches/split.rs":"632a011dfc6d8235dea853785061b7bbfe0362eb85b91b3b01fbf77a7f1c7f26","src/bsp.rs":"25358cd319195ed1f23068be70aab86f057b12a6117d88be3fdf111cc8c6353c","src/clip.rs":"838cee6106d240581d1cfcba5d47b67f99a1360748ce7c56531dc4582121fc34","src/lib.rs":"a9ce93011a0b0702a1df2a342aeeb9982a3c8a819b20fefa284686ee0fa04d08","src/polygon.rs":"81f5123058fe0d7b57c45feb5bfaaf8923bd1f75efee884abc94b24b610c3a38","tests/clip.rs":"3335364fd6849697d3919084be5dce6c49acb31d8c53adc93a4cd05ee2ea93a9","tests/main.rs":"05e675a165b1e8a8b6513674591a179a74cdce6b35cd969a5895a8140149c064","tests/split.rs":"0eb1afb1f26cdecd5fffbf32d57e889f8f69254c0a57eecb8ccbbdf38efcdf27"},"package":"d252db71f3d2109c4936e87d9f29f3c737e89f9ac239999d78866bdd60b9deda"}
{"files":{".travis.yml":"b76d49f66f842c652d40825c67791352364a6b6bbb7d8d1009f2ac79eb413e66","Cargo.toml":"7b16d31dbd148b3dae6e90b30d4ea17798e13f5256647da48e96f4e678dbd4fe","LICENSE":"b946744aeda89b467929585fe8eeb5461847695220c1b168fb375d8abd4ea3d0","README.md":"a65ed5c817c867fe23bc2029f34baea4a645a07dd5d101a0027e796d2923be58","benches/split.rs":"632a011dfc6d8235dea853785061b7bbfe0362eb85b91b3b01fbf77a7f1c7f26","src/bsp.rs":"5ee2a20ce632d6c5283787f908fa3eac856ec55e4f1ed6e615cecb6fe041ed21","src/clip.rs":"838cee6106d240581d1cfcba5d47b67f99a1360748ce7c56531dc4582121fc34","src/lib.rs":"a9ce93011a0b0702a1df2a342aeeb9982a3c8a819b20fefa284686ee0fa04d08","src/polygon.rs":"31ba899f7e10082644b95fff7527b43b2786720d16fc2d4c225bc7b63ada75ee","tests/clip.rs":"3335364fd6849697d3919084be5dce6c49acb31d8c53adc93a4cd05ee2ea93a9","tests/main.rs":"86dd9b91db2a5c28451164b14ca5179f2c08598562d04ee52f578a17640b134f","tests/split.rs":"7da8d6f7cce4643ae9c5ce4917aa11aef503c4267dfaeae7b2a4b9bc813cb095"},"package":"9b1d9a84aa3bbc2dafd06856bdb1dc333eb1d442ad8987b9d596c7344b3ed969"}

0
third_party/rust/plane-split/.travis.yml поставляемый Normal file → Executable file
Просмотреть файл

2
third_party/rust/plane-split/Cargo.toml поставляемый
Просмотреть файл

@ -12,7 +12,7 @@
[package]
name = "plane-split"
version = "0.13.2"
version = "0.13.3"
authors = ["Dzmitry Malyshau <kvark@mozilla.com>"]
description = "Plane splitting"
documentation = "https://docs.rs/plane-split"

0
third_party/rust/plane-split/LICENSE поставляемый Normal file → Executable file
Просмотреть файл

0
third_party/rust/plane-split/README.md поставляемый Normal file → Executable file
Просмотреть файл

0
third_party/rust/plane-split/benches/split.rs поставляемый Normal file → Executable file
Просмотреть файл

11
third_party/rust/plane-split/src/bsp.rs поставляемый Normal file → Executable file
Просмотреть файл

@ -20,12 +20,13 @@ impl<T, U> BspPlane for Polygon<T, U> where
debug!("\tCutting anchor {} by {}", poly.anchor, self.anchor);
trace!("\t\tbase {:?}", self.plane);
let (intersection, dist) = if self.plane.normal
.dot(poly.plane.normal)
.approx_eq(&T::one())
{
debug!("\t\tNormals roughly match");
let ndot = self.plane.normal.dot(poly.plane.normal);
let (intersection, dist) = if ndot.approx_eq(&T::one()) {
debug!("\t\tNormals roughly point to the same direction");
(Intersection::Coplanar, self.plane.offset - poly.plane.offset)
} else if ndot.approx_eq(&-T::one()) {
debug!("\t\tNormals roughly point to opposite directions");
(Intersection::Coplanar, self.plane.offset + poly.plane.offset)
} else {
let is = self.intersect(&poly);
let dist = self.plane.signed_distance_sum_to(&poly);

0
third_party/rust/plane-split/src/clip.rs поставляемый Normal file → Executable file
Просмотреть файл

0
third_party/rust/plane-split/src/lib.rs поставляемый Normal file → Executable file
Просмотреть файл

2
third_party/rust/plane-split/src/polygon.rs поставляемый Normal file → Executable file
Просмотреть файл

@ -391,7 +391,7 @@ impl<T, U> Polygon<T, U> where
let denom = pb.dot(pb);
if !denom.approx_eq(&T::zero()) {
let t = pr.dot(pb) / denom;
if t > T::zero() && t < T::one() {
if t > T::approx_epsilon() && t < T::one() - T::approx_epsilon() {
*cut = Some(a + (b - a) * t);
}
}

0
third_party/rust/plane-split/tests/clip.rs поставляемый Normal file → Executable file
Просмотреть файл

6
third_party/rust/plane-split/tests/main.rs поставляемый Normal file → Executable file
Просмотреть файл

@ -72,7 +72,7 @@ fn empty() {
assert_eq!(None, poly);
}
fn test_trasnformed(rect: TypedRect<f32, ()>, transform: TypedTransform3D<f32, (), ()>) {
fn test_transformed(rect: TypedRect<f32, ()>, transform: TypedTransform3D<f32, (), ()>) {
let poly = Polygon::from_transformed_rect(rect, transform, 0).unwrap();
assert!(poly.is_valid());
@ -89,7 +89,7 @@ fn from_transformed_rect() {
let transform =
TypedTransform3D::create_rotation(0.5f32.sqrt(), 0.0, 0.5f32.sqrt(), Angle::radians(5.0))
.pre_translate(vec3(0.0, 0.0, 10.0));
test_trasnformed(rect, transform);
test_transformed(rect, transform);
}
#[test]
@ -99,7 +99,7 @@ fn from_transformed_rect_perspective() {
TypedTransform3D::create_perspective(400.0)
.pre_translate(vec3(0.0, 0.0, 100.0));
transform.m44 = 0.7; //for fun
test_trasnformed(rect, transform);
test_transformed(rect, transform);
}
#[test]

36
third_party/rust/plane-split/tests/split.rs поставляемый Normal file → Executable file
Просмотреть файл

@ -1,8 +1,10 @@
extern crate binary_space_partition;
extern crate euclid;
extern crate plane_split;
use std::f32::consts::FRAC_PI_4;
use euclid::{Angle, TypedTransform3D, TypedRect, vec3};
use binary_space_partition::{Plane as Plane_, PlaneCut};
use euclid::{Angle, TypedTransform3D, TypedRect, rect, vec3};
use plane_split::{BspSplitter, Polygon, Splitter, make_grid};
@ -26,7 +28,7 @@ fn sort_rotation(splitter: &mut Splitter<f32, ()>) {
let transform2: TypedTransform3D<f32, (), ()> =
TypedTransform3D::create_rotation(0.0, 1.0, 0.0, Angle::radians(FRAC_PI_4));
let rect: TypedRect<f32, ()> = euclid::rect(-10.0, -10.0, 20.0, 20.0);
let rect: TypedRect<f32, ()> = rect(-10.0, -10.0, 20.0, 20.0);
let p1 = Polygon::from_transformed_rect(rect, transform0, 0);
let p2 = Polygon::from_transformed_rect(rect, transform1, 1);
let p3 = Polygon::from_transformed_rect(rect, transform2, 2);
@ -46,7 +48,7 @@ fn rotation_bsp() {
fn sort_trivial(splitter: &mut Splitter<f32, ()>) {
let anchors: Vec<_> = (0usize .. 10).collect();
let rect: TypedRect<f32, ()> = euclid::rect(-10.0, -10.0, 20.0, 20.0);
let rect: TypedRect<f32, ()> = rect(-10.0, -10.0, 20.0, 20.0);
let polys: Vec<_> = anchors.iter().map(|&anchor| {
let transform: TypedTransform3D<f32, (), ()> = TypedTransform3D::create_translation(0.0, 0.0, anchor as f32);
let poly = Polygon::from_transformed_rect(rect, transform, anchor);
@ -65,3 +67,31 @@ fn sort_trivial(splitter: &mut Splitter<f32, ()>) {
fn trivial_bsp() {
sort_trivial(&mut BspSplitter::new());
}
#[test]
fn test_cut() {
let rect: TypedRect<f32, ()> = rect(-10.0, -10.0, 20.0, 20.0);
let poly = Polygon::from_rect(rect, 0);
let mut poly2 = Polygon::from_rect(rect, 0);
poly2.plane.normal.z += 0.00000001;
match poly.cut(poly2.clone()) {
PlaneCut::Sibling(p) => assert_eq!(p, poly2),
PlaneCut::Cut { .. } => panic!("wrong cut!"),
}
poly2.plane.normal *= -1.0;
match poly.cut(poly2.clone()) {
PlaneCut::Sibling(p) => assert_eq!(p, poly2),
PlaneCut::Cut { .. } => panic!("wrong cut!"),
}
poly2.plane.offset += 0.1;
match poly.cut(poly2.clone()) {
PlaneCut::Cut { ref front, ref back } => assert_eq!((front.len(), back.len()), (1, 0)),
PlaneCut::Sibling(_) => panic!("wrong sibling!"),
}
poly2.plane.normal *= -1.0;
match poly.cut(poly2.clone()) {
PlaneCut::Cut { ref front, ref back } => assert_eq!((front.len(), back.len()), (0, 1)),
PlaneCut::Sibling(_) => panic!("wrong sibling!"),
}
}