Wednesday, 5 September 2007
new job
i started a new project- its so big i'm working at sun to get it done sweet style! im also messing round with stuff out there (all r & d innit). so if u want to join the cool new wave of making top end interactive visual mumble come join is in the lands of javafx. its gonna be sweet! blogs.sun.com/ant/
Sunday, 1 April 2007
update to below
you can remove the if(d ==0) and use atan2(y, d) instead.
these days people us 3d sdk's that contain a pointAt/lookAt calls. but this can come in handy when there is no framework around, or your just wanting todo some nice eyecandy.
point object at target object
// returns the distance between two 3d points in space.
public static float getDistance(Vector4 pnt1, Vector4 pnt2)
public static float getDistance(Vector4 pnt1, Vector4 pnt2)
double dx = pnt2.x - pnt1.x;
double dy = pnt2.y - pnt1.y;
double dz = pnt2.z - pnt1.z;
return((float)Math.sqrt(dx*dx + dy*dy + dz*dz));
}
// convert x, y location to an angle - azimuth
public static float getAzimuth(Vector4 pnt1, Vector4 pnt2) {
float x = -(pnt1.x - pnt2.x);
float z = -(pnt1.z - pnt2.z);
float rangle = (float)(Math.atan2(x, z));
return(180.0f * rangle / 3.14159f);
}
// convert x, y, z location to an angle - elevation
public static float getElevation(Vector4 pnt1, Vector4 pnt2) {
float y = (pnt1.y - pnt2.y);
float x = (pnt1.x - pnt2.x);
float z = (pnt1.z - pnt2.z);
float d = (float)Math.sqrt(z*z + x*x);
if(d == 0) d = 0.0001f; // just in case we get a zero distance
float ang = (float)Math.atan(y / d);
return((float)Math.toDegrees(ang));
}
If u want the gl bit:
Vector4 v1 = new Vector4(0f, 0f, 0f);
Vector4 v2 = new Vector4(10f, 5f, -20); // whatever.
float azimuth = Utils.getAzimuth(v1, v2);
float elevation = Utils.getElevation(v1, v2);
float distance = Utils.getDistanceZX(v1, v2);
gl.glRotatef(azimuth, 0f, 1f, 0f);
gl.glRotatef(elevation, 1f, 0f, 0f);
double dy = pnt2.y - pnt1.y;
double dz = pnt2.z - pnt1.z;
return((float)Math.sqrt(dx*dx + dy*dy + dz*dz));
}
// convert x, y location to an angle - azimuth
public static float getAzimuth(Vector4 pnt1, Vector4 pnt2) {
float x = -(pnt1.x - pnt2.x);
float z = -(pnt1.z - pnt2.z);
float rangle = (float)(Math.atan2(x, z));
return(180.0f * rangle / 3.14159f);
}
// convert x, y, z location to an angle - elevation
public static float getElevation(Vector4 pnt1, Vector4 pnt2) {
float y = (pnt1.y - pnt2.y);
float x = (pnt1.x - pnt2.x);
float z = (pnt1.z - pnt2.z);
float d = (float)Math.sqrt(z*z + x*x);
if(d == 0) d = 0.0001f; // just in case we get a zero distance
float ang = (float)Math.atan(y / d);
return((float)Math.toDegrees(ang));
}
If u want the gl bit:
Vector4 v1 = new Vector4(0f, 0f, 0f);
Vector4 v2 = new Vector4(10f, 5f, -20); // whatever.
float azimuth = Utils.getAzimuth(v1, v2);
float elevation = Utils.getElevation(v1, v2);
float distance = Utils.getDistanceZX(v1, v2);
gl.glRotatef(azimuth, 0f, 1f, 0f);
gl.glRotatef(elevation, 1f, 0f, 0f);
Tuesday, 20 March 2007
javaspaces
nearly done on the main code here- all works nice. i think most people could get the hang of javaspaces after you workout a nice development path. at the moment i am using Blitz and Netbeans as an IDE, im not sending new Entrys to my space from Netbeans (they get mangled- think its the Netbeans classloader). But i can read/take Entrys using Netbeans, so not to much hassle. At the moment i'm adding new Entrys within a little application i have made that runs using the default java classloader. I am still a bit lost with policy files, i know i will have to look into that real soon, shouldnt be to much hassle- i hope.
ide note; i do want to have a play with Project Darkstar now its opensource. looks very cool indeed. i'm just waiting on the j2me client code to be releaced, intresting to see how it manages scaling acrross servers etc etc.
ide note; i do want to have a play with Project Darkstar now its opensource. looks very cool indeed. i'm just waiting on the j2me client code to be releaced, intresting to see how it manages scaling acrross servers etc etc.
Monday, 19 March 2007
quartz compositor
just started playing with quartz compositor. main thing i want to do is make a qtkit plugin for it (the movie loader is to limated), it seems qtkit just does simple things (play movies etc). wanting to go deeper like you can with the quicktime api, but im not sure qtkit will let me (i hope it does). i also note that quicktime in a qc project dont seem to want to play sound if there files are remote (on a http server)- just the video track gets played back.
another fun thing i found (old new i guess) is that u can save a qc project as a quicktime movie, within that movie you will see a new track type of quartz comp'. nutty. cant send messages and intactive elements within the qc track at this time.
another fun thing i found (old new i guess) is that u can save a qc project as a quicktime movie, within that movie you will see a new track type of quartz comp'. nutty. cant send messages and intactive elements within the qc track at this time.
cannes film festival;
some people have requested i linked this movie back up on my blog. its from some code i wrote that animated some 3d blocks around, sort of looked cool. the final movie was played back on 4 super hd screens exlusivly for the cannes film festival show. this movie showcasted a project by 'beam' media.
made in a few days tbh, rendering the thing took the longest amount of time, funny i could make it now in less time with full realtime playback.
made in a few days tbh, rendering the thing took the longest amount of time, funny i could make it now in less time with full realtime playback.
Saturday, 17 March 2007
hello again
thought i'd start bloging here- less chance of this server going down, and my blog getting deleted (again). must say, all is well in the world of aNt - just messing around doing r&d when i can.
main thing is the new underworldlive site. lots of cool new stuff there coming up, have to keep pluging away at the code. must must must. also working on a new website with my tomato boyz- nice simple one, lots of css and js stuff going on there.
so what have i been playing with? well quartz composer is very cool (you can save a qc files as a quicktime movie) i've been playing with the new quicktime track it makes- sort of fun. also messing with ajax (want to do grizzly stuff) not getting very far with the cool push stuff in glassfish, no idea where to find the jar to start messing with it. so just faffin with normal ajax for a bit.
javaspaces; is just going to well, so im expecting it to all blowup at some point :) not sure why everyone isnt using it tbh.
i want to find some time to play with darkstar (sgs from sun)- looks like a lot of fun there! its now open source, very cool indeed. waiting on the j2me libs so to have some full on focus.
also must give a nod to Joost; its a p2p streaming video thing (well its not streaming live video, thats impossable). its very cool, worth a pop if u can get on the beta- try here:

so heres my new blog (for now)- top stuff!
main thing is the new underworldlive site. lots of cool new stuff there coming up, have to keep pluging away at the code. must must must. also working on a new website with my tomato boyz- nice simple one, lots of css and js stuff going on there.
so what have i been playing with? well quartz composer is very cool (you can save a qc files as a quicktime movie) i've been playing with the new quicktime track it makes- sort of fun. also messing with ajax (want to do grizzly stuff) not getting very far with the cool push stuff in glassfish, no idea where to find the jar to start messing with it. so just faffin with normal ajax for a bit.
javaspaces; is just going to well, so im expecting it to all blowup at some point :) not sure why everyone isnt using it tbh.
i want to find some time to play with darkstar (sgs from sun)- looks like a lot of fun there! its now open source, very cool indeed. waiting on the j2me libs so to have some full on focus.
also must give a nod to Joost; its a p2p streaming video thing (well its not streaming live video, thats impossable). its very cool, worth a pop if u can get on the beta- try here:
so heres my new blog (for now)- top stuff!
Subscribe to:
Posts (Atom)