|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
hi there, my names matt. ive been using pov for a couple of months off
and on now. i have a few questions. first of all, i need a good place
to learn about media, specifically, media inside of objects. next, i
have a math/coding question. i am attempting to have a bunch of
cylinders have one base one the imaginary surface of a 3 unit wide
sphere and the other side on the inside surface of an imaginary sphere
with a 5 unit diameter. this is what i have so far:
camera
{
location <0,-11,-7>
look_at <0,-2,0>
}
light_source
{
<5,5,5>
color rgb <2,2,2>
}
#declare circ_large_diam=5;
#declare circ_small_diam=3;
#declare y_coord_outer=2.5;
#declare y_coord_inner=1.5;
#declare point_step=10;
#declare current_point=0;
#declare ending_point=360;
#while (y_coord_outer=2.5 >= -2.5)
#while (current_point <= ending_point)
cylinder
{
<cos(radians(current_point))*circ_large_diam,y_coord_outer,sin(radians(cu
rrent_point))*circ_large_diam>,<cos(radians(current_point))*circ_small_di
am,y_coord_inner,sin(radians(current_point))*circ_small_diam>, .15
texture
{
pigment
{
color rgbf <.2,.2,.6,.5>
}
}
}
#declare current_point=current_point+point_step;
#end
#declare circ_small_diam=circ_small_diam-.3;
#declare circ_large_diam=circ_large_diam-.5;
#declare currnet_point=0;
#declare y_coord_outer=y_coord_outer-.25;
#declare y_coord_inner=y_coord_inner-.15;
#end
global_settings
{
assumed_gamma 1.0
ambient_light color rgb <1,1,1>
}
before, i had terribly variable names, it would have been tough for you
to decipher them. the problem then was there there was a degenerate
cylinder (base pt= apex pt), and the error appeared at line 24 or
something (where the texture beginning is), so the error was most likely
where teh points of the cylinder are declared (big duh). now, after i
changed the names, it wont even parse anymore, it starts teh parser, and
doesnt parse any lines. i think i may have to change the double closing
parenthesis to after teh multiplication of the diameter, but im not
sure. any help would be great
thanks a lot
~matt
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
/*
Hi Matt,
I've tried to render your scene and have found some errors (and have some
comments that don't refer to an error):
- In the line containing
#while (y_coord_outer=2.5 >= -2.5)
the "=2.5" is nonsense (copy-and-paste error?).
- In the line (near the end) containing
#declare currnet_point=0;
the name of the variable should be current_point.
- In this line:
#while (current_point <= ending_point)
the "<=" should be replaced by "<" because current_point starts at 0
which is the same (angle) as 360.
- Your formula for the endpoints of the cylinder doesn't put them onto
the inner and outer sphere; instead of circ_large_diam in these
formulas use
sqrt(circ_large_diam*circ_large_diam-y_coord_outer*y_coord_outer)
and instead of circ_small_diam use
sqrt(circ_small_diam*circ_small_diam-y_coord_inner*y_coord_inner)
(and don't change circ_large_diam and circ_small_diam!)
- Using variable names without uppercase letters is a bit risky because
such names might collide with (current or future) keywords. (The POV-
team has promised never to use uppercase letters in keywords.)
- In the cylinder formulas, the variable circ_large_diam is used like a
radius, not a diameter. If it's meant as diameter, then all the
cylinders with y_coord_outer=2.5 will be identical (same with -2.5).
- The ???_point variables were self-explanatory if renamed to ???_angle.
- cumulating non-integer values in #while loops might give a wrong
result due to rounding errors -- it's better to use an integer counter
like this:
#declare Number=36;
#declare Counter=0;
#while (Counter<Number)
#declare Angle=360*Counter/Number;
// use this Angle here
#declare Counter=Counter+1;
#end//while Counter
What about the following scene? (Simply copy this *whole* post to POV-
Ray and render!)
Sputnik
*/
camera { location <0, 5, -10> look_at 0 }
light_source { <-5,5,-5> color rgb <2,2,2> }
#declare OuterRadius=5;
#declare InnerRadius=3;
#declare MaxHeight=2.5;
#declare CylRadius=0.10;
#declare NumberOfHeights=21;
#declare NumberOfAngles=36;
#declare Fraction=InnerRadius/OuterRadius;
#declare HeightCount=0;
#while (HeightCount<NumberOfHeights)
// HeightCount=0...NumberOfHeights-1 -> Height=MaxHeight...-MaxHeight
#declare Height=MaxHeight-2*MaxHeight*HeightCount/(NumberOfHeights-1);
#declare AngleCount=0;
#while (AngleCount<NumberOfAngles)
#declare Radius=sqrt(OuterRadius*OuterRadius-Height*Height);
#declare OuterPoint=<Radius, Height, 0>; // Angle ignored for the moment
cylinder { OuterPoint, OuterPoint*Fraction, CylRadius
texture {
pigment { color rgbf <.2,.2,.6,.5> }
finish { ambient .4 diffuse .6 }
}
rotate AngleCount/NumberOfAngles*360*y // let POV do the trigonometry!
}//cylinder
#declare AngleCount=AngleCount+1;
#end//while AngleCount
#declare HeightCount=HeightCount+1;
#end//while HeightCount
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Matthew Pace" <mat### [at] lycoscom> wrote in message
news:mat### [at] netplexaussieorg...
<snip>
Okay, you introduced the following error when you changed the variable
names:
#declare currnet_point=0;
but this line is weird too (imho):
#while (y_coord_outer >= -2.5) // what?
Correct them, and I get your degenerate point error.
Now, given your condition:
#while (y_coord_outer >= -2.5)
and:
#declare y_coord_outer=2.5;
#declare y_coord_inner=1.5;
and:
#declare y_coord_outer=y_coord_outer-.25;
#declare y_coord_inner=y_coord_inner-.15;
and that you will get an error if the two values are equal, it follows that
they reach equality prior to or at the condition.
You can fix it by modifying the condition to:
#while (y_coord_outer >= -2.5 & y_coord_outer != y_coord_inner)
but I've no idea if this is your intent.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Thanks a lot, both you guys. Its people like you that make the world a
better place, looking out for the n00bs and such.
mad props.
matt
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|