POV-Ray : Newsgroups : povray.object-collection : Knurledcylinder.inc, v1 Server Time: 25 Jan 2021 18:01:11 GMT
 Knurledcylinder.inc, v1 (Message 1 to 6 of 6)
 From: StephenS Subject: Knurledcylinder.inc, v1 Date: 19 Apr 2009 00:30:00 Message:
```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"
// 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
```
 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"
> // 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 hpeaks = 32; // number of peaks
```

Attachments:

 From: clipka Subject: Re: Knurledcylinder.inc, v1 Date: 19 Apr 2009 10:30:00 Message:
```"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".
```
 From: StephenS Subject: Re: Knurledcylinder.inc, v1 Date: 19 Apr 2009 11:55:01 Message:
```"Tim Attwood" <tim### [at] anti-spamcomcastnet> wrote:
....
> // example
> #declare hpeaks = 32; // number of peaks

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
```
 From: StephenS Subject: Re: Knurledcylinder.inc, v1 Date: 19 Apr 2009 14:00:00 Message:
```"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

the +1 part at the end, seems to be closer to what I want.

Stephen S
```
 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
>
>
> 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
```