code logs -> 2010 -> Mon, 11 Oct 2010< code.20101010.log - code.20101012.log >
--- Log opened Mon Oct 11 00:00:16 2010
00:07 Attilla [Some.Dude@Nightstar-3df9855a.threembb.co.uk] has quit [[NS] Quit: ]
00:41 You're now known as TheWatcher[T-2]
00:44 You're now known as TheWatcher[zZzZ]
02:09 Derakon[AFK] is now known as Derakon
02:35 gnolam [lenin@Nightstar-38637aa0.priv.bahnhof.se] has quit [[NS] Quit: Z?]
03:33 Vornicus [vorn@ServerAdministrator.Nightstar.Net] has quit [[NS] Quit: Leaving]
03:36 Vornicus [vorn@ServerAdministrator.Nightstar.Net] has joined #code
03:36 mode/#code [+o Vornicus] by Reiver
03:39 kaura [kaura@Nightstar-fd82400d.snfc21.sbcglobal.net] has joined #code
03:42
<@Vornicus>
Kaura!
03:43
< kaura>
Vorn!
03:43
< kaura>
I haven't touched the stuff you've given me yet, alas.
03:45
<@Vornicus>
That's all right.
03:46
<@Vornicus>
I expected to need to explain it anyway, because i use a term -- and a kind of thing -- that you don't know about yet.
03:49 * ToxicFrog tries to figure out how to get his automatic RMI stuff working without being shit to declare
03:50
<@Vornicus>
That thing is called a stack. A stack is basically a list, except you only ever talk about one end of it; it's used mostly when you usually deal with stuff as you encounter it.
03:51
< kaura>
Vorn: I'm also not quite cognizant about how to toggle modes.
03:52
<@Vornicus>
That's not too hard either.
03:52
<@Vornicus>
You just choose a number for each mode (usually you give that number a constant name) and then switch between them by assigning that number to "mode"
03:54
< celticminstrel>
This is why I like enum types.
03:54
<@Vornicus>
Having a built-in enum type is nice but sadly Python doesn't have a nice one of those.
03:54
< celticminstrel>
Though, I seem to recall seeing an enum-like type in the Python library somewhere...
03:55
<@Derakon>
Vorn: no, but it's easy enough to imitate.
03:55
<@Derakon>
(TYPE_A, TYPE_B, TYPE_C) = range(3)
03:55
<@Vornicus>
Oh that's /cool/
03:57
<@Derakon>
I thought so when I first saw it.
03:59
<@Vornicus>
So what we're going to write today is something called "evaluate". What it will do is take in a list of symbols (that came from lex) and try to evaluate it.
04:01 Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has joined #code
04:05
<@Vornicus>
Actually, thinking about this, we're going to want to send our evaluation through quite a few different steps here, and they're all going to need access to our stacks; we'll make this a class.
04:07
< kaura>
Right.
04:08
<@Vornicus>
So what we'll do is we'll make a class called, idunno, Expression
04:09
< kaura>
class Expression(object), right?
04:09
<@Vornicus>
Yep. DOn't forget your colon.
04:09
< kaura>
Right.
04:10
<@Vornicus>
And then __init__ will take in a string, and then assign that to self.input; then lex is also in Expression, takes only self, looks at self.input, and creates self.symbols instead of returning them.
04:13
<@Vornicus>
When you've made those modifications, tell me.
04:13
<@Vornicus>
(and show me)
04:20
< kaura>
Hrn. Pastebin's choking.
04:25
< kaura>
Ah, finally stopped choking. http://pastebin.starforge.co.uk/423
04:27
<@Vornicus>
Not quite on the modifications to lex; try "self.symbols = symbols" instead for the last line. Don't have to return anything.
04:27
< kaura>
Ah.
04:27 Rhamphoryncus [rhamph@Nightstar-473f8685.abhsia.telus.net] has joined #code
04:29
< kaura>
Right, mod made.
04:30
<@Vornicus>
Also we no longer need the non-class version of lex.
04:30
< kaura>
Right. There's no instance in which you wouldn't call the class version to run it. Deleting.
04:30
<@Vornicus>
Also also, remember how __init__ actually assigns stuff; look at how we handled filename in our deck simulator.
04:33
< kaura>
Ah, so it ought to be "def __init__(self): self = self.input"
04:38
<@Vornicus>
no.
04:38
<@Vornicus>
Where does init get input?
04:43
<@Vornicus>
(I pointed you at filename -- or is it deck_file? I forget -- because that one did exactly what we're going to do here.)
05:05 * Vornicus thinks he's lost kaura to Bejewelled. Does not lay blame.
05:05
< kaura>
Vorn: Actually, you temporarily lost me to the inevitable results of too much spicy food.
05:06
< kaura>
Right, so it should actually be (self, input)?
05:06
< kaura>
wait, not input. foo. Input's already set aside.
05:13
<@Vornicus>
I wouldn't call it "foo"
05:15
<@Vornicus>
("expr_string" would work though)
05:24
<@Vornicus>
And then the assignment changes too, of course.
05:24
<@Vornicus>
But anyway, what we're going to want to do is call lex within __init__; what we're actually doing is storing not just data and general procedures in a class, but a whole program that depends on a lot of different things.
05:29
<@Vornicus>
So theeeen, we're going to write something called evaluate. But before we get there, __init__ should set self.mode to whatever number you chose to represent "I expect a number next!"
05:33
< kaura>
The mode assignments are outside of __init__ but within the class, right?
05:36
<@Vornicus>
Well, the setup of what mode is what -- naming your numbers -- yeah. But we set the starting mode in... well, no, init no. evaluate is where it should go.
05:38 * McMartin finds himself building non-software things!
05:41
<@Vornicus>
Anyway, in evaluate we need to loop over self.symbols; then we're going to process each symbol.
05:42
<@Vornicus>
also, the mode setting should be object-wide too.
05:42
< kaura>
Sorry, object-wide?
05:43
<@Vornicus>
it's self's.
05:44
< kaura>
Ah.
05:44
<@Vornicus>
(symbols and expr-string or whatever you called it are also object-wide)
05:45 Rhamphoryncus [rhamph@Nightstar-473f8685.abhsia.telus.net] has quit [Client exited]
05:46
< celticminstrel>
Non-software things?
05:46
<@Vornicus>
Furniture, specifically.
05:50 * kaura ponders. Lesse if I've got this right...
05:51
< kaura>
http://pastebin.starforge.co.uk/424
05:52
<@Vornicus>
Indeed.
05:52
<@Vornicus>
Now, before we get too far -- we need two stacks.
05:52
<@Vornicus>
One's for numbers, the other's for operators.
05:53
< celticminstrel>
This sounds familiar! ^_^
05:53
<@Vornicus>
These will also be stored in the object; they're just lists, and they start empty.
05:56
< kaura>
so numstack = [] and opstack = []
05:58 cpux is now known as cpux[undead]
05:58
<@Vornicus>
yeah, but htey're on self as well.
05:59
< kaura>
Oh, right. So self.numstack etc
05:59 Serah [Z@2C3C9C.B2A300.F245DE.859909] has quit [Ping timeout: 121 seconds]
06:00
<@Vornicus>
Right.
06:01
<@Vornicus>
also, I'd call "number" and "operator" just NUM and OP.
06:01
<@Vornicus>
Anyway.
06:03
<@Vornicus>
When, on my thing there, I say "push", use "append". when I say "pop", use "pop". Don't give pop a number, either. When pushing numbers, make sure to turn them to actual numbers using int; when pushing unary operators, convert them to the u form via U_DICT.
06:04 Derakon is now known as Derakon[AFK]
06:06
<@Vornicus>
You're going to want to turn "pop off an operator and execute it" into a function of its own; also, you need a dictionary that tells you which operators should get popped off when adding in a new one.
06:08
<@Vornicus>
Which actually we should be building before anything else here.
06:09
< celticminstrel>
...why on earth does SDL_image only support reading image data?
06:11
<@Vornicus>
So we also need a dictionary that, given a binary operator, gives us a list of operators that it works after. for +, for instance, you need to have +, -, *, /, ^, d, u-, u+, and ud
06:11
<@Vornicus>
(also the same for -)
06:13
<@Vornicus>
and then * has all that except for + and -.
06:14
< celticminstrel>
And the same for / ?
06:14
<@Vornicus>
Indeed.
06:14
<@Vornicus>
d is kind of a bone of contention; I say that it shold happen at about the same time as *
06:14
<@Vornicus>
(and so should have the same list)
06:14
< celticminstrel>
And then I guess ^ would just have ^, d, u-. u+, or something.
06:14
< celticminstrel>
^ ,
06:14
<@Vornicus>
Ah ah! Not quite.
06:15
< celticminstrel>
Of course, if ^ is exponentiation, it throws everything off a bit by being right associative.
06:15
< celticminstrel>
As opposed to - and / which are left associative.
06:15
<@Vornicus>
And this dictionary will account for that.
06:15
< celticminstrel>
Oh, good...?
06:15
<@Vornicus>
You see... ^'s list... has nothing in it.
06:16
< celticminstrel>
Oh, not even itself.
06:18
<@Vornicus>
Because it happens before anything else - even negation.
06:20
<@Vornicus>
ud and u- and u+ also have nothing in them, because if they show up then none ofthe binary operators will even work properly yet (because we're still waiting on a number) and because we want to take them last to first.
06:22
<@Vornicus>
And I've just dumped a shitload onto kaura.
06:27
< kaura>
Yeah... gimme a sec. Need some ice water before I tackle this...
06:30
<@Vornicus>
This is a lot of code that needs to be written, and most of it won't work until it's all in.
06:37 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has quit [[NS] Quit: And lo! The computer falls into a deep sleep, to awake again some other day!]
06:56
< kaura>
Saving your instructions and working on them tomorrow. Need to make sure I wake up in time for my job interview tomorrow, and my brain's still a bit fried right now.
07:09 Stalker [Z@3A600C.A966FF.5BF32D.8E7ABA] has joined #code
07:48 Anno[Laptop] [annodomini@Nightstar-a79e2735.adsl.tpnet.pl] has joined #code
08:02 Tarinaky [Tarinaky@Nightstar-f349ca6d.plus.com] has joined #code
08:30 Anno[Laptop] is now known as GM
08:33 Tarinaky is now known as MrJohnson
08:42 Vornicus is now known as Vornicus-Latens
08:45 kwsn is now known as kwsn\t-2
08:50 kwsn\t-2 [kwsn@31356A.5FD175.2259B6.DFACD4] has quit [[NS] Quit: IT'S RAINING... something]
09:45 Abu[Laptop] [annodomini@Nightstar-ad8ab9cf.adsl.tpnet.pl] has joined #code
09:45 Abu[Laptop] is now known as GM_
09:47 GM [annodomini@Nightstar-a79e2735.adsl.tpnet.pl] has quit [Ping timeout: 121 seconds]
10:16 You're now known as TheWatcher
10:25 MrJohnson is now known as Tarinaky
10:28 Stalker [Z@3A600C.A966FF.5BF32D.8E7ABA] has quit [Ping timeout: 121 seconds]
10:29 GM_ is now known as AnnoDomini
10:45 AnnoDomini [annodomini@Nightstar-ad8ab9cf.adsl.tpnet.pl] has quit [[NS] Quit: Uni time.]
11:15
< Tarinaky>
Morning.
11:21 kaura is now known as Kaura|zzz
11:49 * Tarinaky blinks. That's... different.
11:49
<@TheWatcher>
?
11:49 * TheWatcher hands Tarinaky a butterfly
11:51
< Tarinaky>
http://tarinaky.pastebin.com/XB2d5VH7 << What is different between those two blocks?
11:51
< Tarinaky>
The bottom one is raising an error ("Expected::") on the word 'except'.
11:52
<@TheWatcher>
the comma between ImportError, err: and ImportError err: ?
11:53
< Tarinaky>
Ahah.
11:53
< Tarinaky>
Thanks!
12:14 Anno[Laptop] [annodomini@F67919.F326B3.98D923.BDA7B6] has joined #code
12:37 cpux[undead] [chatzilla@Nightstar-c978de34.dyn.optonline.net] has quit [[NS] Quit: ChatZilla 0.9.86 [Firefox 3.6.10/20100914125854]]
12:43 Anno[Laptop] [annodomini@F67919.F326B3.98D923.BDA7B6] has quit [[NS] Quit: leaving]
13:18 Anno[Laptop] [annodomini@Nightstar-ad8ab9cf.adsl.tpnet.pl] has joined #code
13:41 gnolam [lenin@Nightstar-38637aa0.priv.bahnhof.se] has joined #code
13:59 Rhamphoryncus [rhamph@Nightstar-473f8685.abhsia.telus.net] has joined #code
13:59
< gnolam>
And Kubuntu Netbook fails at its UI.
14:00 * gnolam gives up on a /good/ Linux experience and falls back to Xubuntu.
14:06
< gnolam>
It still fails at basic bloody features (like letting me set usable goddamn date and time formats), but it seems to be the best of the bunch. :P
14:51 Reiver [reaverta@ServerAdministrator.Nightstar.Net] has quit [Ping timeout: 121 seconds]
14:52 Ortiha [orthianz@Nightstar-82673a60.xnet.co.nz] has quit [Ping timeout: 121 seconds]
14:57 Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has quit [Connection reset by peer]
15:08 Reiver [reaverta@ServerAdministrator.Nightstar.Net] has joined #code
15:08 mode/#code [+qo Reiver Reiver] by ChanServ
15:22
< Tarinaky>
Well... I've successfully drawn 2/3 of a Hexagon >.<
15:23
< Tarinaky>
Unfortunately it appears to be missing two sides.
15:23
< Tarinaky>
Which I don't quite understand.
15:23
< Tarinaky>
http://tarinaky.pastebin.com/ZdgEQu26
15:29 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has joined #code
15:45
< gnolam>
Vertex ordering?
15:46
< Tarinaky>
They're ordered clockwise.
15:59
< Tarinaky>
Iiiinteresting.
16:00
< Tarinaky>
The debugger says that, after being initialised... Hexagon = list: [(0, 1.0), (1, 0), (0, -1.0), (-1, -1.0), (-1, 0), (-1, 1.0)]
16:00
< Tarinaky>
Anyone know why Python is being dumb?
16:02
< Tarinaky>
When I change 1/2 and 3/2 to 0.5 and 1.5 respectively it works.
16:02
< Tarinaky>
Stupid dynamic typing :/
16:03
< Tarinaky>
I find 1/2 easier to read than 0.5 - anyone have a 'fix'?
16:05
< celticminstrel>
Write 1.0/2
16:05
< celticminstrel>
Or I think 1/2.0 should work too.
16:09
< Tarinaky>
Ahah.
16:09
<@TheWatcher>
Use constants?~ (Python does do them, right?)
16:10 * TheWatcher really should bring himself to learn more of that language
16:10
<@TheWatcher>
(bug uggh, the whitespace sensitivity ;.;)
16:10
< Tarinaky>
Constants seem a little clunky when I'm used to specifying real numbers using fractions rather than decimals. :/
16:10
<@TheWatcher>
*but
16:20
< PinkFreud>
TheWatcher: I've been trying to convince myself to learn more about python as well
16:20
<@TheWatcher>
The lack of { } royally fucks with my headbones.
16:25
< PinkFreud>
indeed. there are those who say that whitespace delimiting 'just makes sense', but I'm not one of them
16:26
< celticminstrel>
I kind of like the "begin ... end" type of delimiting too.
16:27
< celticminstrel>
Like in AppleScript or VB.
16:27
< celticminstrel>
Or shell scripts for that matter.
16:42
< celticminstrel>
If I try to lock a surface that doesn't need to be locked, will SDL_LockSurface return failure or just no-op?
16:46
< celticminstrel>
Yay for source code. Looks like it's just a no-op.
16:48 * Tarinaky tries to remember how to do abstract classes in python./
16:48
< celticminstrel>
Um. Does Python do abstract classes?
16:49
< celticminstrel>
I suppose you could do it by defining all your unimplemented functions to raise an exception.
16:49
< Tarinaky>
Well. I mean having unimplemented functions.
16:50
< Tarinaky>
So I can have a skeletal engine class that I can inherit rather than copy+pasting+modifying.
16:51
< Tarinaky>
(Since there's a lot of stuff to initialise for pygame)
16:53
< Tarinaky>
I can't seem to spot it in the documentation.
16:54
< Tarinaky>
Do I just add do-nothing functions and reimplement them in derived classes?
16:54
< celticminstrel>
This might interest you... though I dunno what version you're using. http://www.python.org/dev/peps/pep-3119/
16:56
< Tarinaky>
That doesn't seem to have the answer I'm looking for right now :/
16:57
< celticminstrel>
"a decorator that can be used to define abstract methods" is not what you're looking for?
16:57
< Tarinaky>
Ahah! I found what I was looking for.
16:58
< Tarinaky>
"For C++ programmers: all methods in Python are effectively virtual."
16:58
< celticminstrel>
Yeah, that's right. That's the case in Java too.
17:06
< celticminstrel>
"Unlike Java's abstract methods or C++'s pure abstract methods, abstract methods as defined here may have an implementation."
17:06
< celticminstrel>
Actually, I'm pretty sure C++ pure virtual methods can have an implementation.
17:08
<@Vornicus-Latens>
from __future__ import division
17:08
<@Vornicus-Latens>
Makes / give a float when it looks like it should.
17:08
< celticminstrel>
:O
17:09
<@Vornicus-Latens>
When you do that, if you do need explicitly integer division, use //
17:09
< celticminstrel>
So, Python 3 doesn't floor regular division?
17:09
<@Vornicus-Latens>
nope.
17:09
< celticminstrel>
Nice.
17:12
< celticminstrel>
And yes, C++ pure virtual methods can have an implementation.
17:13
< celticminstrel>
Which can be accessed explicitly from within a base class.
17:15
<@Vornicus-Latens>
Tarinaky: to create an abstract class, you can just have the program call functions that don't appear to exist yet. :)
17:35
< Tarinaky>
Sorry, was afk. Cool.
17:45
< Tarinaky>
Incidentally... how -do- you declare a constant in Python?
17:45 Attilla [Some.Dude@Nightstar-f1e933d1.threembb.co.uk] has joined #code
17:45 mode/#code [+o Attilla] by Reiver
18:04
< celticminstrel>
x=9?
18:05
< celticminstrel>
As far as I know, Python has no way of enforcing constness.
18:06
< Tarinaky>
TypeError: can't multiply sequence by non-int of type 'float'
18:06
< Tarinaky>
... >.<
18:06
< Tarinaky>
This is when trying to use the division from __future__.
18:06
< celticminstrel>
Cast it to int first.
18:06
< Tarinaky>
Oh wait, no.
18:07
< Tarinaky>
It happens in both cases :/
18:07
< celticminstrel>
Hehe.
18:07
<@Vornicus-Latens>
There is in fact no enforced const thing in Python.
18:08
< Tarinaky>
Vertices = [(a*Size/2,b*Size/2) for (a,b) in Vertices] I don't understand what's wrong with this expression :/
18:08
<@Vornicus-Latens>
What's Vertices look like, what's Size?
18:08
< Tarinaky>
Vertices is a list of tuples (It's a list of x-y coordinate pairs)
18:08
< Tarinaky>
Oh! I see what I've done wrong.
18:09 * Tarinaky forgot that Size was, itself, a tuple.
18:12 Zed [Zed@Nightstar-556ea8b5.or.comcast.net] has joined #code
18:12 Zed_ [Zed@Nightstar-556ea8b5.or.comcast.net] has joined #code
18:12 Zed [Zed@Nightstar-556ea8b5.or.comcast.net] has quit [Client closed the connection]
18:12 Zed_ [Zed@Nightstar-556ea8b5.or.comcast.net] has quit [Client closed the connection]
18:15 Vornicus-Latens is now known as Vornicus
18:21 * Tarinaky grumbles.
18:23
< Tarinaky>
I can't get it to stop drawing outside the bounds I'm setting :/
18:33
< Tarinaky>
Ahah!
18:44 jeroid [jerith@687AAB.5E3E50.15956C.9B280F] has joined #code
18:55 Attilla [Some.Dude@Nightstar-f1e933d1.threembb.co.uk] has quit [[NS] Quit: ]
19:01 Kaura|zzz is now known as Kaura
19:17
< Tarinaky>
http://tarinaky.pastebin.com/7jrEehJJ >.< What am I doing wrong?
19:19
< Tarinaky>
Ah. Nm.
19:20
< Tarinaky>
Figured it out.
19:20
< jeroid>
Range woes?
19:20
< Tarinaky>
Apparently you can't specify a tuple like that.
19:21 * Tarinaky changed it to a list and everything was (mostly) fine.
19:22
< Tarinaky>
It's not quite giving me the output I expected though.
19:23 * Tarinaky could really do with Vorn to check he has the right Matrix (and that I multiplied it correctly >.<)
19:42 Stalker [Z@3A600C.A966FF.5BF32D.8E7ABA] has joined #code
20:22
< Tarinaky>
Yeah. I'm not convinced the Matrix is right. :/
20:25
< Tarinaky>
Anyone know when I might be able to expect Vorn to be around?
20:28 jeroid [jerith@687AAB.5E3E50.15956C.9B280F] has quit [[NS] Quit: Bye]
20:41
<@Vornicus>
?
20:41
< Tarinaky>
Vornicus: Hi!
20:42
< Tarinaky>
I'm currently trying out that matrix you gave me for converting internal coordinates to display coordinates...
20:42
< Tarinaky>
It doesn't seem to be providing the expected output.
20:42
<@Vornicus>
okay. Have you plotted a dot for integer coordinates, and gotten an isometric-looking grid of dots? If not, then you're doing it wrong.
20:42
<@Vornicus>
and, ack, mom's here, time to go.
20:43
< Tarinaky>
I've been blitting hexagons instead.
20:43
<@Vornicus>
Ah. Try dots, it'll help more when fiddling matrices.
20:44
< Tarinaky>
Well... it sortof looks lopsided.
20:44
< Tarinaky>
I'd show you a screenshot but you're leaving.
20:45
< Tarinaky>
http://i52.tinypic.com/2i0evpf.png is what I get.
22:20 RichardBarrell [mycatverbs@Nightstar-3b2c2db2.bethere.co.uk] has joined #code
22:24
<@jerith>
Tarinaky: What does the current code look like?
22:25
< Tarinaky>
http://github.com/Tarinaky/coulomb/blob/demos/py/hex3.py
22:25
< Tarinaky>
on_draw is the important method.
22:37
<@Vornicus>
Tarinaky: change the order of the x and y in the second line.
22:37
<@Vornicus>
22 that is
22:37
< Tarinaky>
Vornicus: That's not what I've got on my notes on matrix multiplication >.<
22:38 * Tarinaky screenshots and uploads.
22:39
< Tarinaky>
http://i53.tinypic.com/25s4p5j.png
22:40
<@Vornicus>
They have to be in the same order on both lines.
22:41
< Tarinaky>
Vornicus: That's the screenshot with:
22:41
< Tarinaky>
Position = (x*math.sqrt(3)/2+y*3/2,
22:41
< Tarinaky>
x*math.sqrt(3)/2-y*3/2)
22:42
<@Vornicus>
That doesn't look right at all.
22:42
< Tarinaky>
That's what you just told me to do :/
22:43
<@Vornicus>
No, I mean, the hex grid doesn't look right at all.
22:43
<@Vornicus>
For one thing you should be getting horizontal and vertical lines of hexes.
22:43
< Tarinaky>
No kidding.
22:44 * Tarinaky doesn't quite understand what he's doing :/
22:45
<@Vornicus>
What are you plugging in for x and y?
22:46
< Tarinaky>
for y in range (1,10):
22:46
< Tarinaky>
for x in range (1,10):
22:46
<@Vornicus>
that's /very/ strange.
22:47
< Tarinaky>
I got a better grid when I had a go at the maths but I couldn't quite figure out what numbers I needed :/
22:47
< Tarinaky>
I had a zero in the top-right of the Matrix though.
22:47
< Tarinaky>
Which was why I was a little perplexed because it's totally different to the matrix you gave me >.<
22:49
<@jerith>
Tarinaky: Position = (x, x*math.sqrt(3)/2 + y*3/2)
22:50
< Tarinaky>
jerith: Bingo.
22:50
< Tarinaky>
What do I use for the 'scale'?
22:50
< Tarinaky>
To stop them overlapping?
22:50
< Tarinaky>
The size?
22:50
<@Vornicus>
That doesn't make sense iehter!
22:50
< Tarinaky>
Vornicus: That's closer to what I had.
22:51 * Vornicus fiddles. oh, it goes that direction, I see.
22:52
< Tarinaky>
http://i54.tinypic.com/6howue.png
22:53
<@Vornicus>
Your scaling then is sqrt(3)/2
22:54
< Tarinaky>
Vornicus: Doesn't seem so :/
22:54 Attilla [Some.Dude@Nightstar-d16971dc.threembb.co.uk] has joined #code
22:54 mode/#code [+o Attilla] by Reiver
22:54
<@Vornicus>
Gnah, it should be.
22:54
<@Vornicus>
wtf.
22:55
< Tarinaky>
With hexes of 32px wide by 32px high - the scale -seems- to be between 20 and 21/
22:55
< Tarinaky>
Trying it by trial and error :/
22:58
<@Vornicus>
try sqrt(3)*32 / 3
22:59
< Tarinaky>
-Bing-.
22:59
< Tarinaky>
Oh wait.
22:59
< Tarinaky>
:/
22:59
< Tarinaky>
It works in the y but not the x.
22:59
< Tarinaky>
Then again - my hexagons aren't regular.
23:00
<@jerith>
That would explain a lot.
23:01
< Tarinaky>
I forgot but I cropped them a little so they'd fill up a square.
23:01
< Tarinaky>
If that makes sense.
23:01
< Tarinaky>
Errr... not cropped.
23:01
< Tarinaky>
Squished.
23:01
<@jerith>
You stretched them.
23:02
<@jerith>
So now they aren't regular hexes and thus maths for regular hexes won't work.
23:02
< Tarinaky>
Yeah. Sorry >.<
23:02
< Tarinaky>
http://github.com/Tarinaky/coulomb/blob/demos/py/hexagon.py
23:03
< Tarinaky>
Vertices = [(a*(Size[0]-4)/2,b/math.sqrt(1.5)*(Size[1]-4)/2) for (a,b) in Vertices] # Scale << Here's the bit that's squishing them
23:04
< Tarinaky>
http://i56.tinypic.com/21ozsiw.png << Here's what they look like atm.
23:09
< Tarinaky>
If I blow them up they stop lining up though >.<
23:09
< Tarinaky>
I think I need to go back to the drawing board with this don't I?
23:13
<@jerith>
Position = (x, y*math.sqrt(3) + ((-1)**x)*math.sqrt(3)/4)
23:13
<@jerith>
Use a scale of 16 and don't squish the hexes.
23:14
<@jerith>
Vertices = [(a/math.sqrt(1.5)*(Size[0]-4)/2,b/math.sqrt(1.5)*(Size[1]-4)/2) for (a,b) in Vertices] # Scale
23:14
< Tarinaky>
The problem is, if I don't squish the hexes they don't draw properly. :/
23:15
<@jerith>
Squish them equally in both directions, then.
23:16
< Tarinaky>
I'm going to have another crack at this tomorrow.
23:17
< Tarinaky>
Try and do the maths myself in the hopes it works out better >.<
23:18
<@jerith>
http://i51.tinypic.com/mh7zid.png
23:18
<@jerith>
I'm way too tired to check the maths, but that's what I get.
23:19
<@jerith>
Mostly trial and error once I fixed the shape of the hexes.
23:21
<@jerith>
Position = (x, y*math.sqrt(3) + x*math.sqrt(3)/2)
23:21
<@jerith>
That one if you want the rhomboid rather than the squarish layout.
23:22
<@jerith>
But it's past sleeptime now.
23:22
<@jerith>
G'night.
23:23
< Tarinaky>
Night.
23:33 Kazriko [kaz@Nightstar-e09690fa.client.bresnan.net] has quit [Ping timeout: 121 seconds]
23:35 celticminstrel [celticminstre@Nightstar-f8b608eb.cable.rogers.com] has quit [[NS] Quit: And lo! The computer falls into a deep sleep, to awake again some other day!]
23:41 Kazriko [kaz@Nightstar-e09690fa.client.bresnan.net] has joined #code
23:41 mode/#code [+o Kazriko] by Reiver
23:53 cpux[undead] [chatzilla@Nightstar-c978de34.dyn.optonline.net] has joined #code
23:53 cpux[undead] is now known as cpux
23:58
< Tarinaky>
I think I have the figures for getting tesselation working.
--- Log closed Tue Oct 12 00:00:17 2010
code logs -> 2010 -> Mon, 11 Oct 2010< code.20101010.log - code.20101012.log >