|
Post by Txus on Mar 25, 2019 4:29:46 GMT
Hi, I'm implementing cones, and I can't seem to figure out why the ray strikes cone (normal and parallel) tests fail. My intersect function is here: github.com/txus/rye/blob/master/src/shapes.rs#L509-L553My test output shows the tests are failing this way: ---- shapes::tests::cone::ray_strikes_cone stdout ---- thread 'shapes::tests::cone::ray_strikes_cone' panicked at 'assertion failed: `(left == right)` left: `[]`, right: `[8.66025, 8.66025]`', src/shapes.rs:1026:17 note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
---- shapes::tests::cone::ray_strikes_cone_parallel_to_one_of_its_halves stdout ---- thread 'shapes::tests::cone::ray_strikes_cone_parallel_to_one_of_its_halves' panicked at 'assertion failed: `(left == right)` left: `[0.70710677]`, right: `[0.35355]`', src/shapes.rs:1037:13 I've tried to look at other people's implementations, but still can't figure it out
|
|
|
Post by Txus on Mar 25, 2019 12:19:48 GMT
|
|
|
Post by Txus on Mar 26, 2019 14:18:26 GMT
On one hand it was an extra multiplication that I had! And a floating point precision issue in the other. Solved now:)
|
|
|
Post by hokiecsgrad on Mar 26, 2019 15:04:51 GMT
Glad you figured it out. I took a look at the code. I've never worked with Rust before. That syntax is not immediately clear. =)
|
|