Member of The Internet Defense League

Total Pageviews

Sunday, November 28, 2010

Taylor Swift and Transporter - A vacation's end

11/28/10
Well, I'm inspired to write this entry, even though I don't have internet so it's just on  a wordpad document, it's good enough.

I bought the new Taylor Swift album today, as well as a Us edition full of her. I admit, I have a week spot for female singers. I don't know why, but I just find girls who can sing to be more desirable than others who can't. It's not even in a sexual way, although female singers seem to normally be very attractive. I just find the female voice to be attractive, more so than any others. I think in a mate, boy or girl, I find the voice to be the sexiest, the most attractive part of them.

It's probably why I fell in love with Britney Spears when I was young, her voice was so cute! Or the song "Ring My Bell", I heard it for the first time in years on a throwback part of a radio show. It's why I loved Miley Cyrus's early albums as Hannah Montana and as Herself. It was the voice, the interesting quirks in them and everything about it all. I love Muse's signer Mathew Bellamy because his voice is amazing. He can hit all those notes I love in a female voice, but also the lower ones with his smexy voice. And not too mention his lovely accent. And thinking along the lines of the brits, Lily Allen's voice is fantastic in that regard as well.
So no surprise I'd find Taylor Swift's voice so enticing to listen to, even if I generally have headphones or close my door if I'm going to be listening to her loudly. Pathetic I know, feeling odd about being rediculed about my taste in music. I mean, I listen to everything from Death Metal to Girl Pop and Country. It's rediculous. But whatever. My taste is a mess of dualities and contradictions. Not to mention just sheer oddity. For example, at this current moment. I'm listening to Taylor Swift's new album, Speak Now, and watching Transporter Two. Weird mix? Yeah I know. I was going to watch Boondock Saints, but my parent's onDemand MA controls prevented that. Which is crap, considering I'm in college and they have a lock on all MA material.

But anyway, tonight is actually the last night I'll sleep in my own bed before going back to school. So I suppose I should take comfort in it. Although I was just starting to get used to not having to do anything, and spending time with my friends. Sometimes when I'm on campus I wonder about how my friends are, and if I care as much about them as I think I do. I realize I do, but it just takes time to adjust. Some of them are the only people in the world who I can be myself with. Making stupid noises just to make stupid noises, not caring what people around us think when we do silly things in public places. Our combined horrible sense of humor, that would insult and offend any person who has any moral compass. Not to say we're terrible people, but most people don't understand a lot of things we say are jokes, and really shouldn't be taken seriously.
So yeah, I love just being able to talk to my friends about life. And the thing's I've failed to do, and the thing's they've failed to do. But we don't just focus on the bad things, those are just normally the things we talk about first. And once we've got our heads cleared, we can move on to the important things, the happy things. The thoughts we should be dwelling on. I have a really bad habit of remmbering my first girlfriend. We broke up on bad terms, and I've never really reconciled with her. She's the reason I don't continue being friends with girls I date. If break up, then we're through completely. I don't want to be friends, and I don't want to meet you ever again. Because that's the way I can deal. It's mean, I understand that sometimes people get hurt, especially when they've invested a lot in your friendship. But, that's the way it is.  And, I mean, I could change, I could try to be friends with an ex or something like that. But, I don't think I can, or want to change like that. It's easier for me this way. I can just move past and never think about the people I've hurt. Easier for me, harder for them I suppose. Though I guess, it's not as easy as I'd like to because I'll always be thinking about the one who made me this way.

Never give your heart to someone so completely that they can truly hurt you. When you let someone into your heart, you can never really get them back out. You can try to forget them, but there will always be reminders. And unfortunately for me, a lot of things in my life are associated with her, simple gestures, dance moves, phrases, inside jokes between multiple friends, foods, everything and anything. Even some numbers. It's rediculous how invested I was in her. I was so convinced and so stupid. Maybe that's why I generally tell my friends, half jokingly, that I'm a cold hearted bastard. Because I guess I am sometimes.

Anyway, so I've officially listened to Speak Now all the way through, and I'm at the point where the main character of the transporter is giving the vaccine to the boy, and showing it to the mother and such. Good stuff. I should probably go to bed soon. I'm getting up early to drive back to school. So I should sleep one more time in my bed. It's odd how much more comfortable my bed at home is than my dorm bed. But it's not even really the bed itself, because my home bed is smaller in length. But it's the blankets. The way they add the pressure and press down on me. And my pillow is nice and fluffy, but it's a big square pillow from Germany, from my grandmother. I love it all.

So now that I've drifted off track... 3 times or so I think in this entry. My main point, is how bizarre my taste in music is, and how it's reflected throughout my life in general. I love Rammstein and Taylor Swift in the same playlist. I love mixing foods that probably shouldn't be mixed (I.E. Cheesecake and Crab Rangoon ). I love watching Action movies and Sappy Romances back to back. I love reading a good book, but would just as readily play soccer or video games. I like the simple things in life, but it's the complex ideas that can stimulate my neurons really well too. I have friends who hate each other and are directly opposed to each other even though they have the exact same interests.

I used to wake up at 5 am to go to school and sit with a girl who had to get dropped off early becuase she had family issues, because I was crushing on her bad. And now, I go to bed at 5 am sometimes, but always at least at 3am. I used to wonder how my brother could sleep til 2pm. But now, I do it all the time. It's odd don't you think? I hate how texting removes the contact of the voice between people, but for people I'm romanticly interested in, texting is easier for me becuse I can think for a while before my responses. It's like slow motion life.

Well, I think I'm going to go to bed, or rather, brush my teeth and wash my face then go read my book about Quantum Mechanics. If only I had an mp3 player, then I could listen to music as well. Is it weird I like to do at least 3 things at a time most of the time? Watch a movie, listen to music, and write an entry for example? Play guitar, listen to a playlist or two, and study for a test. Or sometimes more than 3 things, like eat a meal, hold a conversation on the phone, read a book, and figure out my plans for the next week and write them in my planner. I like being busy. If I'm not busy, I get bored (makes sense right?) and when I get bored I'm not very productive. I love to learn new things.

This movie, Transporter 2, reminds me of my friend who goes to Hawaii for school. Because she lent me the movie, 4 years ago. I miss those times. Goodnight.

Tuesday, November 16, 2010

Node Box Transformations

Well hello again everybody! So I got to Wikipedia browsing, ended up in Artificial intelligence, and found something called Scene Graphs. Which are basically giant linked list structures, much like what I used before in various programs. I had no idea they had a name! Where you basically have a grid of linked structures, and those nodes point to things that are instantiated. While I always had them stored in arrays. My ideas were similar. But to represent an entire graph as a bunch of linked nodes never occurred to me as something that would be efficient at all!

3x3 Node box
So I got to thinking how I could use this type of structure. And decided to have a box, that could take inputs and translate them into box movements. As you can see in the picture to the right. It's pretty simple looking. Now obviously, when you apply force to the middle node on any side, it should shift the entire box if the force is sufficient. But, when you apply force to any of the corners of the box. Then, as my friend pointed out, the box should rotate. Right?

A corner node
Unfortunately, this complicates my coding quite a bit. At first I thought to try to use the fact that the angle between corner nodes and their adjacent nodes should be 90 degrees, or 180,270,360. Whichever one was necessary for the corner. But, I couldn't find, or remember how to get the angle between two lines easily. Without using dot notation for vectors, which I didn't want to do at all. So it was back to the thinking board for a bit.



Translating rotation
 to adjacent nodes
Luckily for me, as I was drawing out right triangles and trying to find some relationship. My brain clicked and got the image to the right. The red lines are how much the node moves in x coordinates, and then on the bottom part of the image, that same amount is translated to it's adjacent nodes! I'm not sure if this identity is completely true. But eyeballing objects that I moved in experimentation, And drawing out triangles with a ruler seem to confirm it. Observations were good enough for old school physicists, so I'm going with them on this one!

So I've been coding this bad boy up, and have reached the point where I have my node's behavior coded in. Though I have yet to actually test it and create a node box. Once I do that, then hopefully, I won't have to rework too much code. The overall goal of this little project is to create swarm-like AI structures that will attempt to push a block from one location to another, but they have to have enough of themselves pushing in the right directions to move the box. Their mass and force, must be greater than the inertial mass of the box itself. If they're not enough swarm-creatures to push the box, they can breed to make more.

It's very very basic AI coding with an implementation of an odd node box. This should be interesting! Maybe if it's easier than I think it will be, I can rig up some directX code to display a box going through what the node box is having done to it.  

Monday, November 15, 2010

2:00 am Swifts

Just another day in the life of a college student. Albeit not a typical one. Honestly, could I be any more non-average. And not in a good way. Sigh.

It's 2am and I'm sitting in the lounge of my dorm after just having finished some language homework. I'm not in my room because my roommate and I had a bit of a tiff a few days ago about my sleeping habits. Basically, he was in a poor mood and couldn't get to sleep because my laptop's fans were too loud and my mouse was clicking very loudly a million times a minute apparently. He left me an angry note about it. I basically didn't talk to him and avoided being in the room for a day and took a nap around 11pm so I was in bed when he came in. That way he would have to deal with trying to be quiet when things out of your control are in control.

We made up over some ridiculous Indian action movies and music video mistranslations. Which was pretty amusing. He admitted to being harsh and I told him if I'm bothering him to tell me to get the hell out so he can sleep. It's not like I'll take it the wrong way, we all need sleep and if something is disturbing us, deal with it. Don't lie around hoping it will go away. Because most of the time, it won't. Sad but true, I know. Time might heal all wounds, but you can generally fix things if you face them directly when they're relevant.

Anyway, so that's why I'm not in my room. Because I'm trying to make sure the kid get's to sleep without me bugging him too much. So I'm sitting on a couch listening to Taylor Swift through some headphones. I did my homework, and now I'm just talking to a friend. Which is kinda calming. But at the same time, talking to her about all the stuff she has had to deal with, it can't help but make me feel like my college experience has been pretty slow. I don't party really. Last week I got very drunk with a few friends, but before that I had never blacked out, or been very drunk in my life. And the only other party-ish experience I've had this year has been a house party with a friend. And I didn't really have too much fun there anyway so it kinda set a sour tone for everything.

I really want to have one of those typical college lives. You know, party with some friends and stuff, meet a girl, fall in love, be stable for a bit, fallout with each other, repeat the cycle until you don't fallout anymore. You know, get the college sweetheart that everybody wants. I know, I know, it's a bit lame. Wanting that typical naive dream. But I can't help it. Especially when I hear about my friend's relationships, and how she almost always seems to have someone falling for her.

Like, she's not really finding her soul mate, but at least she's narrowing the search. Which is more than I can say for myself. I mean, I've had two girlfriends in my life. One a long term relationship, and the other a bit of a poor choice and was just a wrong decision overall. There was also, a fling with one of my friends, but that wasn't really anything. So whatevers. I just wish I could meet another girl, to at least have something new in my life. Everything seems really boring lately.

I read 3 books, and I'm working on a 4th, but the 4th isn't all that great so far. I read, The night abraham saw the stars, the theory of religion, and Stephen Hawkings Brief history of Time. And the 4th book, is Sexual Personae, which is a book on art from Nerfaiti to Emily Dickenson. It was highly recommended, but it's really boring, and the Author is an idiot. I know I shouldn't criticize someones views, but so much of what she's/he's saying is horribly wrong and closed minded. And straight up sexist sometimes. And not sexist as in the usual sense of Male is better than Female, but the opposite. And the authors facts aren't much better as well.

So yeah, Basically, I'm stuck sitting in a lounge alone with my thoughts, which is never good. For some reason, during the night my thoughts always take a turn for the worse. At least I have vacation to look forward to.

Friday, November 12, 2010

Weird Dreams all in the same night

Apparently, the documentary series The Blue Planet gives me some pretty interesting dreams. I'll list them off in order of how I remember them.

1. I was jailed for some reason, while I was in jail I was looking down at my hands, disappointed in my actions or just thinking, zoning out from the outside world. When some familiar blackpants legs came up. I looked up, and it was my ex from a few years ago. I said her name and looked at her, she looked at me. And spoke 3 words.

"I miss you"

I responded with I miss you too and we walked out of the prison together and spent time together talking and being romantic. We got back together and held each other. I woke up. Checked my watch. I think it was 8am.

The next dream I had, involved a girl I friended on facebook yesterday who is in my German class. I was traveling with my brother. We came to some beach and were having a drink at a little table when I saw this girl at another table. She invited me over, I asked her if my brother could sit as well, and he smacked me and said don't put her in a rude place. So I went over and hung out with her. Then we were in bunk beds, my brother on bottom, me on top with the girl. Flirting, and kissing her. Being completely silly and flirting in the best way. I woke up and was like, damn she's cute- and, it's way to early to be having dreams about this girl.

I had 3 or so more dreams, but none of them impressed me as much as those two. Mainly because they involved the warm and happy feelings of love and attraction.

I'm now awake thinking about what the hell my subconscious is trying to tell me. That it misses my ex from my only long term relationship? The only girl I ever actually loved? Well I knew that, of course I miss the feelings of intimacy. And this new girl? Perhaps just my subconscious wanting me to move on to this girl, I do like her. She's an interesting girl, and I'd like to get to know her more.

Dang dreams, how do they work?

Thursday, November 11, 2010

Imaging and Transformation

Well, I decided to get an easier interface with the imaging library I'm using. I was just calling a function I had made before that accepted two arrays and a name for a file to be saved too. But I decided I'd like to have my graphs plotted like they're graphs. So I created a class that would accept a size (x by y) for a pane to draw to, and a coordinate system to use. 'c' for Cartesian, 'a' for absolute. Cartesian is the coordinate system you normally use, where there are 4 quadrants and it's pretty simple to plot. Absolute is how the computer really plots pixels, from the top left. There is no negative positions, only positive going eastward from the top left as x, and southward from the top left as y.

It was really simple to figure out how to transform coordinates in absolute to Cartesian. You simply take the of your pane, divide it by 2, and those (x,y) points are your origin. So when you receive absolute positions from the user, you simple do originX + incomingX and originY - incomingY. It's really simple! I was pretty happy at how well it worked out.

So I also made a couple functions to draw a Grid to the pane so you can see your lines with the axes and graph paper like quality, or just the axes. It's great! And it makes seeing my recursive solutions from my other program really easy!

My next project is to make an ongoing simulation where you can give the program points to go after loading up a maze of obstacles, set a start point and ask it to go places. If I can get that working, then I can move on to try to get some image processing to process images of streets and other things, and allow a user to flag things as obstacles and the program suggest ways to go about getting around them.
My Ultimate goal is to make it completely automated, flagging obstacles by itself and coming up with the best strategy to attack the problem, or suggesting multiple strategies. And from there, having it compute how 2 objects could work together to outflank anything behind the obstacles. Basically, a very basic tactical advisory unit. Or as my project folder is called, TAU.
Solution plotted with Grid
Solution plotted without
grid but with axes
Just the grid being displayed
mission accomplished!

Monday, November 8, 2010

Recursive Solution For obstacle avoidance program

Ha ha!

It's now 1:46am, but that is perfectly ok, because after only a few hours at work I've managed to combine my two functions, avoidLine, and avoidCluster into one function avoidObstacles! Alright so here's the breakdown!

when you call avoidObstacles() from your line instance, you're really calling a wrapper function that calls a recursive algorithm that takes the obstacle array as well as an array to hold the solution lines you're generating.
This allows for user friendliness, that way they client doesn't have to pass in an array holding a reference to the object calling the function.
Figure 1- Partial solution

You can see the 2 Lines used
to find the other 3 in this picture
See figure 2 if you can't see which
are the partial solutions.
So heres how it works:

Base Case = length of the obstacle array is 0
     return lines array
otherwise
     if last object in lines array intersects first object in obstacle array:
          is obstacle a cluster?
               YES > avoidCluster call
                           replace last object in lines with first line from 
                           Cluster
               append second line from avoidCluster call to lines array
               remove obstacles from obstacle array
         else is obstacle a line?
               YES > avoidLine call
               replace last object in lines with first line from avoidLine
               append second line from avoidLine call to lines array
               remove obstacle from obstacle array
     return (recursive call to function)

So, to make this as clean as possible, I wrote a isCluster function to check if the Line was linked to any other, also there still is a small bug in the program that I'll have to be careful of.

If the obstacle array does not hold all the obstacle clusters parts, then the function will crash. Because python will report an error if it cannot remove the object from the array, and it can't do that if it's not in there. Doing a check to see if the obstacles parts are in the array is possible using the 'in' keyword. But even with that fix, when calling the drawLines function, or any other function, you might try to pass the array of obstacles in and forget it won't draw that particle line.

Technically the drawLines won't draw any of them if you pass in the obstacle array you used in the recursive call because the removal function of python is not only operating a local scope. Anyway though. Besides that bug, the program works very nicely.

Figure 2
Recursive Solution to
an array of obstacles
I did run into an amusing problem thought took up my time for a good hour or so. Which was the 2nd Line seemingly ignoring the obstacle that's not part of the cluster. So instead of the full solution to the left, it was a hybrid between figure 1 and 2. I did have an image saved, however it was written over during the 2 hour process. Anyway, the problem was, that I wasn't passing in the correct array to my drawLines function, and my recursive solution was working the whole time. I figured this out by printing off the starting and ending points of all the lines returned by my function.

 I feel very accomplished after managing to work around all the issues I had when I was attempting this problem before. This was a definite positive increase in my day's overall situation. Instead of attending a review session for an upcoming test in my Discrete Mathematics and Structures class, I read a little bit of A Brief History of Time, and took a nap. Or at least tried, I cried a little and was trying to figure out what I really want from life in general, and who I want to be. Lucky for me I was attempting to take a nap so when my roommate mentioned my eyes looking like I'd been crying for an hour, I could wave it off as being sleepy. I prefer to keep my friends away from my issues. I don't the pity, I have plenty enough for myself.

Going back to happy thoughts, my recursive solution is even more elegant than I had originally thought it would be. Being exactly 18 lines long. Although it might increase maybe 2 lines if I add the code to check for obstacle cluster pieces not being in the array and just forcing the function to return at that point and yell at the client.
Good times,
I think I'll finish listening to Я твоя не первая and then go to bed.

Fantastic!

An interesting solution
Hello again!
I've continued working on my obstacle aversion program, and after a little more editing and head scratching I got my program to come up with this, correct, albeit silly solution. This weird little guy resulted from giving the function to compute the X to plug into the obstacle the wrong obstacle to use for it's functions and what not. (Once you see the pseudo code you'll understand)



figure 1
So I put in a check to see if the lines being computed by the first part of my algorithm were correct. And as you can see in figure 1, the lines were going to each end point of the obstacle cluster. Those two lines were then compared by length to decide which would be the best path to tread.
The little vertical line is part of the cluster that got accidentally thrown in by mistake.




figure 2
So since I knew that my lines were correct, I figured out what the problem was and fixed it, and lo and behold, I arrived at the correct solution! Which is shown in figure 2.

The function that avoids the Cluster is only 31 lines long. Granted it uses a helper function and classes previously defined in the file, but still. Pretty good compared to my old function that had 63 lines and used a whole other class for piece wise classes.

So Let me explain my 'Cluster' before I state my algorithm, my Cluster is really just an extra part of my Line class that might not be apparent to anyone not reading the documentation I might write for it one day. Basically, my Line's also have the ability to link them to other Line's via nodes. Like a linked list. Each line has a next and prev variable that holds a pointer to another line. And of course it has function to check if the line has a next or prev. This way, if you try to call a getNext function, it can make sure that doesn't happen.

Ok, now for the algorithm.

Function takes itself (the line) and a cluster
if the line intersects the cluster
     >go to head end of the cluster, save pointer to head
     >go to tail end of cluster, save pointer to tail
      create Lines AB and AC that go from the lines start point
      - to the heads start point, tail end points, see figure 1
      compare AB and AC's length choosing the shorter one, assign a new pointer to hold this shorter
      at the same time, whichever obstacle the shorter line points to assign a pointer to that
      use the helper function to choose an x to plot with the obstacles line function
     create the two new lines using the original start points and endpoints and the new start and endpoints from
     your new x and y from the helper function and obstacle functions.
     return the two lines in an array.

It's pretty simple really.


def avoidCluster(self,clust):
        if(self.intersectL(clust)):
            c = clust.hasPrev()
            d = clust
            while(c):
                if(d.hasPrev()):
                    d = clust.prev
                    print -1
                    c = d.hasPrev()
            head = d
            c = clust.hasNext()
            d = clust
            while(c):
                if(d.hasNext()):
                    d = clust.next
                    print +1
                    c = d.hasNext()
            tail = d
            AB= Line(self.sx,self.sy,head.sx,head.sy)
            AC= Line(self.sx,self.sy,tail.ex,tail.ey)
            #drawLines([AB,AC],clust.getAll(),'check.jpg')
            if(AB < AC):
                LOne = AB
                line = head
            else:
                LOne = AC
                line = tail
            x = self.helperChooseX(line,LOne.ex)
            y = line.func(x)
            newLine1 = Line(self.sx,self.sy,x,y)
            newLine2 = Line(x,y,self.ex,self.ey)
            return [newLine1,newLine2]



that's the code in case my algorithm wasnt very clear.
Woo!

Now I'm going to combine my avoidCluster and avoidLine functions to create a function that can avoid all obstacles!
  

Note:
     the line AB < AC is really comparing AB.length and AC.length but I overrided the python __lt__ function of my Line object so I could make the comparison directly. which worked very well.
     Also, the two print -1 and +1 was making sure my clusters were cycled back to their head and tail ends correctly.
     The commented out line drawLines, is what made Figure 2
     the helper function is only 11 lines lone so if you want to get technical my new function takes up 43? lines. But that's still significantly better than my other function which took 60 something as well as using other helper functions! Hooray for elegant solutions

Sunday, November 7, 2010

Amnesia The Dark Descent

I picked up Amnesia the Dark Descent a few days ago. Good lord is this game amazing.

Anyone who enjoys horror games will love it very very much. I'm not sure if a game has captured my attention like this one has. As the game suggests, I play it at night, with headphones on, and the lights off. The atmosphere is amazing, and I have to take breaks every 25 or so minutes to still my beating heart.

The game draws you in, and it's been a very long time since I've played a game that draws me in like this one. Good lord, the game is only 20 dollars and can be bought for digital download from the makers site. Frictional Games is the studio responsible for the gem, and if you appreciate a good indie horror game. Then this is for you.

Go and get it!

Ha! A new approach

figure 1
I started working on my path finding algorithms again. I have yet to do any coding, however I've come to an epiphany of how to solve my problem that I was running into before, this problem is shown in figure 1. In my previous recursive algorithm, I treated each obstacle line as that, a line. Instead of considering the entire object as one obstacle.

Of course this means reworking an obstacle class to be more like a system of equations instead of just using an array of lines to increment through the obstacles to bypass. By comparing obstacle endpoints and startpoints with each other. The ones that are shared will then be considered one object. Thus, a solution path around that object involves skirting the edges of the lines of the obstacle themselves, and then computing the shortest path. I don't know why I didn't think of doing something along these lines before in all honesty.

I'll set up the class to have a flag to be checked if the obstacle is more than a simple line or not. If it's not, then a simple startpoint to obstacle end or start point and then to destination will suffice. If it's flagged, than the line of the other obstacle parts will be copied and shifted by X closer to the start position, and a little bit longer than the obstacle line so it moves past it.

I'm so excited to code this and fix it!