Hi, i'm having trouble displaying a sketch on a vertical display (resolution 1080 x 1920). I'm getting framerate dips every so often but i don't get them if I setup the sketch to 1920 x 1080. I suppose there's some bug with vertical screens. To sort it out, I want to setup the screen to have 1920 x 1080 resolution and then rotating the whole sketch -HALF_PI. However, if I do this on the draw() method, i don't see anything. Any ideas?
I've writen quite a complex app in processing. It's desinged as a systems monitor that is run on a big screen in the offices of the company I work for. it features rich graphics and real time updates using websockets.
Everything runs fine on my computer (MacBook Pro 13' core i7 with 4gb of ram). However, when I run the program on the monitor computer (a Macbook Pro 15' core i7 with 8GB of ram, running the same version of mac os, java and processing) the framerate oscillates. It runs fine at 24 fps and then after a bit it periodically drops to around 12. This happens periodically, but I am unsure as to why it should run fine on my computer but not so well on a higher spec model.
I've profiled my app on netbeans and as far as I can tell, there aren't any obvious memory leaks (memory usage oscillates at around 75 mb, allocated memory is at around 90 mb. Could it be something to do with the garbage collector? Any ideas would be massively appreciated.
I'm trying to represent data flow from a physical location to a computer via splines with moving balls. At the moment, i'm using toxi's implementation of a verletparticle system with an attractor at the destination and gravity on the oposite axis to create the curvature of the particles. Then i'm using the particles as points to create a spline. The faster the data transfer, the faster the particles will move, by increasing the force of the attractor. However, this changes the curvature of the spline. What other method do you guys know i could use where i could isolate the speed variable and keep the curvature of the spline? I basically want to move particles along a spline.
I'm trying to draw countries on top of a 3D sphere. I've created the following classes (in bold): For each
Country, I have a list of
Landmasses. Each
Landmass has a set of
Coordinates (lat long) which define the landmasses border. So in 2D this is all fine, i map the coordinates to x,y points on my sketch based on some projection and i've got the result i want. However, the same approach doesn't work as well in 3D.
I have successfully converted the lat,long coordinates onto x, y, z using the following formulae
x = radius * (float) Math.sin(latRad) * (float) Math.cos(lngRad);
y = radius * (float) Math.sin(latRad) * (float) Math.sin(lngRad);
z = radius * (float) Math.cos(latRad);
my draw() function for a landmass looks like:
public void draw(PApplet p) {
p.strokeWeight(1);
p.stroke(107,177,209,255);
p.beginShape();
for (int i = 0; i < this.borders.length; i++) {
Coordinate c = this.borders[i];
p.vertex(c.x, c.y, c.z);
}
p.endShape(p.CLOSE);
}
However, this method, while really intuitive, doesn't produce convex shapes. If i place these shapes on top of a sphere, small landmasses are drawn just fine. However, the surfaces of larger countries such as Russia or Canada are drawn with ridges and they cross the sphere they're drawn upon:
What i'd like to have is a method that given a set of boundary points, it would compute a mesh that follows the convex shape of a sphere. I've had a look at toxi's amazing toxic libs, but i haven't been able to use them successfully. Is this a 3D convex hull problem?