Releases: shnewto/edges
0.5.1 - 2024-12-04
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();
0.4.0 - 2024-11-12
Changes
Added
- Reworked edges search algorithm for work with diagonal lines too
(60cb046) (c4ca604) (06012b7) (ac0c3dd) (8d38555). - Feature
glam-latest
for those who useglam
(e7ab40a). - Crate
rayon
to dependencies for parallelism (df77244). - Method
new
to takeEdges
from any data (3f5052f).
Changed
- Now
Edges
is structure (3f5052f). - Method
translate_vec
renamed totranslate
(5573751). - Dependency on
bevy
replaced withbevy_math
andbevy_render
(e7ab40a).
Fixed
Removed
Migration guide
Definition of edges
.
let edges = Edges::from(&image);
About feature glam-latest
This feature added for lightweight of usage of this crate without bevy
and support latest version of glam
.
Note
The bevy
feature disables the glam-latest
feature.
[dependencies.edges]
version = "*" # Your version
default-features = false
features = ["glam-latest"]
About Edges::new
Now, you mustn't call Edges::march_edges
.
To get edges from custom data, you can use Edges::new
.
Warning
The data size must be greater than or equal to height multiplied by width.
let data: &[u8];
let edges = Edges::new(height, width, data);
let objects = edges.multi_image_edge_translated();
About Edges
If you use match-case
on Edges
to return an image.
You should now use one of these options.
This will preserve your ownership of the image.
let data: &[u8];
let edges: Edges = Edges::new(height, width, data);
let edges: Edges = Edges::from(&image);
0.3.4 - 2024-08-13
0.3.3 - 2024-07-08
0.3.2 - 2024-05-13
0.3.1 - 2024-03-05
0.3.0 - 2024-03-04
Changes
Changed
- Methods
march_edges
,translate_vec
are provided as associated functions
(faee752).
Migration guide
Definition of edges
.
let edges = Edges::from(&image);
About march_edges
If you use Edges::march_edges
like there:
let objects = edges.march_edges(&data, rows, cols, translate);
You must replace it with this:
let objects = Edges::march_edges(&data, rows, cols, translate);
About translate_vec
You must replace call to translate_vec
like there:
let vec: Vec<Vec2> = Vec::new();
// Before:
let translate_vec = edges.translated_vec(vec, rows, cols);
// After:
let translated_vec = Edges::translate_vec(vec, rows, cols);