POV-Ray : Newsgroups : povray.binaries.images : Knurling Macro Server Time
1 Aug 2024 00:18:36 EDT (-0400)
  Knurling Macro (Message 1 to 10 of 10)  
From: CShake
Subject: Knurling Macro
Date: 25 Mar 2009 00:28:05
Message: <49c9b2d5$1@news.povray.org>
Just finished a macro that will generate a knurled cylinder (since you 
can't really knurl anything else, it's a lathe operation...).

Parameters are:
major_radius (radius to the middle of the knurl)
knurl_depth
edge_length (edge being the sides of the square for each point)
cylinder_height
flatten_percent (amount of the point flattened off)

Thanks to clipka for how to CSG with a mesh and have it preserve 
interior, I had never seen inside_vector before.

It was inspired by the impressive looking hockey puck by P Brewer, and 
since he said it was too hard to figure out the mesh, I took it as a 
math challenge. It is mainly a mesh2, fully optimized with no 
overlapping vertexes.
If there is any desire, I will clean it up and post an include file in 
p.b.sf, else I'll just be happy with my own work.

cshake


Post a reply to this message


Attachments:
Download 'knurling.jpg' (32 KB)

Preview of image 'knurling.jpg'
knurling.jpg


 

From: CShake
Subject: Re: Knurling Macro
Date: 25 Mar 2009 00:31:30
Message: <49c9b3a2$1@news.povray.org>
Ok, I'm just being stupid, it should be diagonal. I'll work on that now.

CShake wrote:
> Just finished a macro that will generate a knurled cylinder (since you 
> can't really knurl anything else, it's a lathe operation...).
> 
> Parameters are:
> major_radius (radius to the middle of the knurl)
> knurl_depth
> edge_length (edge being the sides of the square for each point)
> cylinder_height
> flatten_percent (amount of the point flattened off)
> 
> Thanks to clipka for how to CSG with a mesh and have it preserve 
> interior, I had never seen inside_vector before.
> 
> It was inspired by the impressive looking hockey puck by P Brewer, and 
> since he said it was too hard to figure out the mesh, I took it as a 
> math challenge. It is mainly a mesh2, fully optimized with no 
> overlapping vertexes.
> If there is any desire, I will clean it up and post an include file in 
> p.b.sf, else I'll just be happy with my own work.
> 
> cshake
> 
> ------------------------------------------------------------------------
>


Post a reply to this message

From: CShake
Subject: Re: Knurling Macro
Date: 25 Mar 2009 12:26:35
Message: <49ca5b3b@news.povray.org>
Sorry about the incorrect last one, that was just a square bumps thing, 
here's a real knurl.
Once again, the shape of the 'cylinder' itself is defined, then the 
spacing of the peaks (this time different for vertical and horizontal, 
to allow for non-45degree angles of knurling). Tops of peaks can be 
flattened off, and the valleys can be chopped too (though that isn't 
possible when doing this on a lathe).

As before, it is an optimized mesh2 with the minimum possible number of 
vertexes and triangles, and if anyone wants it I can post the macro.

cshake


Post a reply to this message


Attachments:
Download 'knurling.png' (275 KB)

Preview of image 'knurling.png'
knurling.png


 

From: clipka
Subject: Re: Knurling Macro
Date: 25 Mar 2009 12:55:00
Message: <web.49ca611025cfdcec1f399840@news.povray.org>
CShake <cshake+pov### [at] gmailcom> wrote:
> As before, it is an optimized mesh2 with the minimum possible number of
> vertexes and triangles, and if anyone wants it I can post the macro.

How 'bout adding it to the POV object collection?


Post a reply to this message

From: P Brewer
Subject: Re: Knurling Macro
Date: 25 Mar 2009 12:55:00
Message: <web.49ca61b825cfdce3653e1bc0@news.povray.org>
Beautiful... next time we'll have to work together. =)

This would have saved me quite a lot of frustration and time.


Post a reply to this message

From: CShake
Subject: Re: Knurling Macro
Date: 26 Mar 2009 00:28:32
Message: <49cb0470$1@news.povray.org>
clipka wrote:
> How 'bout adding it to the POV object collection?
> 

Done. Have fun.

I followed all the specifications on the help page for standards 
compliance, though the file does produce a runtime parse warning (patch 
objects not allowed in an intersection) but works as expected with no 
artifacts or anything. Tested in MegaPOV 1.2.1 and POV 3.7b31


Post a reply to this message

From: Kenneth
Subject: Re: Knurling Macro
Date: 27 Mar 2009 05:20:01
Message: <web.49cc99e925cfdcef50167bc0@news.povray.org>
CShake <cshake+pov### [at] gmailcom> wrote:
> Sorry about the incorrect last one, that was just a square bumps thing,
> here's a real knurl.
> Once again, the shape of the 'cylinder' itself is defined, then the
> spacing of the peaks (this time different for vertical and horizontal,
> to allow for non-45degree angles of knurling). Tops of peaks can be
> flattened off, and the valleys can be chopped too (though that isn't
> possible when doing this on a lathe).
>

Beautiful work!  This is a 'keeper' image for me, going into my collection.

I was wondering if you had previously tried the 'quilted' pattern (as turned
into a function, for use with the HF_Cylinder macro in shapes.inc)? That would
seem to be an alternate method to create a knurling effect on a cylinder,
although I haven't tried it myself.

Ken W.


Post a reply to this message

From: CShake
Subject: Re: Knurling Macro
Date: 27 Mar 2009 16:45:16
Message: <49cd3adc$1@news.povray.org>
Kenneth wrote:
> I was wondering if you had previously tried the 'quilted' pattern (as turned
> into a function, for use with the HF_Cylinder macro in shapes.inc)? That would
> seem to be an alternate method to create a knurling effect on a cylinder,
> although I haven't tried it myself.
> 
> Ken W.
> 
> 

Actually I hadn't thought of that, I just have a mental association 
between functions and normals, so I never thought of using it as a 
heightfield. I may look into that at some point, maybe see if there are 
performance gains for one implementation over the other.


Post a reply to this message

From: clipka
Subject: Re: Knurling Macro
Date: 27 Mar 2009 17:15:01
Message: <web.49cd418125cfdce208afb30@news.povray.org>
CShake <cshake+pov### [at] gmailcom> wrote:
> Actually I hadn't thought of that, I just have a mental association
> between functions and normals, so I never thought of using it as a
> heightfield. I may look into that at some point, maybe see if there are
> performance gains for one implementation over the other.

A cylindrical HF macro will do nothing different from what you did - it actually
creates a mesh, too - except that it cannot optimize, and you may get
"interference pattern" if you choose a too low resolution. So I guess your
custom-tailored knurl mesh should always be faster and of better quality.


Post a reply to this message

From: Kenneth
Subject: Re: Knurling Macro
Date: 28 Mar 2009 00:35:00
Message: <web.49cda84425cfdcef50167bc0@news.povray.org>
"clipka" <nomail@nomail> wrote:

> A cylindrical HF macro will do nothing different from what you did - it actually
> creates a mesh, too - except that it cannot optimize, and you may get
> "interference pattern" if you choose a too low resolution. So I guess your
> custom-tailored knurl mesh should always be faster and of better quality.

Ah yes, you're right about that. And the HF_Cylinder macro can be quite slow at
hi-rez.

KW


Post a reply to this message

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