POV-Ray : Newsgroups : povray.object-collection : Knurledcylinder.inc, v1 Server Time: 26 Jun 2019 19:59:27 GMT
  Knurledcylinder.inc, v1 (Message 1 to 6 of 6)  
From: StephenS
Subject: Knurledcylinder.inc, v1
Date: 19 Apr 2009 00:30:00
Message: <web.49ea6f8fc39edf94657fc0c50@news.povray.org>
I'm trying to use the KnurledCylinder.inc, from cshake, and I'm getting overlap
at start/finish?
How would I formulate how many peaks, instead of horizontalspacing? Probably
based on radius and some other math...

#include "KnurledCylinder.inc"
//KnurledCylinder(Radius, CylinderHeight, KnurlDepth, HorizontalSpacing,
// VerticalSpacing, FlattenPercent, RaisePercent)
KnurledCylinder(.98/2,.34,.02,.065/2,.095/2,.50,.50)
object{KnurledCylinder(.98/2,.4,.02,.065/2,.095/2,.50,.50) translate<0,.425,0>}

It's with other CSG and moved around.
I'll post a picture.

Stephen S


Post a reply to this message

From: Tim Attwood
Subject: Re: Knurledcylinder.inc, v1
Date: 19 Apr 2009 06:45:35
Message: <49eac88f$1@news.povray.org>
> I'm trying to use the KnurledCylinder.inc, from cshake, and I'm getting 
> overlap
> at start/finish?
> How would I formulate how many peaks, instead of horizontalspacing? 
> Probably
> based on radius and some other math...
>
> #include "KnurledCylinder.inc"
> //KnurledCylinder(Radius, CylinderHeight, KnurlDepth, HorizontalSpacing,
> // VerticalSpacing, FlattenPercent, RaisePercent)
> KnurledCylinder(.98/2,.34,.02,.065/2,.095/2,.50,.50)
> object{KnurledCylinder(.98/2,.4,.02,.065/2,.095/2,.50,.50) 
> translate<0,.425,0>}
>
> It's with other CSG and moved around.
> I'll post a picture.

I had a look at the macro...
The cylinder height is wrong because intersections
work poorly with mesh2, and the mesh goes a bit high.
The inside vector is outside as well, which can't be good.
Attached is a modified include that fixes that stuff.

As for using a count of peaks that's just 2*pi*radius...

// example
#declare rad = 0.5; // radius
#declare hpeaks = 32; // number of peaks
#declare hspacing = (2*pi*rad)/hpeaks;
#declare kc = KnurledCylinder(rad,1,0.025,hspacing,0.05,0.50,0.25);


Post a reply to this message


Attachments:
Download 'us-ascii' (5 KB)

From: clipka
Subject: Re: Knurledcylinder.inc, v1
Date: 19 Apr 2009 10:30:00
Message: <web.49eafc1ca68f5a58990f413d0@news.povray.org>
"Tim Attwood" <tim### [at] anti-spamcomcastnet> wrote:
> The cylinder height is wrong because intersections
> work poorly with mesh2, and the mesh goes a bit high.

Intersections work perfectly fine with mesh2 provided that there are no
openings, and the "inside vector" is good...

> The inside vector is outside as well, which can't be good.
> Attached is a modified include that fixes that stuff.

.... which, by the way, despite common misconception is a pure direction, and not
a point in space (hence the name "inside vector" instead of "inside location" or
"inside point"), so it cannot be "outside".


Post a reply to this message

From: StephenS
Subject: Re: Knurledcylinder.inc, v1
Date: 19 Apr 2009 11:55:01
Message: <web.49eb101ca68f5a581d4b2b4c0@news.povray.org>
"Tim Attwood" <tim### [at] anti-spamcomcastnet> wrote:
....
> // example
> #declare rad = 0.5; // radius
> #declare hpeaks = 32; // number of peaks
> #declare hspacing = (2*pi*rad)/hpeaks;
> #declare kc = KnurledCylinder(rad,1,0.025,hspacing,0.05,0.50,0.25);

Thank you, will work with this.
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.

Stephen S


Post a reply to this message

From: StephenS
Subject: Re: Knurledcylinder.inc, v1
Date: 19 Apr 2009 14:00:00
Message: <web.49eb2e2ca68f5a58b4b7d5490@news.povray.org>
"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


Post a reply to this message

From: CShake
Subject: Re: Knurledcylinder.inc, v1
Date: 27 Apr 2009 03: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.

CShake


Post a reply to this message

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