mirror of
https://github.com/lisk77/comet.git
synced 2025-10-23 21:38:50 +00:00
fix: stray println in oklcha
creation method that i forgot to remove and forgot to convert degrees to radians in a conversion :thumbs-up:
This commit is contained in:
parent
dcd2d025ba
commit
5430ee0d7e
1 changed files with 2 additions and 3 deletions
|
@ -10,7 +10,6 @@ pub struct Oklcha {
|
||||||
|
|
||||||
impl Oklcha {
|
impl Oklcha {
|
||||||
pub fn new(lightness: f32, chroma: f32, hue: f32, alpha: f32) -> Self {
|
pub fn new(lightness: f32, chroma: f32, hue: f32, alpha: f32) -> Self {
|
||||||
println!("lightness: {}, chroma: {}, hue: {}, alpha: {}", lightness, chroma, hue, alpha);
|
|
||||||
assert!((0.0..=1.0).contains(&lightness) && (0.0..=1.0).contains(&chroma) && (0.0..=360.0).contains(&hue) && (0.0..=1.0).contains(&alpha), "Ligthness needs to be in range 0..1\nChroma needs to be in range 0..1\nHue needs to be in range 0..360\nAlpha needs to be in range 0..1");
|
assert!((0.0..=1.0).contains(&lightness) && (0.0..=1.0).contains(&chroma) && (0.0..=360.0).contains(&hue) && (0.0..=1.0).contains(&alpha), "Ligthness needs to be in range 0..1\nChroma needs to be in range 0..1\nHue needs to be in range 0..360\nAlpha needs to be in range 0..1");
|
||||||
Self {
|
Self {
|
||||||
lightness,
|
lightness,
|
||||||
|
@ -49,8 +48,8 @@ impl Oklcha {
|
||||||
pub fn to_oklaba(&self) -> Oklaba {
|
pub fn to_oklaba(&self) -> Oklaba {
|
||||||
Oklaba::new(
|
Oklaba::new(
|
||||||
self.lightness(),
|
self.lightness(),
|
||||||
self.chroma() * self.hue().cos(),
|
self.chroma() * self.hue().to_radians().cos(),
|
||||||
self.chroma() * self.hue().sin(),
|
self.chroma() * self.hue().to_radians().sin(),
|
||||||
self.alpha()
|
self.alpha()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue