POV-Ray : Newsgroups : povray.programming : combining isosurface and CSG Server Time 3 Jun 2023 04:46:47 EDT (-0400)
 combining isosurface and CSG (Message 1 to 5 of 5)
 From: Reiner Jung Subject: combining isosurface and CSG Date: 13 Jan 2009 09:15:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.496ca19e2d7d22092e58f6c00%40news.povray.org",
"dateCreated": "2009-01-13T14:15:00+00:00",
"datePublished": "2009-01-13T14:15:00+00:00",
"author": {
"@type": "Person",
"name": "Reiner Jung"
}
}
Hello,

I've searched the povray site and googled, but either I am too stupid to
formulate my question correctly or I'm blind or overlooking something.

I am working on a larger hobby project and therefore I need screws, nuts, bolts,
etc. Therefore I created a function which generates a screw thread. Also I
constructed a hexagon nut. For the hole in nut I tried to subtract the screw
thread from the nut like this:

difference {
object {nut_body}
union {
isosurface {
function{ f_helix1( x,y,z,
1,    // number of helixes, (1 = single helix, 2 = double helix etc.)
(2*pi)/incline,   // period,      turns on the length of 2*pi
1,    // shape parameter,
2.0,  // cross section type,
// (0.0 to 1.0 = square ... rounded to circle
// over 2.0 to 3.0 = rounded to diamond and concave diamond
0 )   // cross section rotation angle
}
contained_by {box { -length/2 , length/2 }}
threshold 0
accuracy 0.0001
all_intersections
}
cylinder {<0,-length/2,0>,<0,length/2,0>,inner}
}
}

As a result I get a nut with a squared hole in the middle instead of a hole
drilled into the nut_body by the isosurface.

The povray documentation states that isosurface can be combined with solid
objects, however this does not work in this example. So what am I missing? Or
do I have to remodel the nut_body with a function as well and subtract both
functions?

Reiner
```
 From: clipka Subject: Re: combining isosurface and CSG Date: 13 Jan 2009 10:15:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"headline": "Re: combining isosurface and CSG",
"dateCreated": "2009-01-13T15:15:00+00:00",
"datePublished": "2009-01-13T15:15:00+00:00",
"author": {
"@type": "Person",
"name": "clipka"
}
}
"Reiner Jung" <nomail@nomail> wrote:
>   isosurface {
>     function{ f_helix1( x,y,z,
>    1,    // number of helixes, (1 = single helix, 2 = double helix etc.)
>    (2*pi)/incline,   // period,      turns on the length of 2*pi
>    1,    // shape parameter,
>    2.0,  // cross section type,
>          // (0.0 to 1.0 = square ... rounded to circle
>          // over 2.0 to 3.0 = rounded to diamond and concave diamond
>    0 )   // cross section rotation angle
>     }
>     contained_by {box { -length/2 , length/2 }}
>     ...

Check the settings for the contained_by box; as it is now, it only works if the

Note that POV-Ray automatically expands scalar values to vectors where needed,
so your contained_by box actually is:

contained_by {box { <-length/2,-length/2,-length/2>,
<length/2,length/2,length/2> }}

You probably want something like:

contained_by {box { <-nominal-incline*2, -length/2, -nominal-incline*2>,
<nominal+incline*2, length/2, nominal+incline*2> }}
```
 From: Mike Williams Subject: Re: combining isosurface and CSG Date: 13 Jan 2009 10:22:27 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#Qy8SKXAYGLbJFw22%40econym.demon.co.uk",
"headline": "Re: combining isosurface and CSG",
"dateCreated": "2009-01-13T15:22:27+00:00",
"datePublished": "2009-01-13T15:22:27+00:00",
"author": {
"@type": "Person",
"name": "Mike Williams"
}
}
Wasn't it Reiner Jung who wrote:
>
>Hello,
>
>I've searched the povray site and googled, but either I am too stupid to
>formulate my question correctly or I'm blind or overlooking something.
>
>I am working on a larger hobby project and therefore I need screws,
>nuts, bolts,
>etc. Therefore I created a function which generates a screw thread. Also I
>constructed a hexagon nut. For the hole in nut I tried to subtract the screw
>thread from the nut like this:
>
>difference {
>      object {nut_body}
>      union {
>  isosurface {
>    function{ f_helix1( x,y,z,
>   1,    // number of helixes, (1 = single helix, 2 = double helix etc.)
>   (2*pi)/incline,   // period,      turns on the length of 2*pi
>   1,    // shape parameter,
>   2.0,  // cross section type,
>         // (0.0 to 1.0 = square ... rounded to circle
>         // over 2.0 to 3.0 = rounded to diamond and concave diamond
>   0 )   // cross section rotation angle
>    }
>    contained_by {box { -length/2 , length/2 }}
>    threshold 0
>    accuracy 0.0001
>    all_intersections
>  }
>  cylinder {<0,-length/2,0>,<0,length/2,0>,inner}
> }
>}
>
>As a result I get a nut with a squared hole in the middle instead of a hole
>drilled into the nut_body by the isosurface.
>
>The povray documentation states that isosurface can be combined with solid
>objects, however this does not work in this example. So what am I missing? Or
>do I have to remodel the nut_body with a function as well and subtract both
>functions?

That works fine for me. I had to guess suitable values for length,
incline, nominal, inner and nut_body. Perhaps you're using unsuitable
values for some of those. Here are the values that I used:

#declare length = 2.5;
#declare incline = 0.5;
#declare nominal = 0.1;
#declare inner = 0.5;

#declare nut_body = box {<-1.5,-1,-1.5><1.5,1,1.5>}

#include "functions.inc"

--
Mike Williams
Gentleman of Leisure
```
 From: Mike Williams Subject: Re: combining isosurface and CSG Date: 13 Jan 2009 10:25:59 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#XyLT66AEKLbJFw3o%40econym.demon.co.uk",
"headline": "Re: combining isosurface and CSG",
"dateCreated": "2009-01-13T15:25:59+00:00",
"datePublished": "2009-01-13T15:25:59+00:00",
"author": {
"@type": "Person",
"name": "Mike Williams"
}
}
Wasn't it Reiner Jung who wrote:
>
>Hello,
>
>I've searched the povray site and googled, but either I am too stupid to
>formulate my question correctly or I'm blind or overlooking something.

By the way, this is totally the wrong newsgroup for this sort of
question. This group is about programming the code that goes into
povengine.exe, not for problems with scenes.

--
Mike Williams
Gentleman of Leisure
```
 From: Thorsten Froehlich Subject: Re: combining isosurface and CSG Date: 13 Jan 2009 14:37:16 Message: <496ced6c\$1@news.povray.org>
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#496ced6c%241%40news.povray.org",
"headline": "Re: combining isosurface and CSG",
"dateCreated": "2009-01-13T19:37:16+00:00",
"datePublished": "2009-01-13T19:37:16+00:00",
"author": {
"@type": "Person",
"name": "Thorsten Froehlich"
}
}
Reiner Jung wrote:
> I am working on a larger hobby project and therefore I need screws, nuts, bolts,
> etc. Therefore I created a function which generates a screw thread. Also I
> constructed a hexagon nut. For the hole in nut I tried to subtract the screw
> thread from the nut like this:

This is the wrong group for this question.  This group is for discussion of
the POV-Ray source code, not general questions of using POV-Ray.  Questions
povray.newusers.

Thorsten, POV-Team
```