![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
I know I (probably) need the matrix keyword (I'm not *that* new to POV).
Problem is, I am not good in math either. So far I was able to match the
texture to the cylinder, but by shearing it and not rotating it. Thanks for
the URL, though. I'll be surfing in a sec, hope it helps.
--Peter
Fabien Mosen wrote in message <357D62D7.5AA9371C@skynet.be>...
>"matrix" is what you need; I'm not familiar enough with it to explain,
>but there is a good tutorial about it :
>http://www.erols.com/vansickl/matrix.htm
>
>
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Dan Connelly wrote in message <35A60621.4087CF56@flash.net>...
>...
>I am afraid I don't understand the question completely...
I think you got it perfectly right,
>...
>... #declare T = <atan2(...),atan2(.....),...>; // math LAAEFTR :)
...
>...
though I'm having problems with LAAEFTR, being absolutely new (a week or so)
in the 'Net :( Not being that good in math either, I would guess the ... in
atan2(..) should be replaced with ...?
10x
>Dan
>
>http://www.flash.net/~djconnel/
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On Sat, 11 Jul 1998 00:12:10 +0300, Peter Popov <pet### [at] usa net> wrote:
>Dan Connelly wrote in message <35A60621.4087CF56@flash.net>...
>>... #declare T = <atan2(...),atan2(.....),...>; // math LAAEFTR :)
>
>though I'm having problems with LAAEFTR, being absolutely new (a week or so)
Left As An Exercise For The Reader. Not really a net thing, more of a math
thing. And the ...'s are English, not math, for "fill this part in
yourself."
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Checked the site, it's great! Suits me just fine. 10x for the info.
Happy tracing.
--Peter
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
>Left As An Exercise For The Reader. Not really a net thing, more of a math
>thing. And the ...'s are English, not math, for "fill this part in
>yourself."
>
Facing the threat of flaming someone by repeatedly asking stupid questions,
what scalar values should I enter for the three atan2 fxns? Two months and I
still can't figure it out :(
--Peter
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On Fri, 10 Jul 1998 07:16:33 -0500, Dan Connelly <djc### [at] flash net> wrote:
>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.
>* 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 DX = V2.x-V.x;
#declare DY = V2.y-V.y;
#declare DZ = V2.z-V.z;
#declare RX = atan2( DZ, DY );
#declare RZ = atan2( DX, DY );
> scale <R, H, R>
rotate RX * x
rotate RZ * z
> translate V
> }
> }
I haven't tested this, and I'm not sure it's quite right. In particular,
the terms inside the atan2 might be different than I have here. For example,
where I have DY, you might really need -DY. If it doesn't work, try
different combinations of signs. I'm also assuming that the axis of your
texture lies along the +Y axis.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
>from Ron Parker...
>
>I haven't tested this, and I'm not sure it's quite right. In particular,
>the terms inside the atan2 might be different than I have here. For
example,
>where I have DY, you might really need -DY. If it doesn't work, try
>different combinations of signs. I'm also assuming that the axis of your
>texture lies along the +Y axis.
>
>
OK, I'll try that tomorrow (today, by local time). I have an exam in eight
hours, so I won't bother you again for at least 24 hours :) Anyway, +Y it
is, and I'll just write a #while to check all combinations at once.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Ron Parker wrote:
>
> On Fri, 10 Jul 1998 07:16:33 -0500, Dan Connelly <djc### [at] flash net> wrote:
> >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.
>
> >* 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 DX = V2.x-V.x;
> #declare DY = V2.y-V.y;
> #declare DZ = V2.z-V.z;
>
> #declare RX = atan2( DZ, DY );
> #declare RZ = atan2( DX, DY );
>
> > scale <R, H, R>
>
> rotate RX * x
> rotate RZ * z
>
> > translate V
> > }
> > }
>
> I haven't tested this, and I'm not sure it's quite right. In particular,
> the terms inside the atan2 might be different than I have here. For example,
> where I have DY, you might really need -DY. If it doesn't work, try
> different combinations of signs. I'm also assuming that the axis of your
> texture lies along the +Y axis.
The solution key is to realize you need to set one coordinate in the
first rotation, leaving two to the other leg of the triangle, then
set one of the remaining, leaving the third to the other leg of the
second triangle.
One of 3 possibilities (for x->y->z ordering) (not debugged) :
#declare RX = degrees ( atan2 ( DZ, vlength( <DX, DY, 0> ) ) );
#declare RY = degrees ( atan2 ( DX, DY ) );
rotate <RX, RY, 0>
Dan
--
http://www.flash.net/~djconnel/
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
> #declare RX = degrees ( atan2 ( DZ, vlength( <DX, DY, 0> ) ) );
> #declare RY = degrees ( atan2 ( DX, DY ) );
>
> rotate <RX, RY, 0>
Correction (sorry...) :
#declare RY = degrees ( atan2 ( DX, DZ) );
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Peter Popov wrote:
>
> 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.
Perhaps something like the below file will fit your needs; the syntax
(after including the file) is as follows (note that standard brackets
() are used, not {} braces):
Textured_Cylinder (<Base Point>, <Cap Point>, Radius, texture {...})
or:
Textured_Disc (<Centre>, <Normal>, Radius, texture {...})
where the texture {...} is aligned as desired along the +y axis. Other
shapes can be textured using the Fit_Texture_to_Cylinder macro, eg:
cone {<-5, -4, -2>, 2, <5, 4, 1>, 1 open
Fit_Texture_to_Cylinder (MyTexture, <-5, -4, -2>, <5, 4, 1>, 2)}
One thing to note - I've had to write out the second atan2 () function
in the first macro in full (it looks as though the fix I sent the
POV-Team got somewhat lost in the translation!), to avoid the irritating
Domain Error crash.
// -- CylTex.inc -----------------------------
#macro Fit_Texture_to_Cylinder (cyltexture, point1, point2, cylradius)
#local _CT_axis = (point2 - point1) * <1, 1, 1>;
#if (vlength(_CT_axis) = 0) texture {cyltexture} #else
#local _CT_rotx = degrees(atan2(vlength(_CT_axis * <1, 0, 1>), _CT_axis.y));
#if (_CT_axis.x = 0) #if (_CT_axis.z >= 0) #local _CT_roty = 0; #else #local
_CT_roty = 180; #end
#else #if (_CT_axis.z = 0) #if (_CT_axis.x > 0) #local _CT_roty = 90; #else
#local _CT_roty = -90; #end
#else #local _CT_roty = degrees(atan2(_CT_axis.x, _CT_axis.z)); #end #end
texture {cyltexture
scale <cylradius, vlength(_CT_axis), cylradius>
rotate <_CT_rotx, _CT_roty, 0>
translate point1}
#end
#end
#macro Textured_Cylinder (point1, point2, cylradius, cyltexture)
cylinder {point1, point2, cylradius
Fit_Texture_to_Cylinder (cyltexture, point1, point2, cylradius)}
#end
#macro Textured_Disc (disccentre, discnormal, discradius, disctexture)
disc {disccentre, discnormal, discradius
Fit_Texture_to_Cylinder (disctexture, disccentre, disccentre + discnormal,
discradius)}
#end
// -- End File -----------------------------
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |