|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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!
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 29/01/2011 6:15 PM, Anton wrote:
> 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!
>
>
You could always put the cylinder and second sphere in a union. Then
rotate the union. This way both the cylinder and sphere will keep their
spatial relationships.
--
Regards
Stephen
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Stephen's answer is probably what you want. But if you really want to know the
x,y,z location, you can create a vector representing the axis of your cylinder
before rotation and then rotate the vector by the same amount.
From the manual:
"vaxis_rotate(A,B,F) Rotate A about B by F. Given the x,y,z coordinates of a
point in space designated by the vector A, rotate that point about an arbitrary
axis defined by the vector B. Rotate it through an angle specified in degrees by
the float value F. The result is a vector containing the new x,y,z coordinates
of the point."
Charles
Post a reply to this message
|
|
| |
| |
|
|
From: Alain
Subject: Re: Retrieving point information after rotation
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Am 29.01.2011 19:55, schrieb Charles C:
> Stephen's answer is probably what you want. But if you really want to know the
> x,y,z location, you can create a vector representing the axis of your cylinder
> before rotation and then rotate the vector by the same amount.
>
> From the manual:
>
> "vaxis_rotate(A,B,F) Rotate A about B by F. Given the x,y,z coordinates of a
> point in space designated by the vector A, rotate that point about an arbitrary
> axis defined by the vector B. Rotate it through an angle specified in degrees by
> the float value F. The result is a vector containing the new x,y,z coordinates
> of the point."
Or, more generally, instead of
cylinder {
A, B, R
rotate <...>
translate <...>
scale <...>
}
you could use:
#local MyTransform = transform {
rotate <...>
translate <...>
scale <...>
}
cylinder {
A, B, R
transform { MyTransform }
}
then you can get the final position of A and B by evaluating:
#local A2 = vtransform(A, MyTransform);
#local B2 = vtransform(B, MyTransform);
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
When I try this I get 'Expected 2 parameters but only 1 found.' What does this
mean? I have included functions.inc and transforms.inc
HELP?
clipka <ano### [at] anonymousorg> wrote:
> Am 29.01.2011 19:55, schrieb Charles C:
> > Stephen's answer is probably what you want. But if you really want to know the
> > x,y,z location, you can create a vector representing the axis of your cylinder
> > before rotation and then rotate the vector by the same amount.
> >
> > From the manual:
> >
> > "vaxis_rotate(A,B,F) Rotate A about B by F. Given the x,y,z coordinates of a
> > point in space designated by the vector A, rotate that point about an arbitrary
> > axis defined by the vector B. Rotate it through an angle specified in degrees by
> > the float value F. The result is a vector containing the new x,y,z coordinates
> > of the point."
>
>
> Or, more generally, instead of
>
> cylinder {
> A, B, R
> rotate <...>
> translate <...>
> scale <...>
> }
>
> you could use:
>
> #local MyTransform = transform {
> rotate <...>
> translate <...>
> scale <...>
> }
> cylinder {
> A, B, R
> transform { MyTransform }
> }
>
> then you can get the final position of A and B by evaluating:
>
> #local A2 = vtransform(A, MyTransform);
> #local B2 = vtransform(B, MyTransform);
Post a reply to this message
|
|
| |
| |
|
|
From: Alain
Subject: Re: Retrieving point information after rotation
Date: 29 Jun 2011 13:18:37
Message: <4e0b5e6d@news.povray.org>
|
|
|
| |
| |
|
|
> When I try this I get 'Expected 2 parameters but only 1 found.' What does this
> mean? I have included functions.inc and transforms.inc
>
> HELP?
>
Any function expect a fixed number of parameters.
Whenever you don't provide the correct number of parameters, you get
that error.
Here, your function is expecting a call in this form:
Function(A, B)
But, it get called this way:
Function(A)
Take a look at the definition of the function you want to use in the
coresponding inc file.
For example, vaxis_rotate asks for 3 parameters, while vtransform needs 2.
Alain
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Am 28.06.2011 21:29, schrieb zozimus:
> When I try this I get 'Expected 2 parameters but only 1 found.' What does this
> mean? I have included functions.inc and transforms.inc
It means you're doing /something/ wrong with /some/ macro or function;
without more information it's really hard to tell, but in the code I
posted, the only macro or function call is this one:
>> #local A2 = vtransform(A, MyTransform);
>> #local B2 = vtransform(B, MyTransform);
If this is where the error pops up, then you might have left out either
A (or B respectively), or MyTransform.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|