POV-Ray : Newsgroups : povray.newusers : Only take a minute - 1 day later, math question : Managed to find the math but still a slight annoyance Server Time
5 Nov 2024 11:16:31 EST (-0500)
  Managed to find the math but still a slight annoyance  
From: Phil Cook
Date: 30 Jan 2004 08:29:42
Message: <opr2lbsxeqp4ukzs@news.povray.org>
Well I managed to find the math and even seem to have managed to convert 
it to POV correctly :),  however it seems to calculate y incorrectly; as I 
know it's 0 not a problem but it is bugging me.

<code>
//All the Math

#declare x1=0;
#declare y1=-MainWidth;
#declare x2=-(MainWidth-Depth);
#declare y2=0;
#declare x3=0;
#declare y3=MainWidth;

#declare ma=(y2-y1)/(x2-x1);
#declare mb=(y3-y2)/(x3-x2);

#declare myx=((ma*mb*(y1-y3))+(mb*(x1+x2))-(ma*(x2+x3)))/(2*(mb-ma));
#declare myy=(ma*(myx-x1))+y1;

#declare NewRadius=(MainWidth-Depth)+myx;

#debug concat("ma is:",str(ma,5,-1),"\n")
#debug concat("mb is:",str(ma,5,-1),"\n")
#debug concat("myx is:",str(myx,5,-1),"\n")
#debug concat("myy is:",str(myy,5,-1),"\n")
#debug concat("NewRadius is:",str(NewRadius,5,-1),"\n")
</code>

and changed

<code>
#declare FirstCrescent=
difference{
cone{0,MainWidth,<0,0,-Depth>,(MainWidth-Depth) open}
cylinder{<myx,0,1>,<myx,0,-1>,NewRadius}
}
</code>

Which removes the overlap from the first code and seems to be okay, handy 
bit of math if the y worked.

--
Phil

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


Post a reply to this message

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