|
![](/i/fill.gif) |
"D103" <nomail@nomail> wrote:
> Le_Forgeron <jgr### [at] free fr> wrote:
> >
> > Have you read
> >
> > >
http://wiki.povray.org/content/Documentation:Tutorial_Section_3#Bicubic_Patch_Object
> >
> > ?
> Yes, I have, and with previous patches I used a similar method, but I'm trying
> to find an easier way to control and change the points, for example, all the
> points along a certain axis etc.
> >
> > The corner of each grid should match. (aka, duplicate them)
> > The control points along the jointing line should also.
> >
> > Do you really want to manage the 16 points of patch with 0-15, or use a
> > double index 0-3,0-3 instead ?
> >
> > (array[n][4][4])
> >
> > Or even simpler to understand: array[n][m][4][4]
> > n height
> > m width (as number of patch)
>
> Hadn't thought of that, thanks.
>
> Supposing I set up such an array, could I use it like this:
>
>
> #declare P1 = 1;
> #declare P2 = 1;
> #while(P1<=4&P2<=4)
> bicubic_patch {
> type 1 u_steps 5 v_steps 5
> BPatchPoints[1][1][P1][P2]
> }
> bicubic_patch {
> type 1 u_steps 5 v_steps 5
> BPatchPoints[2][2][P1][P2]
> }
> bicubic_patch {
> type 1 u_steps 5 v_steps 5
> BPatchPoints[2][2][P1][P2]
> }
> bicubic_patch {
> type 1 u_steps 5 v_steps 5
> BPatchPoints[2][2][P1][P2]
> }
> #declare P1=P1+1;
> #if (P1=4)
> #declare P2=P2+1;
> #declare P1=1;
> #end
> #end
>
> Something tells me this isn't going to work, but I think that's the general idea
> there.
Have a look at the code below.
Tor Olav
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
#version 3.6;
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
#declare PatchesInWidth = 2;
#declare PatchesInHeight = 2;
#declare PatchPoints =
array[PatchesInHeight][PatchesInWidth][4][4] {
{
{
{ < 0, 0, 0>, < 1, 0, 0>, < 2, 0, 0>, < 3, 0, 0> },
{ < 0, 0, 1>, < 1, 1, 1>, < 2, 1, 1>, < 3, 0, 1> },
{ < 0, 0, 2>, < 1, 1, 2>, < 2, 1, 2>, < 3, 0, 2> },
{ < 0, 0, 3>, < 1, 0, 3>, < 2, 0, 3>, < 3, 0, 3> }
},
{
{ < 3, 0, 0>, < 4, 0, 0>, < 5, 0, 0>, < 6, 0, 0> },
{ < 3, 0, 1>, < 4, -1, 1>, < 5, -1, 1>, < 6, 0, 1> },
{ < 3, 0, 2>, < 4, -1, 2>, < 5, -1, 2>, < 6, 0, 2> },
{ < 3, 0, 3>, < 4, 0, 3>, < 5, 0, 3>, < 6, 0, 3> }
}
},
{
{
{ < 0, 0, 3>, < 1, 0, 3>, < 2, 0, 3>, < 3, 0, 3> },
{ < 0, 0, 4>, < 1, -1, 4>, < 2, -1, 4>, < 3, 0, 4> },
{ < 0, 0, 5>, < 1, -1, 5>, < 2, -1, 5>, < 3, 0, 5> },
{ < 0, 0, 6>, < 1, 0, 6>, < 2, 0, 6>, < 3, 0, 6> }
},
{
{ < 3, 0, 3>, < 4, 0, 3>, < 5, 0, 3>, < 6, 0, 3> },
{ < 3, 0, 4>, < 4, 1, 4>, < 5, 1, 4>, < 6, 0, 4> },
{ < 3, 0, 5>, < 4, 1, 5>, < 5, 1, 5>, < 6, 0, 5> },
{ < 3, 0, 6>, < 4, 0, 6>, < 5, 0, 6>, < 6, 0, 6> }
}
}
}
#declare PatchTextures =
array[PatchesInHeight][PatchesInWidth] {
{
texture {
pigment {
checker
color rgbf <1.0, 1.0, 1.0, 0.6>
color rgbf <0.0, 0.0, 0.0, 0.6>
}
},
texture {
pigment {
checker
color rgbf <0.7, 0.0, 0.0, 0.6>
color rgbf <1.0, 1.0, 1.0, 0.6>
}
}
},
{
texture {
pigment {
checker
color rgbf <0.0, 0.7, 0.0, 0.6>
color rgbf <1.0, 1.0, 1.0, 0.6>
}
},
texture {
pigment {
checker
color rgbf <1.0, 1.0, 1.0, 0.6>
color rgbf <0.0, 0.0, 0.7, 0.6>
}
}
}
}
#declare CntH = 0;
#while (CntH < PatchesInHeight)
#declare CntW = 0;
#while (CntW < PatchesInWidth)
bicubic_patch {
type 1
flatness 0.001
u_steps 4
v_steps 4
uv_vectors
<0, 0>
<1, 0>
<1, 1>
<0, 1>
#declare I = 0;
#while (I < 4)
#declare J = 0;
#while (J < 4)
PatchPoints[CntH][CntW][I][J]
#declare J = J + 1;
#end // while
#declare I = I + 1;
#end // while
uv_mapping
texture {
PatchTextures[CntH][CntW]
scale 1/3
}
}
#declare CntW = CntW + 1;
#end // while
#declare CntH = CntH + 1;
#end // while
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
background {
color rgb 0.5*<1, 1, 1>
}
camera {
location <3, 6, -3>
look_at <3, 0, 3>
}
light_source {
500*<1, 1, -1>
color rgb <1, 1, 1>
shadowless
}
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
Post a reply to this message
|
![](/i/fill.gif) |