POV-Ray : Newsgroups : povray.newusers : Only take a minute - 1 day later, math question : Only take a minute - 1 day later, math question Server Time
30 Jul 2024 16:15:41 EDT (-0400)
  Only take a minute - 1 day later, math question  
From: Phil Cook
Date: 30 Jan 2004 06:23:07
Message: <opr2k5x2xmp4ukzs@news.povray.org>
I'm trying to create a crescent moon shape as per the code below, which 
took a bit longer than I thought and still has a couple of bugs:) I ran up 
against a interesting problem I'll try and explain it in two dimensions:

A circle with radius MainRadius enclosing a circle of MinorRadius both at 
0 centres.

Create a new circle with radius NewRadius such that when moved *from* 
<-NewRadius,0> *to* <-MinorRadius, 0> points on the circumference pass 
through points: <-MinorRadius,0>(obviously), <0,MajorRadius>, 
<0,-MajorRadius>.

In the instance below I happen to know NewRadius is approx 3.25, but I 
wondered if anyone knew a way of fixing this exactly?

I await huge amounts of unintelligble math :)

Phil
-- 
All thoughts and comments are my own unless otherwise stated and I am 
happy to be proven wrong.

<code>

global_settings {

assumed_gamma 1.0


photons {
count 20000
media 200
autostop 0
jitter .4
}

radiosity {
pretrace_start 0.08
pretrace_end   0.02
nearest_count 10
error_bound 1
low_error_factor 0.1
gray_threshold 0.25
minimum_reuse 0.02
always_sample off
adc_bailout 0.01
}

}

light_source{<0,10,10> rgb 1}

#declare NurseGreen=pigment{rgb <102/255,204/255,153/255>};
#declare NurseBlue=pigment{rgb <0,102/255,204/255>};
#declare BackGreen=rgb <204/255,1,1>;

background{color BackGreen}



#declare MainWidth = 3.15;
#declare Depth = 0.7;
#declare MainAngle = degrees(atan2(Depth,(MainWidth-Depth)));


#declare LengthofSide=sqrt((Depth*Depth)*2);
#declare SecondDegrees= 45;
#declare SecondAngle=SecondDegrees-MainAngle;
#declare SecondHeight=LengthofSide*sin(radians(SecondAngle));
#declare SecondWidth=LengthofSide*cos(radians(SecondAngle));


camera{
location <-(MainWidth-Depth),0,-7>
look_at <-(MainWidth-Depth),0,0>
}

#declare FirstCrescent=
cone{0,MainWidth,<0,0,-Depth>,(MainWidth-Depth) open
clipped_by {box{<7,7,0>,<-7,-7,-2> rotate -y*MainAngle inverse}}}

#declare SecondCrescent=

cone{0,(3.25-SecondWidth),<0,0,-SecondHeight>,3.25 open translate 
<3.25,0,SecondHeight> rotate -y*MainAngle translate <-2.45,0,-Depth>
clipped_by{box{<5,5,0>,<-5,-5,2> inverse}}}


object{FirstCrescent pigment{NurseGreen} finish{ambient 0}}
object{SecondCrescent pigment{NurseBlue} finish{ambient 0}}

</code>


Post a reply to this message

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