POV-Ray : Newsgroups : povray.binaries.images : One Word : sin/cos gear (4kb) Server Time
1 Aug 2024 10:17:20 EDT (-0400)
  sin/cos gear (4kb)  
From: stbenge
Date: 2 Jan 2009 03:59:03
Message: <495dd757@news.povray.org>
andrel wrote:
> On 31-Dec-08 22:39, stbenge wrote:
>> The loop is the engine, sin/cos are two parts of a gear, and pi is the 
>> number of teeth. 

Maybe my metaphor isn't entirely accurate...

> I wanna see that wheel with pi teeth. Can you render one?

Sure! I'm going to assume you aren't actually asking for a visual pun. 
Here is some code I put together:

#macro gear(gRad, gInset, nTeeth, pThick)
  //gRad		gear radius
  //gInset	teeth depth (from radius)
  //nTeeth	number of teeth
  //pThick	prism thickness
  #local nPoints = 4*nTeeth;
  #local tooth = pi*2/nPoints;
  prism{
   -pThick,pThick,nPoints
   #local V = 0;
   #while(V<nPoints)
    #local rV = (gRad-gInset/2)+cos(tooth*V*nTeeth+pi/4)*gInset/2;
    <sin(tooth*V)*rV, cos(tooth*V)*rV>
    #local V = V + 1;
   #end
   rotate y*180/nPoints
  }
#end

object{
  gear(1,.1, 30, .1)
  pigment{rgb 1}
}

It's just your basic gear, nothing fancy.

Sam


Post a reply to this message


Attachments:
Download 'gear.png' (3 KB)

Preview of image 'gear.png'
gear.png


 

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