POV-Ray : Newsgroups : povray.newusers : Connecting two objects after transformation operations... Server Time
28 Jul 2024 16:27:46 EDT (-0400)
  Connecting two objects after transformation operations... (Message 1 to 3 of 3)  
From: this is me
Subject: Connecting two objects after transformation operations...
Date: 13 Feb 2008 06:00:00
Message: <web.47b2cc652e14cb95988f09540@news.povray.org>
Hello,

Let's say I do the following, so what I end up with is two 4-sided CSG objects
somewhere in space.  Now, using cylinders like the ones below, I'd like to
connect the 4 corners of the first CSG object to the 4 corners of the second,
but I can't figure out how to do it.  Any thoughts?



#declare Smooth = finish {specular 0.3 roughness 0.05}
#declare BondWidth = 0.1;
#declare atoms = rgb < 0, 0, 0.5 >;
#declare bonds = rgb < 0.3, 0.3, 0.3 >;

#declare C =
  sphere {
    <0.0, 0.0, 0.0>, 0.4
    texture {
      pigment {colour atoms}
      finish  {Smooth}
    }
  }

#declare A1  = < 0, 0, 0 >;
#declare A2  = < 1, 0, 0 >;
#declare A3  = < 1 ,1, 0 >;
#declare A4  = < 0, 1, 0 >;

//CSG object 1
union {
  object {
    C
    translate A1
  }
  object {
    C
    translate A2
  }
  object {
    C
    translate A3
  }
  object {
    C
    translate A4
  }
  cylinder {
    A1,
    A2,
    BondWidth
  pigment {colour bonds}
  finish  {Smooth}
}
  cylinder {
    A2,
    A3,
    BondWidth
  pigment {colour bonds}
  finish  {Smooth}
}
  cylinder {
    A3,
    A4,
    BondWidth
  pigment {colour bonds}
  finish  {Smooth}
}
  cylinder {
    A4,
    A1,
    BondWidth
  pigment {colour bonds}
  finish  {Smooth}
}
rotate SOME_ROTATE_VECTOR
translate SOME_TRANSLATE_VECTOR
}

//CSG object 2
union {
  object {
    C
    translate A1
  }
  object {
    C
    translate A2
  }
  object {
    C
    translate A3
  }
  object {
    C
    translate A4
  }
  cylinder {
    A1,
    A2,
    BondWidth
  pigment {colour bonds}
  finish  {Smooth}
}
  cylinder {
    A2,
    A3,
    BondWidth
  pigment {colour bonds}
  finish  {Smooth}
}
  cylinder {
    A3,
    A4,
    BondWidth
  pigment {colour bonds}
  finish  {Smooth}
}
  cylinder {
    A4,
    A1,
    BondWidth
  pigment {colour bonds}
  finish  {Smooth}
}
rotate SOME_OTHER_ROTATE_VECTOR
translate SOME_OTHER_TRANSLATE_VECTOR
}


Post a reply to this message

From: Chris B
Subject: Re: Connecting two objects after transformation operations...
Date: 13 Feb 2008 06:30:26
Message: <47b2d4d2$1@news.povray.org>
"this is me" <nomail@nomail> wrote in message 
news:web.47b2cc652e14cb95988f09540@news.povray.org...
> Hello,
>
> Let's say I do the following, so what I end up with is two 4-sided CSG 
> objects
> somewhere in space.  Now, using cylinders like the ones below, I'd like to
> connect the 4 corners of the first CSG object to the 4 corners of the 
> second,
> but I can't figure out how to do it.  Any thoughts?
>

You can declare a transformation for each rotation/translation pair, then 
use your transform both to position the objects and to reposition the 
location vectors that you need for the ends of the cylinders. Something like 
the following:

#declare MyTransform1 = transform {rotate ... translate ...}
object {... transform {MyTransform1}}
...
cylinder 
{vtransform(MyPoint1,MyTransform1),vtransform(MyPoint1,MyTransform2),MyRadius 
...}
...


Regards,
Chris B.


Post a reply to this message

From: this is me
Subject: Re: Connecting two objects after transformation operations...
Date: 13 Feb 2008 16:30:00
Message: <web.47b3606b67dd78f6e1e1be9d0@news.povray.org>
"Chris B" <nom### [at] nomailcom> wrote:
>
> You can declare a transformation for each rotation/translation pair, then
> use your transform both to position the objects and to reposition the
> location vectors that you need for the ends of the cylinders. Something like
> the following:
>
> #declare MyTransform1 = transform {rotate ... translate ...}
> object {... transform {MyTransform1}}
> ...
> cylinder
> {vtransform(MyPoint1,MyTransform1),vtransform(MyPoint1,MyTransform2),MyRadius
> ...}
> ...
>
>
> Regards,
> Chris B.

Excellent!  Just the kind of push in the right direction for which I was
looking.


Post a reply to this message

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