code logs -> 2011 -> Tue, 18 Oct 2011< code.20111017.log - code.20111019.log >
--- Log opened Tue Oct 18 00:01:00 2011
00:01 Derakon [chriswei@Nightstar-f68d7eb4.ca.comcast.net] has quit [[NS] Quit: leaving]
00:19 Stalker [Z@Nightstar-5aa18eaf.balk.dk] has quit [[NS] Quit: If the world didn't suck, we'd all fall off.]
00:45 You're now known as TheWatcher[T-2]
00:51
< celticminstrel>
...why isn't there a PI in <cmath>...
00:54 You're now known as TheWatcher[zZzZ]
00:54
< celticminstrel>
Okay, so I can rotate this thing, but it's rotating too fast to be useful.
00:54
< gnolam>
There's M_PI.
00:54
< gnolam>
But it's not actually standard.
00:54
< gnolam>
(Even if it exists in... well, all the relevant compilers.)
00:54
< celticminstrel>
I need a good ratio for transforming mouse motion into rotation angle.
00:54
< gnolam>
"good ratio"?
00:54
< celticminstrel>
Does "all the relevant compilers" include MinGW?
00:55
< celticminstrel>
Well, currently my angle is being updated like this (maybe it's incredibly stupid, I dunno):
00:55
< celticminstrel>
theta += hypot(xdown - x,ydown - y) * (3.141592 / 180);
00:55
< celticminstrel>
In response to mouse motion (xdown and ydown are set when the mouse button is depressed).
00:56
< celticminstrel>
Which if I recall correctly takes the distance the mouse moved as degrees.
00:56
< celticminstrel>
A distance which is measured in pixels.
00:58<~Vornicus> I don't see how hypot gets you an angle?
00:58
< gnolam>
atan2().
00:58
< celticminstrel>
I was using the distance as an angle...
00:59
< celticminstrel>
Oh hey, atan2 works.
00:59<~Vornicus> Why would the distance be an angle?
00:59
< gnolam>
Either track a single direction's offset from button down to button up, or create a virtual reference point (a certain distance away backwards from the current angle of the rotating object) upon button down.
01:00
< celticminstrel>
Not sure what that second one means.
01:00
< celticminstrel>
Also it seems that my rotation around y or x axis is broken.
01:01
< celticminstrel>
I did think it looked a bit off when I tested it statically...
01:01
< celticminstrel>
And with rotating around z it's still too fast even with atan2. :/
01:02<~Vornicus> Then divide it by like 100
01:03
< celticminstrel>
Oh wait, maybe it's because I didn't remove multiplying by pi/180.
01:03
< celticminstrel>
Duh.
01:05
< celticminstrel>
Okay, only thing left to do is to make the direction of the mouse matter, but that can wait until later.
01:05
< celticminstrel>
Need to figure out why the other rotations failed. Maybe I got x/y and z mixed up.
01:06
< celticminstrel>
...no, neither works. :(
01:07
< celticminstrel>
(For reference, the goal here is basically drawing a cube and transforming it in nearly every possibly way.)
01:08 Attilla [Some.Dude@Nightstar-f29f718d.cable.virginmedia.com] has quit [Ping timeout: 121 seconds]
01:11<~Vornicus> Oh I see what you really want
01:13<~Vornicus> You want to use hypot(delta mouse) as your angle of rotation and vcross(delta mouse, +z) as your axis of rotation.
01:13
< celticminstrel>
...vcross?
01:14<~Vornicus> vector crtoss product
01:14
< celticminstrel>
That's not in the standard library is it?
01:14<~Vornicus> In 3 dimensions, produces a vector perpendicular to the two input vectors.
01:15
< celticminstrel>
Currently I'm just picking one axis to rotate and rebuilding each time, though.
01:15<~Vornicus> No, you'll have to build your own. But you need to anyway to get your rotation to work
01:15
< celticminstrel>
And z appears to work, but the other two look strange.
01:15
< celticminstrel>
As in, not like a cube at all.
01:16
< celticminstrel>
What does +z mean in your formula?
01:16<~Vornicus> +z means "into the screen"
01:16
< celticminstrel>
Unit vector?
01:16<~Vornicus> yeah, the unit vector into the screen
01:17<~Vornicus> ANd then you normalize your vcross outputs and you'll have your axis of rotation according to the screen.
01:22
< celticminstrel>
The cross product seems to give (y, -x, 0).
01:22
< celticminstrel>
If I did this correctly.
01:30<~Vornicus> Yes, that it will do.
01:31<~Vornicus> Note: if you're rotating the camera instead of the cube (this is a common thing) you replace +z with the direction the camera is actually facing
01:31
< celticminstrel>
Is this why the rotate functions take a vector? I didn't really understand that part.
01:32<~Vornicus> A rotate function that takes a vector and an angle will rotate the object by the angle, using the vector as the axis of rotation.
01:58
< celticminstrel>
Okay, fixed my x and y axis rotations.
02:04 Reivles [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
02:07
< celticminstrel>
...does projection just amount to zeroing one component?
02:09
< gnolam>
... no
02:10 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
02:16
< celticminstrel>
eg "project (x,y,z) onto the xy plane" gives (x,y,0).
02:17
< celticminstrel>
?
02:23 Kindamoody[zZz] is now known as Kindamoody
02:26
< McMartin>
That, yes.
02:26
< McMartin>
But only because everything interesting cancels out in that case.
02:27
< McMartin>
But one can project onto arbitrary planes, not just one that's flat and goes through the origin.
02:30
< celticminstrel>
...I hadn't thought of that. <_<
03:03 Derakon[AFK] is now known as Derakon
03:04 * McMartin - having reimaged his work machine - heads home.
03:04
< McMartin>
celticminstrel: One of the more important planes that gets projected against is the surface of the screen. ;-)
03:05
< McMartin>
OpenGL's "Projection matrix" kinda represents that.
03:07
< celticminstrel>
Well, right now I'm just trying to compute a transformation matrix for an arbitrary rotation. It's not working.
03:07
< celticminstrel>
...maybe I'm doing the whole thing backwards.
03:08
< celticminstrel>
Nope, nothing that simple.
03:39
< Derakon>
Dammit, Dungeons of Dredmor has me wanting to make my own for-pay roguelike.
03:39
< Derakon>
This is clearly a terrible idea.
03:45 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
03:47 gnolam [lenin@Nightstar-202a5047.priv.bahnhof.se] has quit [[NS] Quit: Z?]
03:49 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
03:55 Vash [Vash@Nightstar-f03c5637.sd.cox.net] has joined #code
03:56
< McMartin>
celticminstrel: Remember that rotation matrices interact oddly when you compose them, since rotation is about the origin at the point in time of the rotation.
03:57
< McMartin>
So rotating something that's out there in space requires it to be translated to the origin first, then rotated, then put back.
03:57
< McMartin>
(Or, all objects start at the origin, are oriented, then placed)
03:57
< celticminstrel>
Well, I'm following the instructions in the textbook which do mention that...
03:58
< McMartin>
OK
03:59
< celticminstrel>
It's probably something being lost in translation to code.
04:00
< celticminstrel>
But basically I translate, rotate around x and y, rotate around z, reverse the rotations around x and y, and reverse the translation. In theory.
04:01
< McMartin>
Mrn.
04:01<~Vornicus> Hooray, Forward Kinematics
04:01
< McMartin>
If it were me - and I weren't coding to an assignment spec - I'd actually skip most of those and just store the intended rotations elsewhere, recomputing the matrix from scratch.
04:01
< McMartin>
So that the initial setup is always "drawing at 0,0,0, unrotated"
04:01
< McMartin>
"Now rotate at z"
04:01
< McMartin>
"Now put on the x and y rotations"
04:02
< McMartin>
"Now translate it to where it should go"
04:03
< Derakon>
So basically you want to do T * R_xy * R_z * R_xy(-1) * T(-1)?
04:03
< Derakon>
Where (-1) means "inverse"?
04:03
< McMartin>
I think the goal - if I read the backscroll right - is "I want to put a rotation on this thing's local z-axis, in place."
04:05
< McMartin>
And given all the talk of inverses, it also sounds like the model itself is not intrinsically centered on (0,0,0).
04:07
< celticminstrel>
Derakon: That is what I'm doing.
04:08
< celticminstrel>
...the textbook swaps the inverses with the non-inverses though.
04:08
< McMartin>
Mmm
04:08
< McMartin>
Yeah, that sounds very much like it assumes you're rotating something that's "already been placed" out there.
04:08
< McMartin>
Rotating about a point that isn't the origin, basically.
04:09
< celticminstrel>
Yeah.
04:09
< McMartin>
My solution for that for Sable was "never do this" >_>
04:09
< celticminstrel>
XD
04:09
< Derakon>
Heh.
04:09
< McMartin>
(Sable, for those who haven't seen it: https://hkn.eecs.berkeley.edu/~mcmartin/sable/ )
04:10
< McMartin>
My old student project for Graphics class.
04:10
< celticminstrel>
Heh, his sample code uses new needlessly.
04:10
< celticminstrel>
Matrix* m = new Matrix(); /* do stuff with m */ delete m;
04:11
< Derakon>
And nothing derived from m is used?
04:12
< McMartin>
Even if it were, "new Matrix()" in the same scope fixes the type.
04:12
< McMartin>
That's not a factory method.
04:12
< McMartin>
(My guess: he's more used to Java than C++)
04:12
< celticminstrel>
Yeah, that seems like a good guess.
04:13
< Derakon>
Oh right, he could've just used a Matrix instead of a Matrix*.
04:13
< celticminstrel>
Yeah.
04:13
< Derakon>
Sorry, as I may have mentioned awhile back my C is really rusty.
04:14
< celticminstrel>
Matrix m; /* do stuff with m */
04:14
< celticminstrel>
No need to delete.
04:14
< McMartin>
Also guaranteed leak-free, also ensures the destructor is run no matter how you leave the function.
04:14
< Derakon>
Yeah.
04:14
< McMartin>
Precise destructors - the thing I miss most in Java.
04:15
< McMartin>
Though really, C#'s IDisposable interface is better still.
04:15
< McMartin>
Since it can be tasked with arbitrary method pairing.
04:15
< McMartin>
C++'s "Boost" library includes some preprocessor jackassery to let you set a block of code to run on scope exit with the BOOST_SCOPE_EXIT macro, but.
04:20
< celticminstrel>
I think I did that sort of thing once by using boost's smart pointers with a custom something... deleter or whatever.
04:20
< McMartin>
Yup
04:20
< McMartin>
That's basically what BOOST_SCOPE_EXIT does.
04:20
< McMartin>
(For windows dev, CloseHandle is a classic)
04:20
< celticminstrel>
This was for SDL things.
04:22
< celticminstrel>
So the cube looks okay when the rotation angle is 0, though it's in the wrong place, but as soon as I change the angle it disappears entirely.
04:22
< celticminstrel>
Probably out of the viewport or something.
04:22 Stalker [Z@Nightstar-3602cf5a.cust.comxnet.dk] has joined #code
04:22
< Derakon>
Yeah, shrink your translation down a bunch.
04:22
< celticminstrel>
Hm.
04:24
< celticminstrel>
The translation vector is also the axis of rotation, according to the textbook (unless I misread).
04:25
< Derakon>
Okay, sure, but shrink the magnitude of translation down so the object stays in view.
04:26
< celticminstrel>
Unit-vectorize it?
04:26
< Derakon>
Uh, sure. Or even less.
04:26
< Derakon>
Translation in a 4D matrix is the rightmost column, yes? So just put in, like, .1 for your translation
04:28
< celticminstrel>
The translation is being undone at the end though, I don't understand why this is even making a difference at all...
04:29
< Derakon>
Because you have your order of operations wrong or something.
04:29
< Derakon>
And the translation is the most likely transform to make the cube disappear.
04:29
< celticminstrel>
Huh, apparently it's translating only, no rotation.
04:29
< Derakon>
So you shrink down your transforms until you can see what's happening to the cube.
04:31
< Derakon>
Also remember that translating an object to <1, 0> and then rotating it 90? is equivalent to rotating 90? and then translation to <0, 1>. So "translating only" might actually be "rotating after translating".
04:31
< Derakon>
This is the kind of thing I internalized when I learned to use POV-Ray.
04:34
< celticminstrel>
I am currently trying to decode that last sentence.
04:34<~Vornicus> WHenever sane, do your transformations in the order Scale Rotate Translate
04:34
< celticminstrel>
...the textbook says I need to translate to origin to do the rotations, though.
04:35
< Derakon>
CM: okay, so, the center of rotation is always the origin.
04:35
< Derakon>
So if your cube is sitting at <1, 0>, imagine it as a cube that is tied by an invisible rope to the origin.
04:35
< Derakon>
Rotating holds the endpoint at the origin fixed and moves the cube.
04:35
< McMartin>
And then rotating is swinging it on that rope.
04:35
< celticminstrel>
Right.
04:36 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
04:36
< Derakon>
So unless your cube is already at the origin, rotating is actually rotating and translating.
04:36
< McMartin>
You can play awesome, sanity-blasting games with this to simulate sun/earth/moon systems, but, seriously, don't -_-
04:36
< Derakon>
Heh.
04:36 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
04:36
< celticminstrel>
Are you saying that instead of moving it to the origin, rotating it, and moving it back, that I can rotate it first, then move it back to where it started?
04:37
< Derakon>
Uh, theoretically.
04:37
< Derakon>
But calculating the "move it back" would be hairy.
04:37
< celticminstrel>
That's what I thought, yeah.
04:38<~Vornicus> Really it goes like this: 1. translate object so its center of rotation is at the origin. 2. scale. 3. rotate. 4. translate object to desired location
04:39
< Derakon>
(Also, scaling uses the same "tied to the origin" thing -- when you scale, the length of the rope changes too)
04:40<~Vornicus> YOu can do all this with matrix multiplications but I don't remember which direction they go when you do that.
04:40
< celticminstrel>
Oh wait. The translation vector I'm using isn't what my textbook tells me to use.
04:40
< Derakon>
Whups!
04:40
< celticminstrel>
That makes more sense.
04:40
< Derakon>
http://en.wikipedia.org/wiki/Transformation_matrix has a bit on composing transformations.
04:41
< celticminstrel>
I was thinking it was a bit odd for the translation vector to be the same as the axis of rotation vector. <_<
04:41
< Derakon>
If you want to do transform A followed by transform B then you want BA.
04:41
< Derakon>
In other words, the transform closest to the object happens first.
04:41
< Derakon>
(BA * x, where x is the object; A happens first, then B)
04:41
< celticminstrel>
I... think that's what I'm doing.
04:42
< celticminstrel>
At least, the translate/scale/rotate commands all return "trans_matrix * *this".
04:42
< celticminstrel>
Then I think I'm calling them in the order I want them to happen.
04:42 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
04:43 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
04:49 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
04:50 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
05:08 kwsn is now known as kw-sleep-n
05:37
< celticminstrel>
...oh wow. I thought I was chaining the transformations, but instead I was just overwriting the previous one with each successive one.
05:37
< celticminstrel>
So only the last one took effect.
05:37
< Derakon>
Hee.
05:38
< celticminstrel>
Now I'm getting nans.
05:38
< celticminstrel>
So clearly I'm doing something very wrong.
05:53
< celticminstrel>
Oh apparently I have 0/0.
05:53
< celticminstrel>
On second thoughts, my input isn't what I was treating it as.
05:59
< Derakon>
Make certain you start with the identity matrix. :)
05:59 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
06:02
< celticminstrel>
Yeah, that's not the issue. It's calculating the cosine and sine of the x-axis component of the angle from the vector of the rotation axis that gives a nan. I'm not actually calling cos or sin; I'm using the formula from the text book which is basically the z component of the projected vector divided by its magnitude... both of which end up being zero.
06:03
< celticminstrel>
(And for sine, the y component instead of the z.)
06:03
< celticminstrel>
(The actual vector is (1,0,0).)
06:08
< celticminstrel>
(Because I haven't gotten to the point where it changes, yet.)
06:08 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
06:20 Derakon is now known as Derakon[AFK]
06:31 celticminstrel [celticminst@Nightstar-5d22ab1d.cable.rogers.com] has quit [Connection closed]
06:32 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
06:34 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
07:49 Rhamphoryncus [rhamph@Nightstar-14eb6405.abhsia.telus.net] has quit [Client exited]
07:55 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
07:56 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
08:06 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
08:11 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
08:15 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
08:15 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
09:09 Kindamoody is now known as Kindamoody|out
09:18 You're now known as TheWatcher
09:32 Vash [Vash@Nightstar-f03c5637.sd.cox.net] has quit [[NS] Quit: I <3Lovecraft<3 Vorn!]
10:14 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
10:15 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
10:20 AnnoDomini [annodomini@Nightstar-2a577c2d.58.getinternet.no] has joined #code
10:20 AnnoDomini [annodomini@Nightstar-2a577c2d.58.getinternet.no] has quit [[NS] Quit: leaving]
10:21 AnnoDomini [annodomini@FFB3F3.4C5BE8.2014E2.DC0864] has joined #code
10:43 Attilla [Some.Dude@Nightstar-f29f718d.cable.virginmedia.com] has joined #code
11:27 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
11:27 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
11:36 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
11:38 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
11:41 gnolam [lenin@Nightstar-202a5047.priv.bahnhof.se] has joined #code
12:15 AnnoDomini [annodomini@FFB3F3.4C5BE8.2014E2.DC0864] has quit [[NS] Quit: leaving]
13:13 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
13:15 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
13:31 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
13:35 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
14:36 kw-sleep-n is now known as kwsn
15:07 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
15:13 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
16:12 Kindamoody|out is now known as Kindamoody
16:58 Rhamphoryncus [rhamph@Nightstar-14eb6405.abhsia.telus.net] has joined #code
17:20 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
17:25 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
18:15 Kazriko [kazrikna@4CA975.462904.08E9A2.992A2D] has quit [Ping timeout: 121 seconds]
18:44 Kazriko [kazrikna@4CA975.462904.08E9A2.992A2D] has joined #code
18:47 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
18:52 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
19:02 Rhamphoryncus [rhamph@Nightstar-14eb6405.abhsia.telus.net] has quit [Ping timeout: 121 seconds]
19:02 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
19:08 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
19:12 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
19:14 Rhamphoryncus [rhamph@Nightstar-14eb6405.abhsia.telus.net] has joined #code
19:14 Kindamoody is now known as Kindamoody[zZz]
19:16 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
19:19 Reivles [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
19:20 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
19:27 Derakon [chriswei@Nightstar-f68d7eb4.ca.comcast.net] has joined #code
19:28 Reivles [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
19:28 * Derakon mutters at pattern matching.
19:28
< Derakon>
I want to grab everything up to the first instance of either "_t\d+" or "_p\d+".
19:29
< Derakon>
Something like "(.*)[_t|_p]" will bypass the first one (e.g. it will grab out "foo_t" from "foo_t5_p4".
19:29
< Derakon>
Er. It will grab "foo_t5".
19:32 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
19:36 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
19:39 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
19:53
< Simon_Shine>
Derakon, /(.*?)(?=_[tp]\d+)/
19:53
< Simon_Shine>
Derakon, .*? is lazy so it tries to match as little as possible, and (?=...) is a look-ahead, so the regex pattern doesn't eat it.
19:54
< Simon_Shine>
Derakon, it's not a particularly efficient pattern.
19:54
< Derakon>
Nifty, thanks.
19:55
< Derakon>
It doesn't have to be hugely efficient; I'm only doing this once per file and there's never going to be more than maybe a few hundred files.
19:55
< Derakon>
What I was missing was the lookahead.
19:57 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
19:57
< Simon_Shine>
not really. /(.*?)[_tp]\d+/ would work so long as you only fetch the back-reference
19:58
< Simon_Shine>
I think it's the lazy quantifier that was missing.
19:59
< Derakon>
I knew about .*? but had trouble getting it to be the precise amount of lazy I needed. :)
19:59
< Simon_Shine>
ahh
19:59
< Simon_Shine>
it's "as greedy as it needs to be"
19:59
< Derakon>
Yeah.
20:00
< Simon_Shine>
if (something)*? *can* match, it will. if it can match in several ways, it will just return the first match.
20:00
< Derakon>
Right, what I was having trouble with was keeping it from finishing its match until it had grabbed the entire bit I wanted.
20:01
< Derakon>
E.g. with a string of abc_def_t01_p05 I kept getting "abc" as my match.
20:03 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
20:07 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
20:08 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
20:53 * Derakon snerks at this comment on an article discussing the possibility that the universe has a significant nonzero angular momentum (i.e. it's spinning).
20:54
< Derakon>
The comment suggests that perhaps the astronomer missed a single proton somewhere rotating at immense speed...
20:54
< Derakon>
Or rather, counter-rotating.
21:08 celticminstrel [celticminst@Nightstar-5d22ab1d.cable.rogers.com] has joined #code
21:35 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
21:40 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
21:44 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
21:46 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
21:50 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
21:51 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
21:55 McMartin [mcmartin@Nightstar-a47b9f7a.pltn13.sbcglobal.net] has quit [[NS] Quit: upgrade]
21:58 McMartin [mcmartin@Nightstar-a47b9f7a.pltn13.sbcglobal.net] has joined #code
22:02 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
22:03 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
22:07 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
22:08 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
22:42 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
22:42 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
22:48
< Rhamphoryncus>
Anybody know why a programming vector is called that? Is there some relation to the math vector that I'm not seeing?
22:50
< Derakon>
Probably because array was already taken and matrix implies at least two dimensoins.
22:50
< Derakon>
Er, dimensions.
22:52
< Rhamphoryncus>
But a vector is a specific structure that might be implemented using a tuple. How does that become more generic than a tuple?
22:54
< Rhamphoryncus>
http://stackoverflow.com/questions/581426/why-is-a-c-vector-called-a-vector
22:54
< Derakon>
Er, wait, are we talking about the C++ STL object or something else?
22:55
< Derakon>
Okay.
22:55
< Rhamphoryncus>
Says the math vector is fucking multidimensional
22:55
< Rhamphoryncus>
Like.. arbitrary number of dimensions
22:55
< Rhamphoryncus>
Thus an arbitrary amount of data
22:55
< Derakon>
Well, a mathematical vector is a single offset in any number of dimensions.
22:56
< Derakon>
A.k.a. [x, y, z] is a 3D vector.
22:56
< Derakon>
s/A.k.a./e.g./
22:56
< Derakon>
Note also the 40-point answer on that page.
22:57
< Rhamphoryncus>
heh
22:57
< Rhamphoryncus>
Precisely backwards with array. Awesome.
23:00
< Rhamphoryncus>
So when it comes to designing my own language I should stay the fuck away from the term "vector"
23:00
< Derakon>
Hell, avoid keywords altogether~
23:00
< Derakon>
Make every bit of syntax a number or symbol!
23:02
< Rhamphoryncus>
? ftw?
23:02
< Namegduf>
There aren't enough numbers and/or symbols for C++
23:02
< Namegduf>
Unless you get into Unicode, I guess
23:02
< Rhamphoryncus>
wait, I guess ? is preferred
23:03
< Rhamphoryncus>
just a little hard to type. ctrl-shift-u 3 b b
23:03
< Rhamphoryncus>
oops. ctrl-shift-u 3 b b space
23:03
< Derakon>
Which one is that?
23:03
< Derakon>
Oh, lambda.
23:04
< McMartin>
Derakon: Are you remaking APL here?
23:04
< Derakon>
What? No. That's Rhamph.
23:04
< McMartin>
15:00 < Derakon> Make every bit of syntax a number or symbol!
23:04
< Derakon>
Assuming he listens to me, which he shouldn't.
23:05
< Rhamphoryncus>
I'm the nutjob making the language
23:05
< Rhamphoryncus>
Derakon is just giving "helpful" suggestions
23:05
< Derakon>
(As soon as I figure out that someone knows what they're doing, I switch from giving good advice to giving terrible advice)
23:05
< Rhamphoryncus>
heh
23:05
< McMartin>
Seriously, though, check out APL
23:05
< McMartin>
It is hilarious madness
23:06
< McMartin>
Especially since it also hails from the era when ASCII wasn't even all 7 bits all the time.
23:06
< Rhamphoryncus>
Ironically the original APL would have worked better since it would have had a special keyboard
23:06
< Rhamphoryncus>
vs that ctrl-shift-u 3 b b space madness
23:06
< Rhamphoryncus>
that wasn't ASCII ;)
23:14 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has quit [Ping timeout: 121 seconds]
23:19
< celticminstrel>
If it were my choice, I would've called std::vector "array" or something based on that word (maybe dynarray?).
23:20 celticminstrel is now known as celmin|away
23:21 Reiver [orthianz@3CF3A5.E1CD01.C6689C.33956A] has joined #code
23:23
< Rhamphoryncus>
You're in luck, new C++ will have another type with array in the name ;)
23:24
< Rhamphoryncus>
std::array
23:24
< Derakon>
Dynnari?
23:24
< Rhamphoryncus>
of course it's static size too
23:41 Derakon [chriswei@Nightstar-f68d7eb4.ca.comcast.net] has quit [[NS] Quit: leaving]
23:43
< celmin|away>
Yeah, but std::array is just a wrapper for native arrays.
23:43 celmin|away is now known as celticminstrel
--- Log closed Wed Oct 19 00:00:14 2011
code logs -> 2011 -> Tue, 18 Oct 2011< code.20111017.log - code.20111019.log >

[ Latest log file ]