|
|
Vidar Madsen wrote:
>
> Hello.
>
> I'm writing a small application that is supposed to generate
> bezier patches from a set of linear line-segments. The lines
> are converted to bezier curves (smoothed) internally in
> the program. However, when it comes to spit out the final
> bicubic patch I run into a small problem. As we all know(?),
> a bezier patch consists of 16 vertexes:
> A b c D
> e f g h
> i j k l
> M n o P
>
> The control points between the different curves are calculated
> automatically ("e" and "i" for the segment "A"-"M"), and seem
> to work fine. However, I also need control points for the
> center of the patch, "f", "g", "j" and "k". Is there a good
> method to determine these? I have tried averaging a few of the
> other vertices, but I always end up with sharp edges between
> the adjacent patches... If anyone can help me with this, I'd
> be very grateful. Even vague hints are appreciated! ;-)
Take two adjacent patches with control points named thus:
a b c d A B C D
e f g h E F G H
i j k l I J K L
m n o p M N O P
then for true g1 continuity between patches you need to meet the
following conditions:
d=A, h=E, l=I, p=M,
cd and AB are collinear,
gh and EF are collinear,
kl and IJ are collinear,
op and MN are collinear.
This is quite restrictive, but there is another interpretation of
continuity that is also used. For this, you need to meet the following
conditions:
d=a, h=E, l=I, p=M,
c, d, A, B, h and E are coplanar,
l, I, o, p, M and N are coplanar.
If you use the first method, it determines your interior control points.
The second method leaves them free, but you could consider creating them
by interpolating your (constrained) edge control points.
Jerry Anning
cle### [at] dholcom
Post a reply to this message
|
|
|
|
Just to prove that Jerry is right (and that my quick guess was also ;) )
I made a small example by hand:
camera {
rotate <0,180,0>
location <7,5,3>
look_at <1.5,0,3>
angle 60
}
light_source { <1.5,9,1.5> color rgb <1.0.0>}
plane {y,-4 pigment {checker rgb<1,1,1>, rgb <0.5,0.5,0.5>}}
//blue patch
bicubic_patch {
type 1
flatness 0.01
u_steps 10
v_steps 10
<0.0, 0.0, 0.0>, <0.0, 0.5, 0.0>, <3.0, 0.5, 0.0>, <3.0, 0.0, 0.0>,
<0.0, 0.5, 1.0>, <0.0, 3.0, 1.0>, <3.0, 3.0, 1.0>, <3.0, 0.5, 1.0>,
<0.0, 0.5, 2.0>, <0.0, 3.0, 2.0>, <3.0, 3.0, 2.0>, <3.0, 0.5, 2.0>,
<0.0, 0.0, 3.0>, <0.0, 0.5, 3.0>, <3.0, 0.5, 3.0>, <3.0, 0.0, 3.0>
pigment {color rgb <0,0,1> }
}
//red patch
bicubic_patch {
type 1
flatness 0.01
u_steps 10
v_steps 10
<0.0, 0.0, 3.0>, <0.0, 0.5, 3.0>, <3.0, 0.5, 3.0>, <3.0, 0.0, 3.0>,
<0.0, -0.5, 4.0>, <0.0, -2.0, 4.0>, <3.0, -2.0, 4.0>, <3.0, -0.5,
4.0>,
<0.0, -0.5, 5.0>, <0.0, -2.0, 5.0>, <3.0, -2.0, 5.0>, <3.0, -0.5,
5.0>,
<0.0, 0.0, 6.0>, <0.0, 0.5, 6.0>, <3.0, 0.5, 6.0>, <3.0, 0.0, 6.0>
pigment {color rgb <1,0,0> }
}
It works fine. BTW I had a lot of troubles with edges in the patches
until I used a flatness of 0.01 but you sure know that.
Your sincerely
Marc
--
Marc Schimmler
Institut fuer Computeranwendungen
Universitaet Stuttgart
Post a reply to this message
|
|