0.5.0 - 2024-12-04
Changes
Added
- Implementation of
Clone
,Into<Vec<Vec<UVec2>>
traits forEdges
(662f42c) (0fdc732). translate_objects
method toEdges
for replace flagtranslate
(1bb608c).
Changed
- Upgrade dependencies: Bevy 0.15 (ac1a5a5).
- Dependency on
bevy_render
replaced withbevy_image
.
- Dependency on
- Function
multi_image_edges_raw
renamed tomulti_image_edge_raw
(1bb608c). - Now methods
image_edges
,multi_image_edge_raw
,single_image_edge_raw
returnsVec<Vec<UVec2>>
(1bb608c).
Removed
translate
flag forimage_edges
function (1bb608c).
Migration guide
Definition of edges
.
let edges = Edges::from(&image);
About Into
You can replace call Edges::multi_image_edge_raw
or
Edges::image_edges
with Into::into
with type declaration.
let objects1 = edges.image_edges();
let objects2 = edges.multi_image_edge_raw();
let objects3: Vec<Vec<UVec2>> = edges.into();
assert_eq!(objects1, objects2);
assert_eq!(objects2, objects3);
About translate
flag
If you use Edges::image_edges
like there:
let objects = edges.image_edges(true);
You must replace it with this:
// this two lines equal.
let objects1 = edges.multi_image_edge_translated();
let objects2 = edges.translate_objects(edges.image_edges());
assert_eq!(objects1, objects2);
About new type of output
If you use raw variants of edges like there:
let objects = edges.multi_image_edge_raw();
let object = edges.single_image_edge_raw();
And type of points in output you wait is Vec2
you can convert UVec2
like there:
// What these two examples have in common is the use of `UVec2::as_vec2`.
let objects: Vec<Vec<Vec2>> = edges
.multi_image_edge_raw()
.into_iter()
.map(|object| {
object.into_iter().map(|p| p.as_vec2()/* <-- */).collect()
}).collect();
let object: Vec<Vec2> = edges
.single_image_edge_raw()
.into_iter()
.map(|p| p.as_vec2()/* <-- */)
.collect();