POV-Ray : Newsgroups : povray.newusers : How to create scene component library? : How to create scene component library? Server Time
28 Jul 2024 20:34:48 EDT (-0400)
  How to create scene component library?  
From: Marty Schrader
Date: 17 Aug 2007 15:44:09
Message: <46c5fa89$1@news.povray.org>
I am trying to create a library of POV-Ray components to be used in creating 
model rocket designs. (The same considerations would apply to any type of design 
application, though.) I need to make fins, fin sets, nose cones, fuselage size 
reducers, and other components all modular so that the rocket being modeled can 
be altered at will. If I were using a commercial design program this wouldn't be 
a problem, I guess, but the whole point here is to make it POV-Ray based and 
release it to the public domain.

Okay, so how do I do this? I have included a simple rocket file to show you what 
I am doing. Note that the surface texture is wrong; I still don't know how to 
paint a regular surface on to a curve. Heh. This is a farily accurate rendering 
of an actual model rocket I fly all the time:

   http://www.theschraderfamily.com/Marty/Images/SlugLaunch.jpg


// Rocket basic.pov

#include "colors.inc"
#include "textures.inc"

#global_settings { assumed_gamma 0.75 }

#declare AirframeColor = <1, 1, 1>;

/* Dimensions are in inches, since that is how
it is supplied from the airframe vendor */

#declare AirframeLength = 9.66;
#declare AirframeDiameter = 1.63;
#declare NoseConeLength = 4.67;
#declare FinBase = 2;

#default {
     texture { pigment { color AirframeColor } }
     finish { ambient 0.1 diffuse 0.9 }
}

background { White * 0.71 }

#declare Pov = (AirframeLength + NoseConeLength) / 2;

/*
camera {
     location <0, Pov, -(Pov * 2.5)>
     look_at  <0, Pov, 0>
}
*/
camera {
     orthographic
     location <Pov, 0, -(Pov * 1.8)>
     look_at  <Pov, 0, 0>
}

// main lighting
light_source {
     <0, AirframeLength, -10>
     color White
     shadowless
}

#macro Airframe(Diameter, Length)
cylinder {
     <0, 0, 0>,
     <0, Length, 0>, Diameter / 2
     pigment { checker White, Black scale 0.5 }
     rotate <0, 45, 0>
}
#end

#macro NoseCone(Diameter, Length)
#declare Radius = Diameter / 2;
lathe {
     bezier_spline
          4,
          <0, 0>,
          <Radius, Length * 0.3>,
          <Radius, Length>,
          <Radius, Length>
     rotate <180, 0, 0>
     translate <0, Length, 0>
}
#end

#macro Fin(Diameter, Base, Radian)
prism {
     linear_spline 0, 0.05, 3, <0, 0>, <Base, 0>, <0, Base>
     rotate <270, 0, 0>
     translate <Diameter / 2, 0, 0>
     rotate <0, Radian, 0>
}
#end

// ----- Final rocket -----
#macro Rocket(Diameter, BodyLength, NoseLength)
union {
     Airframe(Diameter, BodyLength)
     cylinder {  // launch lug
         <0, 0, 0>,
         <0, 1.5, 0>, 0.125
         pigment { color White }
         translate <(Diameter / 2), (BodyLength / 3), 0>
         rotate <0, 45, 0>
     }
     union {
         NoseCone(Diameter, NoseLength) translate <0, BodyLength, 0> texture {
             pigment { color Black }
         }
     }
     Fin(Diameter, FinBase, 0)
     Fin(Diameter, FinBase, 90)
     Fin(Diameter, FinBase, 180)
     Fin(Diameter, FinBase, 270)
}
#end

union {
     Rocket(AirframeDiameter, AirframeLength, NoseConeLength)
     rotate <-15, 30, 270>
}


Post a reply to this message

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