POV-Ray : Newsgroups : povray.text.scene-files : Systematic Labeling Server Time
8 Jul 2024 11:37:58 EDT (-0400)
  Systematic Labeling (Message 1 to 2 of 2)  
From: Bob Hughes
Subject: Systematic Labeling
Date: 1 Sep 2000 16:24:18
Message: <39b01072@news.povray.org>
// Persistence of Vision Ray Tracer Scene Description File
// File: systematiclabels.pov
// Vers: 3.1
// Desc: systematically labeling things, one way to do it anyhow
// Date: 2000.67
// Auth: Bob Hughes
// Mail: per### [at] aolcom?subject=pov-scene
// free code! don't buy this :-) it ain't a macro


camera {location -9*z look_at <2,1.5,0>}
light_source {-10*z,1}

#declare RedundantObject= // whatever
 union {sphere {0,2} box {-1.5,1.5} pigment {rgb .5}}

#declare Var1=1; // the starting number
#declare Var2=0; // for positioning
#declare Letter=65; //start at "A"

#while (Var1<26) // count of instances (limited by Alphabet in this case)

#declare Var0=chr(Letter) // get letter from number

// this could prove difficult for any but the simplest CSG
intersection {
 text {ttf "arialbd.ttf", concat(Var0,str(Var1,0,0)), .5, 0
  pigment {rgb 1.5}
    scale 1 rotate 0 // position to interact with surface of RedundantObject
     translate <-.67,-.3,-2.25>
   inverse
 }
 object {RedundantObject}

  translate <3,2,3>*Var2 // position each in some manner
}

#declare Letter=Letter+1;
#declare Var1=Var1+1;
#declare Var2=Var2+1;

#end


Post a reply to this message

From: Bob Hughes
Subject: Re: Systematic Labeling (now a macro)
Date: 2 Sep 2000 15:09:09
Message: <39b15055@news.povray.org>
// Persistence of Vision Ray Tracer Scene Description File
// File: sequentiallabelsmacro.pov
// Vers: 3.1g, MegaPOV 0.5
// Desc: this will create sequential alphanumerically labeled objects
// Date: 2000.675
// Auth: Bob Hughes
// Mail: per### [at] aolcom?subject=pov-scene
// Note: not made to do this on various objects as is so you will need
//       to create the CSG object and transform everything yourself.

#version unofficial MegaPov 0.5; // used only for the text alignment

camera {location <-7.5,7.5,-20> angle 50 look_at <10,5,0>}
light_source {<10,50,-100>,1.5}


#macro
 LetterNumber
  (StartLetter,EndLetter,StartNumber,EndNumber,SpacingX,SpacingY,SpacingZ)


#declare RedundantObject= // whatever you will be labeling
 union {sphere {0,2} box {-1.5,1.5}}

#declare xV=0; // prepare placement vector floats
#declare yV=0; // this will be the starting vector
#declare zV=0; // so change reset floats as needed

#declare CountNumber=StartNumber; // the starting number, counter

#while (CountNumber<=EndNumber)

#declare CountLetterN=asc(StartLetter); // the starting letter as a number

#while (CountLetterN<=asc(EndLetter)) // count of instances of lettering

#declare Letter=chr(CountLetterN) // get letter from number

// example CSG
#declare TNi=
 text {ttf "arialbd.ttf", concat(Letter,str(CountNumber,0,0)), .5, 0
         align_center // megapov
 // scale 1 rotate 0 // postion to interact with surface of RedundantObject
   translate <0,-.3,-2.25> // <-.725,-.3,-2.25> // for non-megapov
 }

#declare TNo=
 text {ttf "arialbd.ttf", concat(Letter,str(CountNumber,0,0)), .5, 0
         align_center // megapov
 // scale 1 rotate 0 // postion to interact with surface of RedundantObject
   translate <0,-.3,-2.25> // <-.725,-.3,-2.25> // for non-megapov
 }

union {
difference {
 object {RedundantObject}
 object {TNo}
  pigment {rgb .5}
 }
difference {
 object {TNi}
 object {RedundantObject
         inverse
         }
  pigment {rgb 1}
 }
   translate <xV,yV,zV> // position each instance of the object
}
// end CSG

#declare CountLetterN=CountLetterN+1;
#declare xV=xV+SpacingX;

#end

#declare xV=0; // reset
#declare yV=yV+SpacingY;
#declare zV=zV+SpacingZ;

#declare CountNumber=CountNumber+1;

#end

#end // end macro


// Examples:
// StartLetter="G"  // starting letter
// EndLetter="N"    // ending letter
// StartNumber=7;   // starting number
// EndNumber=12;    // ending number
// SpacingX=4;      // spacing for x
// SpacingY=3;      // spacing for y
// SpacingZ=1;      // spacing for z

// sequential labels macro
LetterNumber ("G", "N", 7, 12, 4, 3, 1)


Post a reply to this message

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