POV-Ray : Newsgroups : povray.newusers : Problem: using difference Server Time
25 Dec 2024 13:31:47 EST (-0500)
  Problem: using difference (Message 1 to 5 of 5)  
From: Peter
Subject: Problem: using difference
Date: 11 Oct 2002 02:12:59
Message: <3da66bea@news.povray.org>
Hi - can someone please help me get this difference right?  I'm just new to 
povray, so there is probably something simple I'm missing.

Aim: to get a curved row of square holes in a ring.
I thought I'd use a torus for the ring, some boxes for the holes and 
difference to punch the holes in the ring.

The script below illustrates what I'm after.  Set the switch swt at the top 
to see different parts;
swt = 0 shows the plain ring
swt = 1 shows the bent row of boxes by themselves
swt = 2 shows a straight row of holes in the ring
swt = 3 shows a bent row of holes in the ring - except it doesn't work.

Can someone please advise me how to get this difference function working?  
(Or advise a better way to do this?)

TIA

Peter

PS the bend.inc file is by Chris Colefax.
http://www.geocities.com/SiliconValley/Lakes/1434/bend.html
-----------------------------
// test piece for bend.inc tool

light_source { <-10,10,-20>  color rgb <1,1,1> }

camera {  location  <0, -2, -5>
  look_at   <0, 0,  0>
  right     x*image_width/image_height  
}

#declare swt = 0;  // swt = 0, 1, 2, 3 

#declare torus1 = torus {  1.273,  0.3 
  rotate<90,0,0>
  scale<1,1,.2>
}

#declare boxes = union {
 box{< 0.0, -1.47, -1> < 0.2, -1.27, 1>}
 box{< 0.2, -1.27, -1> < 0.4, -1.07, 1>}
 box{< 0.4, -1.47, -1> < 0.6, -1.27, 1>}
 box{< 0.6, -1.27, -1> < 0.8, -1.07, 1>}
 box{< 0.8, -1.47, -1> < 1.0, -1.27, 1>}
 box{< 1.0, -1.27, -1> < 1.2, -1.07, 1>}
 box{< 1.2, -1.47, -1> < 1.4, -1.27, 1>}
 box{< 1.4, -1.27, -1> < 1.6, -1.07, 1>}
 box{< 1.6, -1.47, -1> < 1.8, -1.27, 1>}
 box{< 1.8, -1.27, -1> < 2.0, -1.07, 1>}
}

#if (swt = 0) #declare theshape = object { torus1 }

#else

// bend options
#declare object_axis1 = < 0, -1.27, 0>;
#declare object_axis2 = < 2, -1.27, 0>;
#declare bend_angle = 90;
#declare bend_direction = y;
#declare bend_object = object{ boxes }
#declare bent_object = object{
 #include "Bend.inc"
}
#if (swt = 1) #declare theshape = object{ bent_object }

#else 

#if (swt = 2) 
#declare theshape = difference{
 object{ torus1 }
 object{ bend_object }
}

#else
#declare theshape = difference{
 object{ torus1 }
 object{ bent_object }
}
#end
#end
#end

object{ theshape
 pigment{color rgb<.4,.3,.8>}
}
-----------------------------


Post a reply to this message

From: hughes, b 
Subject: Re: Problem: using difference
Date: 11 Oct 2002 06:37:59
Message: <3da6aa07@news.povray.org>
Hi Peter. Hmmmm, well I can't readily explain it without really delving into
Bend.inc I guess but I do have what seems to be the answer anyhow:

#declare theshape = difference{
 object{ bent_object
   inverse
   }
 object{ torus1
   inverse
   }
 inverse
}

Not exactly logical, is that...? :-)
--
Farewell,
Bob

"Peter" <nos### [at] yahooconz> wrote in message
news:3da66bea@news.povray.org...
>
> Aim: to get a curved row of square holes in a ring.
> I thought I'd use a torus for the ring, some boxes for the holes and
> difference to punch the holes in the ring.


Post a reply to this message

From: Sascha Ledinsky
Subject: Re: Problem: using difference
Date: 11 Oct 2002 06:53:00
Message: <3da6ad8c$1@news.povray.org>
Hi,

I'm not quite sure, but I think the problem is caused by the 'clipped_by' in
bend.inc. Bend.inc cuts your object into several slices and then transforms
each of it, but the individual slices are no solid objects anymore because
the have been 'clipped_by' some planes. This way ist impossible for the csg
to decide whats inside and whats outside of the 'bent_object'

It's strage to me that an 'intersection' with the same 'bent_object'
works...

If you want exactly this object for your scene you should place the cubes
using a #while loop to rotate them into position.
If you need a more complex object to be bent by the include-file and then
subtracted from an other object I think the only way is to re-write the
include file not to use clipped_by but true csg-operations to slice the
'bend_object'...

Again, this is just a guess, has anyone another explaination for this?
-sascha

"Peter" <nos### [at] yahooconz> wrote in message
news:3da66bea@news.povray.org...
>
> Hi - can someone please help me get this difference right?  I'm just new
to
> povray, so there is probably something simple I'm missing.
>
> Aim: to get a curved row of square holes in a ring.
> I thought I'd use a torus for the ring, some boxes for the holes and
> difference to punch the holes in the ring.
>
> The script below illustrates what I'm after.  Set the switch swt at the
top
> to see different parts;
> swt = 0 shows the plain ring
> swt = 1 shows the bent row of boxes by themselves
> swt = 2 shows a straight row of holes in the ring
> swt = 3 shows a bent row of holes in the ring - except it doesn't work.
>
> Can someone please advise me how to get this difference function working?
> (Or advise a better way to do this?)
>
> TIA
>
> Peter
>
> PS the bend.inc file is by Chris Colefax.
> http://www.geocities.com/SiliconValley/Lakes/1434/bend.html
> -----------------------------
> // test piece for bend.inc tool
>
> light_source { <-10,10,-20>  color rgb <1,1,1> }
>
> camera {  location  <0, -2, -5>
>   look_at   <0, 0,  0>
>   right     x*image_width/image_height
> }
>
> #declare swt = 0;  // swt = 0, 1, 2, 3
>
> #declare torus1 = torus {  1.273,  0.3
>   rotate<90,0,0>
>   scale<1,1,.2>
> }
>
> #declare boxes = union {
>  box{< 0.0, -1.47, -1> < 0.2, -1.27, 1>}
>  box{< 0.2, -1.27, -1> < 0.4, -1.07, 1>}
>  box{< 0.4, -1.47, -1> < 0.6, -1.27, 1>}
>  box{< 0.6, -1.27, -1> < 0.8, -1.07, 1>}
>  box{< 0.8, -1.47, -1> < 1.0, -1.27, 1>}
>  box{< 1.0, -1.27, -1> < 1.2, -1.07, 1>}
>  box{< 1.2, -1.47, -1> < 1.4, -1.27, 1>}
>  box{< 1.4, -1.27, -1> < 1.6, -1.07, 1>}
>  box{< 1.6, -1.47, -1> < 1.8, -1.27, 1>}
>  box{< 1.8, -1.27, -1> < 2.0, -1.07, 1>}
> }
>
> #if (swt = 0) #declare theshape = object { torus1 }
>
> #else
>
> // bend options
> #declare object_axis1 = < 0, -1.27, 0>;
> #declare object_axis2 = < 2, -1.27, 0>;
> #declare bend_angle = 90;
> #declare bend_direction = y;
> #declare bend_object = object{ boxes }
> #declare bent_object = object{
>  #include "Bend.inc"
> }
> #if (swt = 1) #declare theshape = object{ bent_object }
>
> #else
>
> #if (swt = 2)
> #declare theshape = difference{
>  object{ torus1 }
>  object{ bend_object }
> }
>
> #else
> #declare theshape = difference{
>  object{ torus1 }
>  object{ bent_object }
> }
> #end
> #end
> #end
>
> object{ theshape
>  pigment{color rgb<.4,.3,.8>}
> }
> -----------------------------
>


Post a reply to this message

From: Sascha Ledinsky
Subject: Re: Problem: using difference
Date: 11 Oct 2002 06:58:17
Message: <3da6aec9@news.povray.org>
funny...
this way the intersection doesn't work anymore (which works without
'inverse')...

really strange ;-)

"hughes, b." <omn### [at] charternet> wrote in message
news:3da6aa07@news.povray.org...
> Hi Peter. Hmmmm, well I can't readily explain it without really delving
into
> Bend.inc I guess but I do have what seems to be the answer anyhow:
>
> #declare theshape = difference{
>  object{ bent_object
>    inverse
>    }
>  object{ torus1
>    inverse
>    }
>  inverse
> }
>
> Not exactly logical, is that...? :-)
> --
> Farewell,
> Bob
>
> "Peter" <nos### [at] yahooconz> wrote in message
> news:3da66bea@news.povray.org...
> >
> > Aim: to get a curved row of square holes in a ring.
> > I thought I'd use a torus for the ring, some boxes for the holes and
> > difference to punch the holes in the ring.
>
>


Post a reply to this message

From: Peter
Subject: Re: Problem: using difference
Date: 11 Oct 2002 20:26:14
Message: <3da76c26@news.povray.org>
Peter wrote:

Thanks Bob and Sascha.
The inverse inverse trick seemed to do what I was after.  I don't think I 
could have figured that one myself.

thanks heaps

Peter


Post a reply to this message

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