POV-Ray : Newsgroups : povray.general : Q: Bezier patch generation Server Time
16 Nov 2024 05:20:27 EST (-0500)
  Q: Bezier patch generation (Message 1 to 4 of 4)  
From: Vidar Madsen
Subject: Q: Bezier patch generation
Date: 15 Oct 1998 07:21:51
Message: <3625CC13.4EBE9E57@prosalg.no>
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! ;-)

TIA!

Yours,
Vidar


Post a reply to this message

From: Marc Schimmler
Subject: Re: Q: Bezier patch generation
Date: 15 Oct 1998 10:49:30
Message: <3625FD66.794B@ica.uni-stuttgart.de>
Hi Vidar,

I looked into my books about bezier patches and came to following
conclusion (I am not a expert for this!). The control points
b,c,e,f,g,h,i,j,k,l,n and o are *not* vertices of the bicubic patch (if
I am wrong about this assumption, please tell me!) but *real* control
points. So the points e and f should give the derivative of the curve at
this position. Here a small figure of a cut from e to h through the
patch.


                      f 
                     /  *****      g
                    / **     ***   `
                   /**          *** \
                  /*               **`
                 /*                  *\
                 e                     h

The * show the patch. The same should work for the combinations b-f,
j-n, c-g, ...
Just a vague hint as you asked for ;).

Marc

PS.: I like your idea for a sPatch like utility for Linux!

-- 
Marc Schimmler
Institut fuer Computeranwendungen
Universitaet Stuttgart


Post a reply to this message

From: Jerry Anning
Subject: Re: Q: Bezier patch generation
Date: 15 Oct 1998 14:16:34
Message: <36262DFF.3EB75E17@dhol.com>
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

From: Marc Schimmler
Subject: Re: Q: Bezier patch generation
Date: 16 Oct 1998 05:39:29
Message: <36270640.41C6@ica.uni-stuttgart.de>
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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.