POV-Ray : Newsgroups : povray.newusers : Retrieving point information after rotation : Re: Retrieving point information after rotation Server Time
2 Jul 2024 22:36:28 EDT (-0400)
  Re: Retrieving point information after rotation  
From: Alain
Date: 29 Jan 2011 16:45:35
Message: <4d448a7f@news.povray.org>

> Hello, one and all. I have a problem I was wondering if some one could help me
> with. I have three objects, 2 spheres and cylinder. One end of the cylinder is
> rotated around the sphere, I want to place the second sphere at the opposite end
> of the cylinder after the rotation. I do not know how to retrieve the x,y,z
> information of one end of the cylinder after rotation. Help!
>
>

What I would do to do that:
Create an union of the 2 spheres and cylinder.
In that union, one of the sphere is located at coordinate <0, 0, 0>

I would then rotate that union as a single object.
If it's not suposed to reside at the origin point, I then translate it 
so that the first sphere goes to the desired location.

Sample:
union{
	sphere{0, 3} // Sphere number 1
	cylinder{0, 20*y, 1} // The connecting cylinder
	sphere{20*y, 3} // Sphere number 2
  texture Your_texture
  rotate Some_Rotation
  translate Somewhere
}

Here, the cylinder extend to the center of the spheres. It causes no 
problem as long as the objects are opaque.
You can individualy apply a texture and finish to any element if you want.
If you are using a transparent pigment, you should replace "union" by 
"merge". It will remove the internal surfaces.

If you need a chain of cylinder connected spheres, you can have an union 
inside another:

union{
  sphere{0, 3}
  cylinder{0, 20*y, 1}
  union{
   sphere{0, 3}
   cylinder{0, 20*y, 1}
   sphere{20*y, 3}
   rotate Some_Rotation
   translate 20*y // Place it at the end of the first cylinder
   }
  rotate Another_Rotation
  }





Alain


Post a reply to this message

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