Onscreen protractor / anglefinder

For discussions about programming, and for programming questions and advice


Moderator: Forum moderators

User avatar
greengeek
Posts: 1384
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 535 times
Been thanked: 192 times

Onscreen protractor / anglefinder

Post by greengeek »

"Programming" may be the wrong section for this but i suspect a bit of special coding may be needed so here goes:

I needed to measure the proposed pitch angle of a new re-roof in a photograph of a house and did not know of a utility to achieve this. The homeowner had drawn a line representing the new roof line and I had to find a way of lining up a protractor to read the angle formed by the line which represented the new roof. (Flat roof being converted to pitched gable)

I know of MochiMoppel's onscreen ruler which is brilliant but that ruler sits at either 0 degrees or 90 degrees so cannot be rotated to match the angle within the image.

I thought maybe I could rotate the image to get the roof angle lined up with Mochi's ruler - take length measurements - and apply Pythagoras theorem to work out the angle. But then I realised that Pythagoras requires a right angled triangle.

From vague distant memories I seem to remember that angles other than 90 degrees would require sine, cosine and tangent calculations in order to convert ruler measurements into an actual measurement of angle.

So in order to avoid reliving my high school trigonometry classes I settled on using an online screen protractor at this address:
https://www.ginifab.com/feeds/angle_measurement/

I used MtPaint to "free rotate" the image till one angle was horizontal then read the angle of the other side of the proposed roofline from the protractor. Good enough for my basic re-roof calculations.

But could there be a puppy tool that would allow this?

Maybe a transparent gif image of a circular protractor that could be rotated over an image or screenshot?

Or is there maybe a vector grapphics program that might have a built in protractor?

Any ideas?
.

OnscreenProtractor.jpg
OnscreenProtractor.jpg (73.27 KiB) Viewed 2561 times
Last edited by greengeek on Sun Nov 29, 2020 5:16 am, edited 1 time in total.
wjaguar
Posts: 6
Joined: Fri Nov 13, 2020 9:28 pm
Contact:

Re: Onscreen protractor

Post by wjaguar »

greengeek wrote: Fri Nov 27, 2020 8:13 am

Any ideas?

Use mtPaint? ;)
http://mtpaint.sourceforge.net/handbook ... .html#SEC3

User avatar
puppy_apprentice
Posts: 692
Joined: Tue Oct 06, 2020 8:43 pm
Location: land of bigos and schabowy ;)
Has thanked: 5 times
Been thanked: 115 times

Re: Onscreen protractor

Post by puppy_apprentice »

Any CAD program should be good enough. You have to use your photo as background and draw proper lines and use measure tools in CAD program to find angle between lines.

step
Posts: 546
Joined: Thu Aug 13, 2020 9:55 am
Has thanked: 57 times
Been thanked: 198 times
Contact:

Re: Onscreen protractor

Post by step »

There's qprotractor for Qt5 (and Qt4). The author's site seems to be broken but web archive still has a copy. I also found the source for Qt5 on GitHub. I compiled a txz package and uploaded it to the Fatdog64 repo. It will take a few hours before the package shows up in the file listing.

direct link to package for Fatdog64-811
source on github
author's page (archived)

This is what it looks like. Right-click the ring for a menu.

qprotractor.png
qprotractor.png (101.37 KiB) Viewed 2490 times
User avatar
rockedge
Site Admin
Posts: 6556
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 2760 times
Been thanked: 2640 times
Contact:

Re: Onscreen protractor

Post by rockedge »

@step

Nice! works great on Bionic64.
Thanks for the tip

User avatar
MochiMoppel
Posts: 1240
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 21 times
Been thanked: 440 times

Re: Onscreen protractor

Post by MochiMoppel »

greengeek wrote: Fri Nov 27, 2020 8:13 am

I thought maybe I could rotate the image to get the roof angle lined up with Mochi's ruler - take length measurements - and apply Pythagoras theorem to work out the angle. But then I realised that Pythagoras requires a right angled triangle.

Would Pythagoras help with angles at all? I thought his fascination was with lengths.

I'm not sure if I fully understand what you are trying to do, but to give you and me a good excuse for using the Programming forum I stitched together a quick and dirty script that measures angles. Requires getcurpos, bc and the usual suspects. Should all be included in every Puppy.

Depending on the baseline the script requires to click on 2 or 3 positions in an image to determine the angle of an object. For the click sequence see the screenshot. I hope this makes sense.

Code: Select all

#!/bin/bash
Xdialog --title="Measure angle of an object" --help="For images with straight baseline:\nClick on 1) baseline,  2) endpoint of angle\n\nFor images with tilted baseline:\nClick on 1) startpoint of baseline, 2) endpoint of baseline, 3) endpoint of angle" -y "This image has a straight baseline?\n(if baseline is tilted click \"No\")" x
RET=$?
((RET>1)) && exit
((RET==1))&& TILTED=1
CURS=($(xwininfo > /dev/null; getcurpos))		# position of 1st mouse click
x1=${CURS[0]}
y1=${CURS[1]}
CURS=($(xwininfo > /dev/null; getcurpos))		# position of 2nd mouse click
x2=${CURS[0]}
y2=${CURS[1]} #measured from top
DELTAX1=$((x2-x1))
DELTAY1=$((y1-y2))
if ((TILTED)) ;then
	CURS=($(xwininfo > /dev/null; getcurpos))	# position of 3rd mouse click
	x3=${CURS[0]}
	y3=${CURS[1]}
	DELTAX2=$((x3-x1))
	DELTAY2=$((y1-y3))
fi
DEGREE=$(echo "( a($DELTAY1/$DELTAX1)*(180/3.14159) )" | bc -l) #radians to degree conversion
((TILTED)) && DEGREE=$(echo "( a($DELTAY2/$DELTAX2)*(180/3.14159) - $DEGREE )" | bc -l)
RESULT=$(printf %.0f $DEGREE) # rounded to integer
((RESULT<0)) && RESULT=$((180+RESULT))
Xdialog -info "Angle: $RESULT°" x 8000
pisapisa.jpg
pisapisa.jpg (84.09 KiB) Viewed 2440 times
Last edited by MochiMoppel on Sun Nov 29, 2020 1:06 am, edited 1 time in total.
User avatar
Trapster
Posts: 184
Joined: Sat Aug 01, 2020 7:44 pm
Has thanked: 1 time
Been thanked: 55 times

Re: Onscreen protractor

Post by Trapster »

Code: Select all

#!/bin/bash
Xdialog --title="Measure angle of an object" --help="For images with straight baseline:\nClick on ⓵ baseline,  ⓶ endpoint of angle\n\nFor images with tilted baseline:\nClick on ⓵ startpoint of baseline, ⓶ endpoint of baseline, ⓷ endpoint of angle" -y "This image has a straight baseline?\n(if baseline is tilted click \"No\")" x
RET=$?
((RET>1)) && exit
((RET==1))&& TILTED=1
CURS=($(xwininfo > /dev/null; getcurpos))		# position of 1st mouse click
x1=${CURS[0]}
y1=${CURS[1]}
CURS=($(xwininfo > /dev/null; getcurpos))		# position of 2nd mouse click
x2=${CURS[0]}
y2=${CURS[1]} #measured from top
DELTAX1=$((x2-x1))
DELTAY1=$((y1-y2))
if ((TILTED)) ;then
	CURS=($(xwininfo > /dev/null; getcurpos))	# position of 3rd mouse click
	x3=${CURS[0]}
	y3=${CURS[1]}
	DELTAX2=$((x3-x1))
	DELTAY2=$((y1-y3))
fi
DEGREE=$(echo "( a($DELTAY1/$DELTAX1)*(180/3.14159) )" | bc -l) #radians to degree conversion
((TILTED)) && DEGREE=$(echo "( a($DELTAY2/$DELTAX2)*(180/3.14159) - $DEGREE )" | bc -l)
RESULT=$(printf %.0f $DEGREE) # rounded to integer
((RESULT<0)) && RESULT=$((180+RESULT))
Xdialog -info "Angle: $RESULT°" x 8000

Holy Moses!
This is awesome!

some1
Posts: 86
Joined: Wed Aug 19, 2020 4:32 am
Has thanked: 18 times
Been thanked: 15 times

Re: Onscreen protractor

Post by some1 »

@MM: I need to quote the printf format.

Nice!!

User avatar
greengeek
Posts: 1384
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 535 times
Been thanked: 192 times

Re: Onscreen protractor

Post by greengeek »

wjaguar wrote: Fri Nov 27, 2020 4:36 pm

Use mtPaint? ;)
http://mtpaint.sourceforge.net/handbook ... .html#SEC3

Thanks wjaguar . I had no idea mtPaint had an angle parameter visible so that is really useful thanks.

Sorry for the delay in responding - I have been doing a bit of testing to try and understand why I am seeing varying values using this method.

For some reason the displayed angle jumps around considerably at times and I can't figure out why.

In this picture the angle is displayed as -80degrees (minus value as it is a "downslope"):
.

Plan02_RHS_minus80deg.jpg
Plan02_RHS_minus80deg.jpg (39.04 KiB) Viewed 2399 times

.
But in this picture the angle displayed is 99degrees.
.

Plan02_RHS_99deg.jpg
Plan02_RHS_99deg.jpg (39.64 KiB) Viewed 2399 times

.
The only difference is that between images I clicked on the top left vertex of the rectangle - i did not think i moved it but even if i did i cannot have moved it much - although i guess clicking the mouse button did change "focus".

I just can't see why the change occurs.

I am using Tahrpup 32 which has mtPaint 3.49.12

EDIT : I think my problem is that i am misunderstanding which vertex is the reference point. That tutorial mentioned "(bottom left to top right)" for the example image in the tutorial but I can't see how to apply that to my example where the slope is opposite to that shown in the tutorial.
.

Tute_image.jpg
Tute_image.jpg (41.77 KiB) Viewed 2368 times
User avatar
MochiMoppel
Posts: 1240
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 21 times
Been thanked: 440 times

Re: Onscreen protractor

Post by MochiMoppel »

some1 wrote:

@MM: I need to quote the printf format.

@some1 Which part? Works here - and IMO should work - without quotes.

I edited the Help message though. Seems that Fossapup64's installed fonts do not support Unicode "Double Circled Digit" characters.

User avatar
greengeek
Posts: 1384
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 535 times
Been thanked: 192 times

Re: Onscreen protractor

Post by greengeek »

puppy_apprentice wrote: Fri Nov 27, 2020 7:07 pm

Any CAD program should be good enough. You have to use your photo as background and draw proper lines and use measure tools in CAD program to find angle between lines.

Thanks for the tip! I did not know that it was possible to drop an image into the document as a background.

I did run into a small snag though - my version of Librecad does not allow me to select a line that I have drawn over the background image. It was necessary to continue the lines outside of the image so that i could click the line beyond the image borders - then select the dimension tool to calculate the angle.

Here is the image with lines drawn out beyond the image border to indicate the proposed roof angle:
.

LinesOutside.jpg
LinesOutside.jpg (51.79 KiB) Viewed 1713 times

.
and once the angular arc was calculated i had to zoom in to read the calculated angle:
.

AngleCalculated.jpg
AngleCalculated.jpg (35.13 KiB) Viewed 1713 times

.
Very handy method to know - thanks!

User avatar
greengeek
Posts: 1384
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 535 times
Been thanked: 192 times

Re: Onscreen protractor

Post by greengeek »

step wrote: Fri Nov 27, 2020 11:02 pm

There's qprotractor for Qt5 (and Qt4). ...
source on github

Thanks step. First I used the web archive version and tried to compile it but compiling is a real weak point for me. I was using Slacko 5.6 but the resulting compile errors suggested that my QT configuration was incomplete or wrong so today I tried it on Tahrpup32 after grabbing v0.0.1 from your github link - but this time it said there was no Makefile. (I will to download the web archive version again and have another bash tomorrow).

Here is an image of the v0.0.1 extracted source - does it look as if the makefile is simply missing in action or do these contents indicate i need to use a different compile method than just "make" command?
.

Compile_v0.0.1.jpg
Compile_v0.0.1.jpg (31.57 KiB) Viewed 1710 times

.
EDIT : Just downloaded the source from the archived web page again and this time it does have the Makefile included so I gave it another go (Tahrpup32) but got the following errors. Do you have any suggestions what this might indicate is wrong?
cheers!

Code: Select all

root# make
/usr/bin/qmake -o Makefile qprotractor.pro
/usr/lib/i386-linux-gnu/qt4/bin/uic about.ui -o ui_about.h
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -o main.o main.cpp
In file included from main.cpp:5:0:
protractor.h:5:30: fatal error: boost/optional.hpp: No such file or directory
 #include <boost/optional.hpp>
                              ^
compilation terminated.
make: *** [main.o] Error 1
root# 
User avatar
greengeek
Posts: 1384
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 535 times
Been thanked: 192 times

Re: Onscreen protractor

Post by greengeek »

MochiMoppel wrote: Sat Nov 28, 2020 1:35 pm

Would Pythagoras help with angles at all? I thought his fascination was with lengths.

Fair point. In my defense I will admit that at the time when I should have been concentrating on trigonometry I was sharing a Math class with some lovely young ladies who distracted me and my focus drifted from triangles to hemispheres 8-)

Code: Select all

#!/bin/bash
Xdialog --title="Measure angle of an object" --help="For images with straight baseline:\nClick on 1) baseline,  2) endpoint of angle\n\nFor images with tilted baseline:\nClick on 1) startpoint of baseline, 2) endpoint of baseline, 3) endpoint of angle" -y "This image has a straight baseline?\n(if baseline is tilted click \"No\")" x
RET=$?
((RET>1)) && exit
((RET==1))&& TILTED=1
CURS=($(xwininfo > /dev/null; getcurpos))		# position of 1st mouse click
x1=${CURS[0]}
y1=${CURS[1]}
CURS=($(xwininfo > /dev/null; getcurpos))		# position of 2nd mouse click
x2=${CURS[0]}
y2=${CURS[1]} #measured from top
DELTAX1=$((x2-x1))
DELTAY1=$((y1-y2))
if ((TILTED)) ;then
	CURS=($(xwininfo > /dev/null; getcurpos))	# position of 3rd mouse click
	x3=${CURS[0]}
	y3=${CURS[1]}
	DELTAX2=$((x3-x1))
	DELTAY2=$((y1-y3))
fi
DEGREE=$(echo "( a($DELTAY1/$DELTAX1)*(180/3.14159) )" | bc -l) #radians to degree conversion
((TILTED)) && DEGREE=$(echo "( a($DELTAY2/$DELTAX2)*(180/3.14159) - $DEGREE )" | bc -l)
RESULT=$(printf %.0f $DEGREE) # rounded to integer
((RESULT<0)) && RESULT=$((180+RESULT))
Xdialog -info "Angle: $RESULT°" x 8000

Brilliant! Very handy. Thank you. :thumbup2:
.

Depending on the baseline the script requires to click on 2 or 3 positions in an image to determine the angle of an object. For the click sequence see the screenshot.

In this particular application (what is essentially an inverted "V") the term "baseline" is somewhat confusing and I initially got the sequence wrong (leading to an incorrect angle value).

The main value I need in this case is the angle formed underneath the ridge of the proposed roof.
(Council requirements stipulate a maximum height of the ridgeline above sea level - in order to avoid spoiling neighbours view - and also a maximum angle that must exist below the ridgecap - in order to facilitate drainage of rain - ie; there is a minimum permissible roof slope).
So - i am experimenting with moving the proposed roof ridge up down and sideways to balance the requirements.

My application (with no actual "baseline") is shown here:
.

mm_angle.jpg
mm_angle.jpg (31.2 KiB) Viewed 1704 times

Is there any way to eliminate the concept of a baseline and allow the user to select the two sides in either order - after selecting the vertex as "number 1" ?
(hope that makes sense)

ps: As part of this project I do also have to measure the roof slope relative to the horizontal (ie an obvious baseline) but the roof will not necessarily have matching slopes on each side of the roof. Depending on the impact on the view of all surrounding neighbours the ridgeline will not necessarily be central to the house walls. So the anglefinder will be extremely useful in testing options and calculating measurements. Many thanks!

Last edited by greengeek on Sun Nov 29, 2020 3:06 am, edited 2 times in total.
some1
Posts: 86
Joined: Wed Aug 19, 2020 4:32 am
Has thanked: 18 times
Been thanked: 15 times

Re: Onscreen protractor

Post by some1 »

@MM: printf does not convert to integer - no other errors.
See line 3 from bottom.
The gui -accordingly-allways come up with 0 degree.
To me - the code seem fine.
Any ideas?
I am on a vanilla bionic 64.
----
My remark about needing quoting the printf format -
was a brainfart on my part.
I was porting part of your code to awk, while posting -
awk printf need a quoted format-specifier.

Screenshot(1).png
Screenshot(1).png (238.52 KiB) Viewed 1685 times
User avatar
MochiMoppel
Posts: 1240
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 21 times
Been thanked: 440 times

Re: Onscreen protractor

Post by MochiMoppel »

greengeek wrote: Sun Nov 29, 2020 2:28 am

Is there any way to eliminate the concept of a baseline and allow the user to select the two sides in either order - after selecting the vertex as "number 1" ?
(hope that makes sense)

I had image correction in mind with a more or less straight horizon/baseline or whatever it is called.
In your case clicking on 1) the junction (vertex) of the green graph, then 2) on the left line and finally 3) on a right line gives me a degree of 155. Seems OK. There might be a way to make it work in any other order. Haven't looked into it.

User avatar
MochiMoppel
Posts: 1240
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 21 times
Been thanked: 440 times

Re: Onscreen protractor

Post by MochiMoppel »

some1 wrote: Sun Nov 29, 2020 2:59 am

@MM: printf does not convert to integer - no other errors.
See line 3 from bottom.

What happens when you try printf %.1f -123.456 in a console? Should result in -123.5. Buggy bash version? Or expects a different decimal separator?

some1
Posts: 86
Joined: Wed Aug 19, 2020 4:32 am
Has thanked: 18 times
Been thanked: 15 times

Re: Onscreen protractor

Post by some1 »

@MM: Here is my awk-adaption.

Code removed.
Really need some sleep.

Thanks MM

Last edited by some1 on Sun Nov 29, 2020 11:40 am, edited 1 time in total.
User avatar
MochiMoppel
Posts: 1240
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 21 times
Been thanked: 440 times

Re: Onscreen protractor

Post by MochiMoppel »

some1 wrote: Sun Nov 29, 2020 3:30 am

@MM: Here is my awk-adaption.

I get strange results. Pisa tower stands at -1° :shock:

step
Posts: 546
Joined: Thu Aug 13, 2020 9:55 am
Has thanked: 57 times
Been thanked: 198 times
Contact:

Re: Onscreen protractor / anglefinder

Post by step »

@greengeek it looks like you're missing libboost. I can't compile a 32-bit version for you because I don't have a 32-bit Qt4 or Qt5 for Fatdog64, sorry.

User avatar
puppy_apprentice
Posts: 692
Joined: Tue Oct 06, 2020 8:43 pm
Location: land of bigos and schabowy ;)
Has thanked: 5 times
Been thanked: 115 times

Re: Onscreen protractor / anglefinder

Post by puppy_apprentice »

To find angles with mtPaint (and any vertical/horizontal screen ruler and even take a shot app) and gnumeric:

Attachments
take screen picture as region (two points on the green line)
take screen picture as region (two points on the green line)
take_a_shotjpg.jpg (29.46 KiB) Viewed 1638 times
equations-gnumeric.jpg
equations-gnumeric.jpg (36.68 KiB) Viewed 1652 times
trigonometry.jpg
trigonometry.jpg (47.54 KiB) Viewed 1652 times
User avatar
rcrsn51
Posts: 1390
Joined: Sun Aug 23, 2020 4:26 pm
Been thanked: 357 times

Re: Onscreen protractor / anglefinder

Post by rcrsn51 »

It occurs to me that this discussion depends on the following assumption: when you display a photo on your computer screen, X horizontal pixels represent the same real-world distance as X vertical pixels.

I don't think that you can guarantee this, especially if there is any parallax in play, which there would almost certainly be.

User avatar
greengeek
Posts: 1384
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 535 times
Been thanked: 192 times

Re: Onscreen protractor / anglefinder

Post by greengeek »

rcrsn51 wrote: Sun Nov 29, 2020 5:40 pm

It occurs to me that this discussion depends on the following assumption: when you display a photo on your computer screen, X horizontal pixels represent the same real-world distance as X vertical pixels.

I don't think that you can guarantee this, especially if there is any parallax in play, which there would almost certainly be.

Yes that's true - at best this is a coarse measurement and not a substitute for accurate draughting tools.

It just allows me to shortlist building options at zero cost. The homeowner will then engage the surveyor and the architect to verify and fine tune.

but i think these tools / methods will have other uses too.

User avatar
rcrsn51
Posts: 1390
Joined: Sun Aug 23, 2020 4:26 pm
Been thanked: 357 times

Re: Onscreen protractor / anglefinder

Post by rcrsn51 »

greengeek wrote: Sun Nov 29, 2020 6:10 pm

Yes that's true - at best this is a coarse measurement and not a substitute for accurate draughting tools.

Then the simplest solution would be to lay a plastic protractor against the screen and measure the angle directly.

User avatar
puppy_apprentice
Posts: 692
Joined: Tue Oct 06, 2020 8:43 pm
Location: land of bigos and schabowy ;)
Has thanked: 5 times
Been thanked: 115 times

Re: Onscreen protractor / anglefinder

Post by puppy_apprentice »

rcrsn51 wrote: Sun Nov 29, 2020 6:33 pm

Then the simplest solution would be to lay a plastic protractor against the screen and measure the angle directly.

But we are Puppy users and we should use Puppy tools :P

dellus
Posts: 50
Joined: Sat Nov 14, 2020 9:15 pm
Been thanked: 6 times

Re: Onscreen protractor / anglefinder

Post by dellus »

LibreCAD:
It's a bug up to the newest version that an image blocks selecting a line, always the image gets selected. It doesn't help to lock the the layer with the image. You have to make that layer invisible, then you can select lines you have drawn above it.

mtPaint:
It's a bit confusing at first sight how mtPaint calculates the angle. I have figured it out.
It gives the angle from the first corner clicked to the diagonal corner as kind of geographical direction, a vector. Straight upwards, let's call it North, is 0 °, then via East at 90° to South at 180°. Farther than that it jumps to negative values related to North (-179°) via West at -90° and back to North at 0°.
So you have to calculate a little yourself, but no trigonometrics needed.

vectorangle.png
vectorangle.png (6.28 KiB) Viewed 1757 times

So in this case the angle from horizontal is 90° - vector angle 60° = 30°.

And to add: the units mtPaint gives are wrong of course: x' and xx'' are Minutes and Seconds, subunits of degree x°.

wjaguar
Posts: 6
Joined: Fri Nov 13, 2020 9:28 pm
Contact:

Re: Onscreen protractor / anglefinder

Post by wjaguar »

dellus wrote: Sun Nov 29, 2020 9:08 pm

And to add: the units mtPaint gives are wrong of course: x' and xx'' are Minutes and Seconds, subunits of degree x°.

Isn't units at all; the thing labelled ' is angle in degrees, " is length in pixels.
Was that way since always, was thought known by all, happens to be near undocumented. :(

The measurements are done not only for selection rectangle's diagonal, but also for line tool and gradient placement tool. This latter is the easiest choice for measuring things on an image in most cases, being a line and not a box, but not a peep of that possibility is in the current handbook. (Will add it now that the omission is noticed.)

dellus
Posts: 50
Joined: Sat Nov 14, 2020 9:15 pm
Been thanked: 6 times

Re: Onscreen protractor / anglefinder

Post by dellus »

Oh, I didn't realize that.
I suggest to change the labeling if possible, as it is misleading. Maybe something with < for angle, like use in CAD.
Example LibreCAD:

vectorangle2.png
vectorangle2.png (483 Bytes) Viewed 1723 times
User avatar
greengeek
Posts: 1384
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 535 times
Been thanked: 192 times

Re: Onscreen protractor / anglefinder

Post by greengeek »

puppy_apprentice wrote: Sun Nov 29, 2020 10:09 am

To find angles with mtPaint (and any vertical/horizontal screen ruler and even take a shot app) and gnumeric:

Hi puppy_apprentice - thanks for the formulae. Can you clarify where the B1,B2,B3 come from please? I am terrible with spreadsheets.
cheers!
EDIT : Never mind - my wife says it is the contents of the cells - nothng to do with the mtpaint image. Doh! Obvious.

User avatar
puppy_apprentice
Posts: 692
Joined: Tue Oct 06, 2020 8:43 pm
Location: land of bigos and schabowy ;)
Has thanked: 5 times
Been thanked: 115 times

Re: Onscreen protractor / anglefinder

Post by puppy_apprentice »

greengeek wrote: Fri Dec 04, 2020 7:28 am

EDIT : Never mind - my wife says it is the contents of the cells - nothng to do with the mtpaint image. Doh! Obvious.

There is a woman behind every man's success

So you are in good hands ;)

User avatar
greengeek
Posts: 1384
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 535 times
Been thanked: 192 times

Re: Onscreen protractor / anglefinder

Post by greengeek »

I have assembled a script that allows the user to find the angle between any two lines on screen - regardless of whether or not they share a common vertex. They can be anywhere, and connected, disconnected or intersecting. Does not matter.

anglefinder_gg-0.2.gz
Please remove false .gz suffix and make executable then click to run.
(4.9 KiB) Downloaded 58 times

(Remove false .gz suffix)

This works "around the clock" ie the lines are not referenced to any ground plane and can be anywhere within the 360 degree radius just like the hands on an analog clock face.

Click the script and it will ask you to click the "vertex end" of the first line. This means the "convergent end" of the line - ie where it is closest to the second line. (The lines do not need to meet - the user just needs to be able to identify which ends are closer).

Then you will be asked to click the other end of line 1 ("distal end"), then the vertex end of line 2, then the distal end of line 2. Very simple after you have done it once. Just follow the coaching on screen.

Concave_Lens.jpg
Concave_Lens.jpg (26.15 KiB) Viewed 1659 times

.
When finished two angles will be displayed - one is the smaller internal angle and the other is the larger external angle ("reflex angle")

AngleDisplay.jpg
AngleDisplay.jpg (42.47 KiB) Viewed 1659 times

Thanks to MochiMoppel for the basic ingredients of the script from earlier in this thread. Gave me an excellent heads-up where to start.

version 0.2
Fixed incorrect handling of negative number when lines processed in different order.
Commented out debug section.

version 0.1
released with couple of bugs.

Last edited by greengeek on Sun Dec 27, 2020 6:18 pm, edited 2 times in total.
Post Reply

Return to “Programming”