POV-Ray : Newsgroups : povray.newusers : File I/O Problems && How to test if an identifier is a Float or a vector : Re: File I/O Problems && How to test if an identifier is a Float or a vector Server Time
10 Oct 2024 01:38:21 EDT (-0400)
  Re: File I/O Problems && How to test if an identifier is a Float or a vector  
From: Ron Parker
Date: 15 Mar 2002 14:49:28
Message: <slrna94k2a.ldi.ron.parker@fwi.com>
On Fri, 15 Mar 2002 10:07:43 +0100, Thorsten Froehlich wrote:
>> Well, I searched the problem with #debug, but I don't know wether to use
> vstr
>> or str.
> 
> It is very simple and I hope the manual explains it:  Use vstr to turn
> vectors and str to turn floats into strings.

That's not the question.  He has an identifier that he's just #read from
a file, but doesn't know if it's a float or a vector.

The following isn't tested, but should work.  Just replace the two #debug
statements with whatever sort of output you're seeking.

#macro ScalarOrVector( A )

  #local C = rgbft 0 + A;
  #local D = A+1;
  #local E = rgbft 0 + D;

  #if ( C.filter = C.red & E.filter = E.red)
    #debug "scalar\n"
  #else
    #debug "vector\n"
  #end

#end


-- 
#local R=rgb 99;#local P=R-R;#local F=pigment{gradient x}box{0,1pigment{gradient
y pigment_map{[.5F pigment_map{[.3R][.3F color_map{[.15red 99][.15P]}rotate z*45
translate x]}]#local H=pigment{gradient y color_map{[.5P][.5R]}scale 1/3}[.5F
pigment_map{[.3R][.3H][.7H][.7R]}]}}}camera{location.5-3*z}//only my opinions


Post a reply to this message

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