POV-Ray : Newsgroups : povray.general : question Server Time
17 Nov 2024 23:14:35 EST (-0500)
  question (Message 1 to 2 of 2)  
From: Timothy R  Cook
Subject: question
Date: 16 Dec 2002 12:30:34
Message: <3dfe0dba@news.povray.org>
what's the simplest way of reading hexadecimal numbers stored in a csv
into floats in POV?  can I do it internally, or do I have to write a
BASIC program to do it?

-- 
Tim Cook
http://empyrean.scifi-fantasy.com

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GFA dpu- s: a?-- C++(++++) U P? L E--- W++(+++)>$
N++ o? K- w(+) O? M-(--) V? PS+(+++) PE(--) Y(--)
PGP-(--) t* 5++>+++++ X+ R* tv+ b++(+++) DI
D++(---) G(++) e*>++ h+ !r--- !y--
------END GEEK CODE BLOCK------


Post a reply to this message

From: Bonsai
Subject: Re: question
Date: 17 Dec 2002 04:19:38
Message: <3dfeec2a$1@news.povray.org>
Timothy R. Cook wrote:
> what's the simplest way of reading hexadecimal numbers stored in a csv
> into floats in POV?  can I do it internally, or do I have to write a
> BASIC program to do it?

I think it should be possible to do in POV-SDL.

Read the data from the file with the #read function. You can use the 
string functions described in "6.1.7.3  String Functions" to break the 
lines of the csv file into tokens (substr comes to my mind). Then 
convert the hexadecimal numbers into floats with your own function 
(there is no converting function in POV-Ray):

e.g.
HEX: 12AB.9C
DEC: 1*16^3 + 2*16^2 + 10*16^1 + 11 + 9*16^-1 + 12*16^-2

Hope that helps,

Bonsai

-- 
<--------------------------->
    ___ __ __  _ ___ ___  _
   | _ )  \  \( )  _) _ )( )
   | _ \() |\ \ |\ \/ _ \| |
   |___/__/_)\__)___)/ \_)_)

        www.b0n541.net
<--------------------------->


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.