We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
bspline in 3D (Read 455 times)
bspline in 3D
Mar 20th, 2008, 3:56pm
 
Hello,

I am very new to Processing. Just last week. So I am trying to do a few things. However, I have been browsing through the examples and hundreds of messages and I think I have a new problem.

So don't shoot me!

Here is an arbitrary file format which I created.

X       Y     Z (universal time stamp)
6DFE803A1205997812.531000
59ABAB1E1205997812.531000
7C00BCED1205997812.531000
748F9EDE1205997812.531000

As you can see the X and Y values are hex and the Z value is a time stamp based on local universal time in sec and microseconds when the X and Y values where written.

I cannot find any examples of reading even a single column of hex values, let alone 2 of them and converting them into  color pixels. Nor can I find any examples of universal time.

Has anyone out there done anything like this before?

Thanks,

Happydude!

Re: bspline in 3D
Reply #1 - Mar 20th, 2008, 10:43pm
 
I usually crawl the web for "Java" help.

You can convert an hexadecimal string into an int in Java with the following code:

int i = Integer.valueOf(myHexString, 16).intValue();


from:

http://www.java-tips.org/java-se-tips/java.lang/how-to-convert-a-hexadecimal-string-into-an-int.html

I assume you would iterate through the lines of text in the file and use various string functions to hack out the hex values. It's odd that there's no spaces in your example.

Here's a UDT applet.

http://www.bobulous.org.uk/udt/

I'm sure that if you use Integer or Float's conversion methods then you should be able to reverse engineer an equation to deal with the UDT business.
Re: bspline in 3D
Reply #2 - Mar 20th, 2008, 11:00pm
 
In my orginal post there where spaces. Somehow they got deleted. It should be:

6DFE -803A -1205997812.531000
59AB -AB1E -1205997812.531000
7C00 -BCED -1205997812.531000

Where "-" should be the space.

What I would like to do is draw a graph in 3d. Where the hex x and y is the hex color value and time is the height value.

thanks for the link on UDT. I am reading it now.

do I really have to convert the hex value to interger? can't I just read it in as an hex color value?
Re: bspline in 3D
Reply #3 - Mar 22nd, 2008, 12:31am
 
The hex value you have there is a String. Because the text file is a String array.

Literal hex values in code look like:

int = 0xFFFFFFFF;

Code:

void setup(){
size(200, 200);
// found out you only need "parseInt"
int c = Integer.parseInt("66DDFFEE", 16);
fill(c);
rect(10,10,50,50);
}


Of course, your short hand for the colours is going to cause some trouble.

Too much of a headscratcher for me at this time of night :S
Page Index Toggle Pages: 1