|
![](/i/fill.gif) |
Peter Popov wrote:
>
> Hi!
>
> Can anyone help me to solve the following problem: I know the coordinates of
> a cylinder and I want to map a radial y pigment on it. I want to define the
> texture at the origin and then translate it. Or define a unit cylinder and
> somehow fit it into the coordinates I have.
I am afraid I don't understand the question completely, but in
general to place a texture there are two options:
* define the object in texture coordinates, then scale and/or translate
both.
example (not debugged) :
cylinder {
<0, 0, 0>,
<1, 1, 1>,
1
texture { CylinderTexture }
// the following transformations apply to the texture
// and the object:
scale S // S : a scalar or vector
rotate T // T : a vector
translate V // V : a vector
}
* define the texture, then scale it and/or translate it to match
the object location.
example (not debugged) :
cylinder {
V, // V: a vector
V2, // V2: a vector
R // R : a scalar
texture {
CylinderTexture
// the following transformations apply to the texture
// only :
#declare H = vlength(V2 - V);
#declare T = <atan2(...),atan2(.....),...>; // math LAAEFTR :)
scale <R, H, R>
rotate T
translate V
}
}
I am not implying the texture must always be matched to the
object in the manner shown... they are just typical examples.
Dan
--
http://www.flash.net/~djconnel/
Post a reply to this message
|
![](/i/fill.gif) |