-
Notifications
You must be signed in to change notification settings - Fork 24
Compile error trying to use Aabb2 #138
Copy link
Copy link
Open
Description
I've copied the Aabb2 code from here: https://github.com/rustgd/collision-rs/blob/master/benches/dbvt.rs
fn aabb2(minx: f32, miny: f32, maxx: f32, maxy: f32) -> Aabb2<f32> {
Aabb2::new(Point2::new(minx, miny), Point2::new(maxx, maxy))
}
but in my project it gives me a compile error:
error[E0308]: arguments to this function are incorrect
--> src/v2/body.rs:20:5
|
20 | Aabb2::new(Point2::new(minx, miny), Point2::new(maxx, maxy))
| ^^^^^^^^^^
|
note: expected `cgmath::point::Point2<f32>`, found `Point2<f32>`
--> src/v2/body.rs:20:16
|
20 | Aabb2::new(Point2::new(minx, miny), Point2::new(maxx, maxy))
| ^^^^^^^^^^^^^^^^^^^^^^^
= note: `Point2<f32>` and `cgmath::point::Point2<f32>` have similar names, but are actually distinct types
note: `Point2<f32>` is defined in crate `cgmath`
--> /Users/fabian/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cgmath-0.18.0/src/point.rs:50:1
|
50 | pub struct Point2<S> {
| ^^^^^^^^^^^^^^^^^^^^
note: `cgmath::point::Point2<f32>` is defined in crate `cgmath`
--> /Users/fabian/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cgmath-0.17.0/src/point.rs:50:1
|
50 | pub struct Point2<S> {
| ^^^^^^^^^^^^^^^^^^^^
= note: perhaps two different versions of crate `cgmath` are being used?
note: expected `cgmath::point::Point2<f32>`, found `Point2<f32>`
--> src/v2/body.rs:20:41
|
20 | Aabb2::new(Point2::new(minx, miny), Point2::new(maxx, maxy))
| ^^^^^^^^^^^^^^^^^^^^^^^
= note: `Point2<f32>` and `cgmath::point::Point2<f32>` have similar names, but are actually distinct types
note: `Point2<f32>` is defined in crate `cgmath`
--> /Users/fabian/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cgmath-0.18.0/src/point.rs:50:1
|
50 | pub struct Point2<S> {
| ^^^^^^^^^^^^^^^^^^^^
note: `cgmath::point::Point2<f32>` is defined in crate `cgmath`
--> /Users/fabian/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cgmath-0.17.0/src/point.rs:50:1
|
50 | pub struct Point2<S> {
| ^^^^^^^^^^^^^^^^^^^^
= note: perhaps two different versions of crate `cgmath` are being used?
note: associated function defined here
--> /Users/fabian/.cargo/registry/src/index.crates.io-6f17d22bba15001f/collision-0.20.1/src/volume/aabb/aabb2.rs:26:12
|
26 | pub fn new(p1: Point2<S>, p2: Point2<S>) -> Aabb2<S> {
| ^^^
Here are the deps from my cargo.toml:
[dependencies]
rand = "0.8.5"
cgmath = "0.18.0"
collision = "0.20.1"
sdl2 = { version = "0.36.0", features = ["unsafe_textures", "gfx", "image"] }
I notice when i do a cargo build it installs cgmath 0.18.0 and 0.17.0:
% cargo build
Blocking waiting for file lock on build directory
Compiling num-traits v0.2.18
Compiling approx v0.3.2
Compiling approx v0.4.0
Compiling cgmath v0.17.0
Compiling cgmath v0.18.0
Compiling collision v0.20.1
so not sure if the problem is that or not. And I am not sure why 2 versions of cgmath is being installed.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels