-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from shnewto/dev
Migration to binary_image crate and algorithm fix
- Loading branch information
Showing
14 changed files
with
655 additions
and
669 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
def display(dir: int) -> str: | ||
def display(expr) -> str: | ||
return "1" if expr else "_" | ||
|
||
return ( | ||
f"{display(dir & 1)}{display(dir & 64)}{display(dir & 2)}\n" | ||
f"{display(dir & 16)}1{display(dir & 32)}\n" | ||
f"{display(dir & 4)}{display(dir & 128)}{display(dir & 8)}" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
use crate::Edges; | ||
|
||
use bevy_image::prelude::Image as BevyImage; | ||
use binary_image::BinaryImage; | ||
|
||
impl TryFrom<BevyImage> for Edges<BinaryImage> { | ||
type Error = binary_image::bevy::IntoBinaryImageError; | ||
fn try_from(image: BevyImage) -> Result<Edges<BinaryImage>, Self::Error> { | ||
Ok(Self(BinaryImage::try_from(image)?)) | ||
} | ||
} | ||
|
||
impl TryFrom<&BevyImage> for Edges<BinaryImage> { | ||
type Error = binary_image::bevy::IntoBinaryImageError; | ||
fn try_from(image: &BevyImage) -> Result<Edges<BinaryImage>, Self::Error> { | ||
Ok(Edges(BinaryImage::try_from(image)?)) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.