POV-Ray : Newsgroups : povray.general : cos & sin functions : Re: cos & sin functions Server Time
2 Aug 2024 00:11:59 EDT (-0400)
  Re: cos & sin functions  
From: kurtz le pirate
Date: 20 Feb 2005 01:39:44
Message: <kurtzlepirate-9E51FD.07394420022005@news.povray.org>
In article <web.4217a68c1eb30463d977fb9c0@news.povray.org>,
 "Tjeiken" <nomail@nomail> wrote:

>>i'm working on a trebuchet, that i should have animated. The problem is,
>>that i gotta have a piece rotating around a centerpoint in a circle. I'm
>>going to use cos and sin functions to get the x and y coordinates like
>>this:
>>cos(A)*r=x
>>sin(A)*r=y
>>
>>A=angle r=radius
>>The problem is, that when i use it, either the POV-Ray, or my calculator are
>>calculating wrong - most likely POV-Ray. my .pov code looks like this:
>>----------------------------------
>>#include "woods.inc"
>>declare beam = box{<0,0,0><1,1,1>
>>texture{T_Wood20}
>>}
>>#declare ANGLE = 1; /*change this to 1,2,3 etc.*/
>>object{beam scale<1.9,35.56,1.27> translate<0,43,2.54> translate
>>x*cos(ANGLE)*-22.86 translate y*sin(ANGLE)*-22.86}
>>--------------------------------------------
>>For me, it just looks like the beam is jumping around, rather than following
>>a circular pattern, which it should do.
>>Hope you can help me.
>>-Tjeiken


yes use sind() and cosd() like this :


#macro sind(deg_angle) sin(radians(deg_angle)) #end
#macro cosd(deg_angle) cos(radians(deg_angle)) #end

#declare a = 30; // 30 degrees
#debug concat("\n sin(",str(a,0,0),") = ",str(sind(a),14,12))
#debug concat("\n cos(",str(a,0,0),") = ",str(cosd(a),14,12))
#debug "\n\n"


hope that help


Post a reply to this message

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