POV-Ray : Newsgroups : povray.object-collection : Knurledcylinder.inc, v1 : Re: Knurledcylinder.inc, v1 Server Time
30 Mar 2023 20:05:09 EDT (-0400)
  Re: Knurledcylinder.inc, v1  
From: CShake
Date: 26 Apr 2009 23:05:34
Message: <49f520fe$1@news.povray.org>
StephenS wrote:
> "StephenS" <nomail@nomail> wrote:
> ....
>> The macro seems to force an odd number of peaks so they line up at the
>> start/finish, I think this is the part not working as expected.
> Replaceing line 43
>  //#local divs=floor((pi*mean_radius*2/horiz_spacing)/2)*2+1;
>  #local divs=floor((pi*mean_radius*2/horiz_spacing)/2)*2;
> the +1 part at the end, seems to be closer to what I want.
> Stephen S
Thanks, I guess I missed the error at start/finish on this version. The 
odd-forcing code came from a previous algorithm I tried that did require 
odd numbers, and it seems this one requires even.

As for the peak count issue, I went with the parameter I did because of 
the way that real knurling works (a tool with a specific pattern is 
pressed into the cylinder), where the 'specified' parameters are the 
spacing, which doesn't depend on radius.
As you can see on line 43 (v1.0), it calculates the number of divisions 
based on the radius and spacing. If you really want to control how many 
divisions there are, just do that formula backwards.

New version (v1.1) has just been uploaded that incorporates fixes from 
you and Tim Attwood (The CSG part)
As clipka noted the 'inside_vector' wasn't wrong, I intentionally put it 
pointing out the side because it is more important for the knurl surface 
to be correct than the end caps. Though it doesn't make a difference on 
this object.


Post a reply to this message

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