16. juni 2013

2D cross-sections of a 3D rotating cuboid

If you're unfamiliar with the concept and/or ideas of flatland, this post might not make a lot of sense to you. If you don't want to read up on flatland, here's a nice image which does a (decent) job of visualizing the concept behind this post:

Consider a cuboid with the dimensions X,Y,Z along the three spacial dimensions. Imagine taking said cuboid and slowly descending it through a 2-dimensional plane. How would this look?

If we merely took a 1x1x1 cuboid without any rotation, this would be a square popping in and out of existence  obviously. But how would this look if we allow the cube to rotate?

We define an initial rotation on the cube across the 3 dimensions (XY, XZ, YZ) and a gradual rotation (XY, XZ, YZ) as well. The cube will be rotated around its center-point, as it's the most intuitive to do so.

If you don't want the mathematical details, you can download the .jar file here:

Download link

We define the 8 vertices of the cuboid as 8 3-dimensional vectors positioned according to the center of the cube. We also define a rotation function r(x) for each of the vectors (which is simply a rotational matrix). 
Definition: Rotating the cuboid (XY, XZ, YZ) means to rotate each of the 8 vectors (XY, XZ, YZ).

Next up, we need to define a cross-section of the cube at a certain height t.
Definition: A line segment is a line going from a point to another point. In this case vectors. A line segment is a line going from the end of one vector to the end of another vector.

The cuboid contains 12 line segments.

Definition: An intersection is the point where a 3-dimensional line and a 2-dimensional plane at height t intersect.

Definition: A cross-section of the cuboid is the set of intersections for each line segment in the cuboid and an infinite 2-dimensional plane (X, Z) at height t (y=t).

We get the cross-section of the cuboid and draw the convex hull of this collection of points.
Going at constant rate for t we get an animation of the cuboid going through flatland (rotating the cuboid for each term).

This was really vaguely described, but I don't really feel like going into too many details.

23. maj 2013

Canon Generator

I've managed to design a program that, based on a seed, generates a three-track canon song that actually sounds good. The trick here is that each of the three tracks have to be exactly the same - however, track two and track three are offset by a constant amount of notes.

A demonstration of this can be found on SoundCloud and YouTube, playing the seed 'IgnatieffSC' over a C major scale. (The first 200 notes are generated and exported using GarageBand):

SoundCloud link: https://soundcloud.com/ignatieff/generated-canon-piece

YouTube link: *missing*

The program itself doesn't have a GUI, but rather a series of inputboxes. It exports directly to .mid audio format. Oh, and here's a cool picture I made to help sell my idea to people around on the internet:



Here's a nifty download link if you wanna try it out for yourself:

Download link (canon-generator.jar): 

SHA-256: a4c08c7b8f01891c18082e4dac266780dcb53d8717451e7bc8d804df8f2c59c4
VirusTotal scan:
https://www.virustotal.com/en/file/a4c08c7b8f01891c18082e4dac266780dcb53d8717451e7bc8d804df8f2c59c4/analysis/1369321541/

- UPTX

30. april 2013

Prime Generator Übercharge

About a year ago, I released a prime generator written in C#, which was able to generate 1.000.000 primes in about 45 minutes.

Anyway, myself and a bloke from my class decided to have a programming competition to see who was able to make the most efficient prime generator in a language of our choice.

I initially tried accomplishing this in Java (Don't ever do this - BigInteger is a bitch), which accomplished the task in a mere 15 minutes.

Following this, my competitor decided to turn to C++ to defeat me. And he did. Big time.
His program was able to generate 1.000.000 primes in a mere 20 seconds, defeating me by several miles.

Frustrated by my loss, I also turned to C++, where I made a program, which was able to generate 1.000.000 primes in less than 3 seconds (2.90867, to be exact).

The competition was hereby concluded.

Just for fun, here's a link to the source code of the C++ program:


Mathemusica!


Mathemusica v1.0.2

So, I've begun developing a program which I call Mathemusica. What it does, in a nutshell, is making music out of equations. Yes, you heard me - music from equations.
Using the function value f(x), it assigns a musical note from a chosen scale and well... makes music.
It's taken me roughly a week at current point to develop this.

Here's an image of the GUI to show you what it looks like:



The program is developed in Java and is automatically cross-platform for this reason.
Some time soon I'll release a technical summary of the program, but for now, I'm just releasing it.

If you want a sample of what this program's able to offer, here's a fun function I found while making this:

.mmx: https://dl.dropboxusercontent.com/u/19633784/Mathemusica%20Sample.mmx
.wav: https://dl.dropboxusercontent.com/u/19633784/Mathemusica%20Sample.wav

I also have a YouTube video of the program (although it's synthesized using v1.0.0, it's still valid):




Although I've worked intensely on this for the past week, I haven't made everything myself. Actually I've used two external libraries, namely "exp4j-0.3.01.jar" and "JSyn-beta-16.5.14.jar". Here's a link to the two developer's websites:


And here's a download link, if for any reason you're interested in trying it out:


Download Information
SHA256: 6397bd466a516692b7bd4c579dada4ff430dd751ec3957323722e07a55e69d53
VirusTotal-link: https://www.virustotal.com/en/file/6397bd466a516692b7bd4c579dada4ff430dd751ec3957323722e07a55e69d53/analysis/1367328142/


Download Link

For archive's sake, I've released the previous two versions of the program. They do not support the current .mmx-format, but instead .mm, which is a different file-format, which is deprecated:

I'll keep working on this project for as long as I find it interesting.

9. maj 2012

Crypting...

Disclaimer: The programs linked to in this blog post may be detected as a virus by one or more anti-virus programs. If this scares you, don't download them. Thank you.


A little time ago, I discovered Hackforums and quickly stumbled upon the concept of 'crypters'.
To those of you who don't know, essentially crypters are programs that encrypt the binary data of an .exe file, as to avoid detection by anti-virus vendors.

After figuring out what a crypter was, I decided to challenge myself and make my own crypter. The first one I made was horrific. It was detected by approx. 10 anti-virus vendors and this one guy from Hackforums was able to crack it in less than 10 minutes.

Not letting myself down, I decided to repeat the experiment. This time I was more successful. Not only was it less hard on the file size, it was only detected by a single anti-virus vendor (AntiVir). I have not uploaded this one to Hackforums - not sure why.

Download link: http://dl.dropbox.com/u/19633784/Cryptoxic%20v2.exe

-UPTX

22. februar 2012

Prime Generator - some numbers

During my prime generation, I had the program write down what number prime (and prime) it was at each passing minute. Now, I've done a little bit of graphing and came up with these two graphs:

1) 12 hour test - I basically let the program run for 12 hours. This is the graph showing that:
graph showing that it goes slower the longer it runs

2) 1 hour comparison - I let the program run for an hour on two machines (one being my new, one being my old). This is the graph comparing the two:

graph showing the comparison between my new and old computer.


-UPTX

Prime Generator

Hey guys,
first of all, I just managed to get a hold of a new i7-Quad Core 3.0GHz, 8GB RAM Windows 7 computer the other day (it lacks a graphics card, so I can't play Battlefield D:), which means I can program stuff outside of a Virtual Machine (thank god), so expect more releases of software. I haven't added one thing to Drug Lab at all since last update, but alas -- I'll finish it eventually.

Enough babbling, I have created a Prime Generator (expect tutorial), which is a program that generates, well, primes. On my brand new computer, using roughly 20% of it's CPU, it generated 2.076.343 primes in a little over 12 hours. The highest prime being 3,38E+007 (33.773.261).

Download here:
Program: http://dl.dropbox.com/u/19633784/Prime%20Generator.exe
C# Project: http://dl.dropbox.com/u/19633784/Prime%20Generator.zip

...and for the paranoid ones:

Expect a tutorial soon...

-UPTX