begone-prop / voronoi

A multithreaded Voronoi diagram generator
GNU General Public License v3.0
1 stars 0 forks source link

Feature Request: Ability to map colors onto specific anchors #1

Open ClayShoaf opened 1 year ago

ClayShoaf commented 1 year ago

Hey, I love the simplicity of this program from the user's perspective. It is working really well, (despite the malloc errors I get when I abuse it by calling it rapidly with a python script). I was just wondering if there is some way to use specific colors for specific anchors.

I must have glossed over it when I was first reading how to use it and I assumed that the anchors would be colored with their respective colors. If you have no plans on working on this project anymore, do you know if there is a dirty way that I can hack it to get what I want? I am not very versed in c so trying to figure out exactly what I need to change is a little over my head.

To clarify, rather than randomly choosing a color from the color pallet, I would like the color for anchor[i] to be color[i], if that makes sense.

begone-prop commented 10 months ago

Hey, sorry for the late reply. I have not worked on this project for quite a while as you can tell but I will look into the anchor coloring thing you've mentioned above in the following week(s). Also could you please provide a bit more information on these malloc errors you were encountering?

ClayShoaf commented 8 months ago

I'm pretty sure this was the code:

import os
import subprocess

file_name = "coords.txt"
with open(file_name, "w") as file:
    # Write the string to the file
    file.write(unique_coordinates_string)
color_file = "colors.txt"
with open(color_file, "w") as file:
    # Write the string to the file
    file.write(final_colors)

# Get the current directory of the Python script
current_directory = os.path.dirname(os.path.realpath(__file__))

# Name of the binary executable
binary_name = 'voronoi'

# List of command-line arguments to pass to the binary
arguments = [
        "--size", "1000,500", "--anchors_from", "./coords.txt",
    "--colors_from", "./colors.txt", "-o", "./out/" + str(filename[:-4]) + ".png"
]

# Combine the binary name with the current directory to get the full path
binary_path = os.path.join(current_directory, binary_name)

# Run the binary executable with arguments
subprocess.run([binary_path] + arguments)

It's been a while since I've looked at it and it was commented out at the bottom of my spaghetti-code program that I ended up using for my project.

It was also abusive to my SSD, because of how many png files I was writing to it. I have since had a little more experience with GUIs and have decided not to put un-needed wear and tear on my drives. I ended up just going with colored dots, because that would work for my purposes.

In case you're wondering, I was trying to figure out ways to visualize weather data. The end result can be seen here: https://www.youtube.com/watch?v=e0QqSu_kXSo&t=212s (linked to a few minutes in because it's very boring at the beginning). I took every daily high temperature from every weather station that NOAA has records of and plotted them based on their gps coordinates.