-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ADD: versioning new logo working files
- Loading branch information
Showing
6 changed files
with
82 additions
and
233 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
assets/images/logos/dynamic_icon_AC/COMP_color_switcher.py
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,33 @@ | ||
#! python3 | ||
|
||
import os | ||
|
||
import Rhino | ||
import Rhino.Geometry as rg | ||
|
||
import colorsys | ||
import System | ||
|
||
|
||
def get_diff_color(est_area, gt_area): | ||
# Calculate the ratio of estimated area to ground truth area | ||
ratio = est_area / gt_area if gt_area != 0 else 1 | ||
|
||
# Clamp the ratio between 0 and 1 | ||
ratio = max(0, min(ratio, 1)) | ||
|
||
# Generate a color that transitions from green to red based on the ratio | ||
# In the HSV color model, green is at hue = 2/3 and red is at hue = 0 | ||
hue = 2 / 3 * ratio | ||
|
||
# Convert the HSV color to RGB | ||
r, g, b = colorsys.hsv_to_rgb(hue, 1, 1) | ||
g, r, b = b, g, r # Corrected order | ||
|
||
# Convert the RGB color to a System.Drawing.Color | ||
color = System.Drawing.Color.FromArgb(int(255 * r), int(255 * g), int(255 * b)) # Corrected order | ||
|
||
return color | ||
|
||
clr = get_diff_color(i_est_area, i_gt_area) | ||
o_clr = clr |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.