Port POV tools to Windows

So maybe we can either have 2 versions of this.

One is the carefree option working how it was working before (with small upgrades in the files to get the height attribute in the pgmtorle Files for further use.

Second option is the “I want to setup everything manually”. even cooler would be to have an option where I can save my choices for further use.
Edit: Forgot the “or” part. Or it is one version where the first choice is asking: default settings? (Y/N)

Okay, it is done afterwards. That info is what was missing. But theoretically, would it be possible to handle the scaling beforehand?

But wouldn’t we allow faulty inputs that would maybe break the image? It looked like in @NoSloppy first tries manipulating that width the Star wars Logo vor distorted.

I think one option should be to use the makefile.
It shouldn’t have to know about drag-n-drop, finding files or making anything easy. It should just have variables with default values for everything.

The other option(s) would be shell scripts that make it easy. Once they have figured out what options to use, the just invoke make with the right variables and then everything gets done.

It still doesn’t matter, because there is a loop in pnmwindshieldwiper that adjusts the size of the picture to fit inside the wipe. (Unless you use the new option --fill, in which case it will scale to fill the whole wipe.)

Yes, and?
The problem with the earlier attempts wasn’t the width though. It was that the height and width were being rescaled, so when changing the height, the width got changed instead, but the height remained at 144.

Btw, I made lots of the pnmwindshieldwiper variables proper command-line flags:

So instead of

pnmwindshieldwiper 0 72 50 35

It is now:

pnmwindshieldwiper --height=72 --length=50 --offset=35
1 Like

Cool!
So height would be the Pixel amount and blade length, length the hilt length and offset anything else from shoulder/ellbow/wrist what the user wants to be his center point when swinging?
Or did I mix that up?

That is correct.
Right now, there is an OPTIONS variable in the Makefile where all of these flags can go. So an invoking script can do something like:

make IMAGE=foo.png OPTIONS='--height=72 --length=50 --offset=25'

That’s cool, so I could have different scripts for different hilts, where the options are already preset.

You still going for cm as unit for length and offset? I know you said it would technically be irrelevant, but in my eye as user, I will need to know, what I have to measure and input there, wouldn’t I?
I might still not have understood it completely, but I am trying to get there.

The default for length is 36 and the default for offset is 18, which kind of makes them inches by default. If you only specify one or the other, you should stick to inches. If you specify both you can parsecs if you like.

1 Like

Okay, so I tried to come up with an image that would explain it for me.

options-jawa

In this picture Rey/Daisy (170cm ~ 1.88 Jawas) wants to create a POV image by using her armpit/shoulder as the center point.
Length is obviously the Graflex hilt length (~ 1/3 Jawa)
Offset is from Armpit to beginning of the Graflex? (~ 1/2 Jawa)

In my understanding I would assume Length and Offset need to be added to each other to form the base. But this post, suggested that you divide Offset with the Length.

I know I am missing something. But I can’t put the finger on it.

Not sure how helpful that picture is, because I don’t know where the fulcrum is.
Here is how it looks in inches in my mind:

Here it is in centimeters:

Here it is in jawas:

Hint: These are the same pictures.

So, to sum it up: height and length are the same thing, just in different units.
The fraction between offset/(offset+length) determines the size of the inner circle compared to the outer circle, which is all that matters.

If offset is zero, then “length” literally doesn’t matter, because offset / (offset + length) is going to be zero regardless.

1 Like

Okay, this was what I was missing. I thought it was something different. Height = blade only, length = hilt only.
So Offset = Hilt + Arm = 0.83333 Jawas.
Fulcrum in the picture would be her armpit / shoulder.
Thanks now I got it.

options-jawa-correct

@profezzorn so pov.h gets compiled even if no &style_pov is in the config?
Playing around, removing the data file include temporarily, the compiler complained…
so it’s bothering to compile pov.h and a data file anyway?

Out of sheer curiosity, is the POV “style” (I don’t know what it’s called) just for making the blade do stuff like one of those little fans with the LEDs on them which make it look like there’s text?

Correct.
see this pic

1 Like

Yes
In general, everything in proffieOS gets compiled, and then the compiler throws away everything that isn’t used.

Does IMAGE not get overwritten in the Makefile with
IMAGE=1024px-Star_Wars_Logo.svg.png ?
Also, how does the subtarget clean get invoked?

The values on the command line take precedence over the values in the makefile.

Manually.

Well this script is cute if you play nicely. But l guess it needs to do something with erroneous user input, and that’s crampin my style. I know there’s probably a waaay better approach, but this was what i plugged along with. Kinda stuck and feel going forward incorrectly is the wrong move, so paused at this point.

#!/bin/bash

# create_POV_data_files

cd "$(dirname "$0")"
clear
echo ""
files=$(ls 2>/dev/null -Ubad1 -- *.png | wc -l)
find . -type f -name "* *" | while read file; do mv "$file" ${file// /_}; done
havelogo=0
redo=0
if [ "$files" -ge 2 ]; then
	echo "OOPS, too many .png image files found!"
	echo ""
	echo "There needs to be only ONE source .png image in the pov_tools folder."
	echo "Please fix that then press ENTER to try again"
	read -p "or type  q  to quit for now. " fix
	if [ "$fix" = "q" ]; then exit
	else
		exec "./create_POV_data_files"
	fi
fi
if [ "$files" -lt 1 ]; then
	echo "OOPS, no .png image files found!"
	echo ""
	echo "Let's download an example Star Wars Logo for you to try :)"
	echo "DOWNLOADING: 1024px-Star_Wars_Logo.svg.png .........."
	echo ""
	echo ""
	wget https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/Star_Wars_Logo.svg/1024px-Star_Wars_Logo.svg.png&>/dev/null &
	logo=$"1024px-Star_Wars_Logo.svg.png"
	havelogo=1
	read -p "Hit ENTER to process the image, or type q to exit. " delay
	if [ "$delay" = "q" ]; then exit
	fi
fi

echo ""
if [ "$havelogo" == 1 ]; then
	echo "image name: $logo"
	echo ""
	image="$logo"
elif [ $redo -lt 1 ]; then
	echo "What is the source file name? (including.png) " 
	read image
	check=$(find . -type f -name "$image" | wc -l)
	if [ "$check" -lt 1 ]; then
		echo "OOPS. That file does not exist in the pov_tools folder."
		read -p "Press ENTER to try again, or type q to quit: " redo
		if [ "$redo" = "q" ]; then exit
		else
			exec "./create_POV_data_files"
		fi
	fi
fi

read -p "What blade length in pixels? (d for default) " height
if [ "$height" = "d" ]; then
	height=144
else 
	if [[ "$height" = [""{A-Z}abc{e-z} ]]; then
	    echo "That is not a number or d."
	    echo "Press ENTER to try again"
	    read
	    exec "./create_POV_data_files"
	fi
fi

read -p "Hilt length in inches? (d for default) " length
if [ "$length" = "d" ]; then
	length=36
elif [ "$length" = "" ]; then
	echo "Please enter a value or type d for the defaults."
	echo "Press ENTER to try again"

fi

echo "Distance in inches to pivot point from hilt when swinging?"
read -p "(shoulder/elbow/wrist -> hilt) (d for default) " offset
if [ "$offset" = "d" ]; then
	offset=18
fi

make IMAGE=$image OPTIONS="--height=$height  --length=$length --offset=$offset"

Hi @NoSloppy,
good job on the script. I really like that you give time to fix things like too many images, while the code is running.

Will there be an accompanying readme file with it? I think it would be good to explain to the user, why he might want to put in his custom values, without displaying a wall of text all the time. (Because after a few times I would already know what I am doing).

I would also suggest providing the default values where you give those options (144, 36, 18).

Do you still plan on doing some restrictions on the inputs ( 30 pixels <= Height => 144 ).

I could see myself creating different create_POV_data_files (and bat-files) for different sabers to still have shortcuts and not having to input the same stuff everytime.

Or what about something like this you get something like this, after the script checked if there is the right amount of image available:

Please select the settings you want to create the POV image with:
1 - default (HEIGHT=144, LENGTH=36, OFFSET=18)
2 - custom
3 - Preset 1 (HEIGHT=72, LENGTH=50, OFFSET=15)
4 - Preset 2 (HEIGHT=97, LENGTH=63, OFFSET=50)

With Option 2 it would basically continue at

The Preset options afterwards would be customizable options, which could be fairly easily (a little knowledge for programming required) added to this if else construct.
In my case:
Option 3 is my “The Child” saber with

  • height 72pixels,
  • length of the blade is 50 (cm; go metric system!) and
  • offset is 15 (cm) because my fulcrum there is the pommel.

Option 4 is my “Dark Saber” with

  • height 97pixels in the DS-blade,
  • length 63cm outside emitter and
  • offset 50cm because there I want to swing from my elbow
if [ "$option" == 1 ]; then
	make IMAGE=$image OPTIONS="--height=144  --length=36 --offset=18"
elif [ "$option" == 3 ]; then
	make IMAGE=$image OPTIONS="--height=72 --length=50--offset=15"
elif [ "$option" == 4 ]; then
	make IMAGE=$image OPTIONS="--height=97 --length=63 --offset=50"
elif [ "$option" == 2 ]; then
	// customize code here
else
	// not a valid option try again
fi

Questions:

  • Are pixels inside the emitter neglectable?
  • Is the length supposed to be the length of the actual blade (including inside emitter) or the visible blade? Or is it even relevant?

that’s what I’M still kind of wondering haha

It’s 4 questions, not a wall of text.
-Image name
-height
-length
-offset
The image name could easily just be default - the one you have in the folder- that’s what I had but needed to adapt to the new update.

“providing” as in print them? like "What blade length in pixels? (d for default 144) "?

I think that is negligible and doesn’t matter.
What I don’t understand is that why we need to get a length value if it’s meant to be the same as height, yet 144 and 36 are !=
What if a user enters height 133 but length 50?

adding this

1 Like