Discussion:
[Arm-netbook] python coding help needed (sin, cosine, blah blah)
Luke Kenneth Casson Leighton
2017-07-29 12:53:55 UTC
Permalink
http://hands.com/~lkcl/foldable3dsandwich200/belts.py

ok, i could use some algorithm help, here, if anyone's interested.
the key function is add_bearing in class Belt.

basically what i have done is create a class which completely
specifies a belt path, by starting out with the angle that the belt is
wrapped around so far, plus the position, plus the diameter of the
bearing (a fake bearing initially).

subsequent bearings need only be added specifying their position,
radius, and whether the belt is to go on the INTERIOR or the EXTERIOR
of the bearing.

the swapping-from-interior-to-exterior is where i'm having
difficulties. i've made a half-assed approximation so far, i will
upload a quick video about it...


the problem i have is that the flip-over between interior and exterior
is a little bit too complicated for my tiny brain to handle. i know
that it involves twin offsets. i think it might be possible to work
out the first angle between the bearings, then pretend that there's
another bearing added on the *other* side (in the opposite
configuration), then work out the angle of *that* (fake) bearing to
the one before it...

anyway if anybody would like to have a go at tackling this i would be
really grateful.

l.

_______________________________________________
arm-netbook mailing list arm-***@lists.phcomp.co.uk
http://lists.phcomp.co.uk/mailman/listinfo/arm-netbook
Luke Kenneth Casson Leighton
2017-07-29 14:49:21 UTC
Permalink
---
crowd-funded eco-conscious hardware: https://www.crowdsupply.com/eoma68


On Sat, Jul 29, 2017 at 2:51 PM, Benson Mitchell
Post by Luke Kenneth Casson Leighton
http://hands.com/~lkcl/foldable3dsandwich200/belts.py
ok, i could use some algorithm help, here, if anyone's interested.
the key function is add_bearing in class Belt.
I don't really speak python, but I'm happy to put my two cents in.
python's pretty clear and human-readable.
You've got three of the four cases defined,
yes. the last case - which is when 2 or more inverted-belt bearings
are added - i skipped, on the basis that i would not really use it (if
ever).
but to start with I only looked
at the simple one (invert==0, oldinvert==0) which you seem to think is
solved.
it is... but explaining how it works is not something i can easily
do. i tend to work by intuition and guess-work. i was terribly
surprised when a series of random and semi-arbitrary
code-modifications actually produced the desired result.
Unless I'm missing something, it's not really solved at all -- it
looks like it completely ignores any difference in radius when figuring the
contact angles.
ah. ok you see the loop "+= 360"? i vaguely figured that any change
would have to result in a positive increase in angle. any change that
went over 360 could be made modulus 360 for the *next* change.

staggeringly this actually works.
And I think when you fix that, the hard cases will mostly
explain themselves (you'll basically negate the radius in that calculation,
and maybe also add/subtract the belt thickness).
ok the problem of actually creating the belt is passed to that
SurfaceFromCurves function. you give it a set of points (actually two
sets) and a "thickness" parameter, and it *automatically* creates the
full 3D polygon set needed to create a complete 3D surface of
thickness "thickness".
So, given the old bearing has radius R1 and the new bearing has radius R2,
separated horizontally (or at any other angle) by a distance D, we can find
the deviation from horizontal (or in the general case, the deviation from
arcsin((R1-R2)/D)
yep this case is not covered at all. however given that i am only
using radii of 6 and 7 or 8 and 9, with long separation between them
and also where there is a huge discrepancy the angles are 180 degrees
and dead-straight (lined up by eye), the differences caused by not
taking into account the case R1 != R2 are either actually zero or
negligeably small.

it's a visual aid and approximation anyway, but i would really like
it to actually be complete and accurate, as i will be doing more
complex belt layouts later.
And if you're crossing over, with belt thickness T, that should just become
arcsin((R1+R2+T)/D)
(again, this is going from noninverted to inverted -- negate for inverted
to noninverted, or maybe the opposite.)
if i can be absolutely honest, my mind isn't one that can cope with
or follow accurate mathematical calculations. when working with the
spline-generating function i had to leave *six years* in between
modifications and it took me 2 days of experimentation to get even a
reaasonably-approximate version of "normalised vectors" up and
running. that was from a lot of google searches, as well :)

so if i may, i'd like to leave it to others to discuss this, if they
want to: i'll chip in if necessary.

l.

_______________________________________________
arm-netbook mailing list arm-***@lists.phcomp.co.uk
http://lists.phcomp.co.uk/mailman/listinfo/arm-netbook
Send large attachments to arm-***@files.phcomp.co.
David Niklas
2017-08-07 22:46:39 UTC
Permalink
On Sat, 29 Jul 2017 15:49:21 +0100
Post by Luke Kenneth Casson Leighton
On Sat, Jul 29, 2017 at 2:51 PM, Benson Mitchell
Post by Luke Kenneth Casson Leighton
http://hands.com/~lkcl/foldable3dsandwich200/belts.py
ok, i could use some algorithm help, here, if anyone's interested.
the key function is add_bearing in class Belt.
I don't really speak python, but I'm happy to put my two cents in.
python's pretty clear and human-readable.
<snip>
Post by Luke Kenneth Casson Leighton
so if i may, i'd like to leave it to others to discuss this, if they
want to: i'll chip in if necessary.
l.
I'm going to look into this luke, no promises, but I'm ok with math and
python.

Sincerely,
David

_______________________________________________
arm-netbook mailing list arm-***@lists.phcomp.co.uk
http://lists.phcomp.co.uk/mailman/listinfo/arm-netbook
Send large attachments to ar
Luke Kenneth Casson Leighton
2017-08-08 02:47:05 UTC
Permalink
Post by David Niklas
Post by Luke Kenneth Casson Leighton
http://hands.com/~lkcl/foldable3dsandwich200/belts.py
ok, i could use some algorithm help, here, if anyone's interested.
the key function is add_bearing in class Belt.
I'm going to look into this luke, no promises, but I'm ok with math and
python.
star. i _could_ do it.... it'd take time.

l.

_______________________________________________
arm-netbook mailing list arm-***@lists.phcomp.co.uk
http://lists.phcomp.co.uk/mailman/listinfo/arm-netbook
Send large at
Luke Kenneth Casson Leighton
2017-08-08 05:20:30 UTC
Permalink
https://math.stackexchange.com/questions/882067/given-two-circles-find-the-length-of-a-pulley-belt-that-connects-the-two

this might help - i'm going to ask another question.

_______________________________________________
arm-netbook mailing list arm-***@lists.phcomp.co.uk
http://lists.phcomp.co.uk/mailman/listinfo/arm-netbook
Send la
Luke Kenneth Casson Leighton
2017-08-08 05:58:49 UTC
Permalink
https://math.stackexchange.com/questions/2386333/how-do-you-find-the-length-and-angle-of-a-belt-between-two-pulleys-both-outer-e

'faakin 'ellfire, faaking stupid system - you don't quotes have enough
reputation quotes to post images, thus making it near-impossible to
express th faaking question in an easy-to-faakin-understand way.
faak!

l.

_______________________________________________
arm-netbook mailing list arm-***@lists.phcomp.co.uk
http://lists.phcomp.co.uk/mailman/listinfo/arm-netbook
Send larg
Luke Kenneth Casson Leighton
2017-08-10 09:43:48 UTC
Permalink
https://math.stackexchange.com/questions/2386333/how-do-you-find-the-length-and-angle-of-a-belt-between-two-pulleys-both-outer-e/

hiya david: okay! so someone kindly edited the question to put the
proper links in, so the question's actually understandable.

so... benson.... with the diagrams that aretino kindly added, i was
able to not only understand what he was saying, but, also, understood
it well enough to appreciate that *your* answer is correct :)

aretino recommends using arccos instead of arcsin.

l.

_______________________________________________
arm-netbook mailing list arm-***@lists.phcomp.co.uk
http://lists.phcomp.co.uk/mailman/listinfo/arm-netbook
Send la
d***@mail.com
2017-08-17 22:24:51 UTC
Permalink
On Thu, 10 Aug 2017 05:43:48 -0400
https://math.stackexchange.com/ (bla)
hiya david: okay! so someone kindly edited the question to put the
proper links in, so the question's actually understandable.
so... benson.... with the diagrams that aretino kindly added, i was
able to not only understand what he was saying, but, also, understood
it well enough to appreciate that *your* answer is correct :)
aretino recommends using arccos instead of arcsin.
Luke, just getting through my emails, does this mean that
you have your problem solved or were you referring this info
for my benefit?

Thanks,
David

_______________________________________________
arm-netbook mailing list arm-***@lists.phcomp.co.uk
http://lists.phcomp.co.uk/mailman/listinfo/arm-netbook
Send large attach
Luke Kenneth Casson Leighton
2017-08-18 05:58:54 UTC
Permalink
---
crowd-funded eco-conscious hardware: https://www.crowdsupply.com/eoma68
Post by d***@mail.com
On Thu, 10 Aug 2017 05:43:48 -0400
https://math.stackexchange.com/ (bla)
hiya david: okay! so someone kindly edited the question to put the
proper links in, so the question's actually understandable.
so... benson.... with the diagrams that aretino kindly added, i was
able to not only understand what he was saying, but, also, understood
it well enough to appreciate that *your* answer is correct :)
aretino recommends using arccos instead of arcsin.
Luke, just getting through my emails, does this mean that
you have your problem solved
that's incorrect.
Post by d***@mail.com
or were you referring this info for my benefit?
that is correct.

if you look at the source code (git cloned or simply verify belts.py
manually) you will see that there have been no commits which implement
the algorithm. i have too much else to do, so your help is very much
needed.

l.

_______________________________________________
arm-netbook mailing list arm-***@lists.phcomp.co.uk
http://lists.phcomp.co.uk/mailman/listinfo/arm-netbook
Send
d***@mail.com
2017-09-09 15:43:40 UTC
Permalink
On Fri, 18 Aug 2017 06:58:54 +0100
Post by d***@mail.com
On Thu, 10 Aug 2017 05:43:48 -0400
https://math.stackexchange.com/ (bla)
hiya david: okay! so someone kindly edited the question to put the
proper links in, so the question's actually understandable.
<snip>

Unfortunately I've not been able to finish this. I've tried luke, but my
laptop's battery just went totally bad, my desktop's HD filled up all the
way and my family has been in need of my help. I just don't have the time
to do this either, and with the hurricane coming (to Florida), I'm not
certain what's going to become of me or this house (yes, I'm staying
with my family). We will probably loose power and water at the least.

In case you've not heard it's a CAT 5! AND there is another one behind it!

I've done several of the calculations by hand and I understand how to do
it, just not with a computer nor with your program, plus I don't have the
python bindings for openscand so you program still will not work (yes I
set python's path correctly).
I've created a simple gif that illustrates the steps that the computer
must take. This should help you to not have to take shots in the
dark when trying to figure this out.
1. Create a polygon.
2. Separate the polygon into squares or right triangles.
3. Enlarge based on sizes of pulleys.
4. Measure angles of side and use this to calculate the angles of your
pulleys.

Sincerely,
David

_______________________________________________
arm-netbook mailing list arm-***@lists.phcomp.co.uk
http://lists.phcomp.co.uk/mailman/listinfo/arm-netbook
Send large attachme
Luke Kenneth Casson Leighton
2017-09-10 00:12:07 UTC
Permalink
Post by d***@mail.com
Unfortunately I've not been able to finish this. I've tried luke, but my
laptop's battery just went totally bad, my desktop's HD filled up all the
way and my family has been in need of my help.
hey sounds like you have your hands full
Post by d***@mail.com
I just don't have the time
to do this either, and with the hurricane coming (to Florida), I'm not
certain what's going to become of me or this house (yes, I'm staying
with my family). We will probably loose power and water at the least.
_really_ full :)
Post by d***@mail.com
In case you've not heard it's a CAT 5! AND there is another one behind it!
just been in a typhoon here in taiwan couple months back, i have to
say it was utterly cool, 14 storey apartment, we're on the 13th floor
and the thing was SWAYING about a foot, for an hour. i was very
disappointed that the only damage done was a few tree plants blown
over, bits of corrugated iron pin-wheeling down the street, but not
even a flicker on the power-grid or the water supply.

mind you, this place is set up for year-on-year typhoons. i found it
strange (and quotes backwards quotes) as to why you see all these
motor cycles running about the place with 2 or 3 1 metre long propane
gas cylinders strapped to the back: it's because it's too dangerous to
have gas main lines running underground. so everyone cooks with
camping gas style kitchen stoves and the hot water heater runs off
another one, and you'll never get people being blown up because a
tornado ripped up a gas main.
Post by d***@mail.com
I've done several of the calculations by hand and I understand how to do
it, just not with a computer nor with your program, plus I don't have the
python bindings for openscand
there aren't any. pyopenscad is an independent program that
*outputs* scad (as a text file).
Post by d***@mail.com
so you program still will not work (yes I
set python's path correctly).
I've created a simple gif that illustrates the steps that the computer
must take. This should help you to not have to take shots in the
dark when trying to figure this out.
:)
Post by d***@mail.com
1. Create a polygon.
2. Separate the polygon into squares or right triangles.
3. Enlarge based on sizes of pulleys.
4. Measure angles of side and use this to calculate the angles of your
pulleys.
i can manage that with enough guess-work :)

thanks david.

l.

_______________________________________________
arm-netbook mailing list arm-***@lists.phcomp.co.uk
http://lists.phcomp.co.uk/mailman/listinfo/arm-netbook
Send large attachments to arm-***@files.ph

David Niklas
2017-08-14 22:11:42 UTC
Permalink
Luke,
Is this the correct location of pyopenscad?

http://forum.openscad.org/ANN-pyopenscad-spline-surface-generator-td21838.html

Are there any other deps I should be aware of?

Sincerely,
David

_______________________________________________
arm-netbook mailing list arm-***@lists.phcomp.co.uk
http://lists.phcomp.co.uk/mailman/listinfo/arm-netbook
Send large attachments to arm-***@files
Luke Kenneth Casson Leighton
2017-08-15 06:41:57 UTC
Permalink
Post by David Niklas
Luke,
Is this the correct location of pyopenscad?
http://forum.openscad.org/ANN-pyopenscad-spline-surface-generator-td21838.html
yes. do let me know how you get on, it would be good to have a
double-check from someone that i got the files right.
Post by David Niklas
Are there any other deps I should be aware of?
python2, openscad... thaaat's... about it :)

l.

_______________________________________________
arm-netbook mailing list arm-***@lists.phcomp.co.uk
http://lists.phcomp.co.uk/mailman/listinfo/arm-netbook
Send large attachments to arm-netbook
Loading...