|
|
Rune <run### [at] inamecom> wrote:
> I have learned myself how to handcode bicubic patches that fits seamlessly
> together. However, I never get the result I want when I try to make a
patch
> where two of the corners lie in the same point.
>
> Say I want to make a unit-sphere made of 8 bicubic patches. Could you show
> me what one of those patches would look like in POV-code? It doesn't have
to
> be a 100% perfect sphere, but I don't want any "folds" anywhere.
You certainly won't get a perfect sphere, firstly because Bezier splines
aren't capable of producing exact spherical arcs, and secondly because the
patches use a triangle mesh approximation.
You can, however, get pretty close. As you've no doubt found, making the
tangent points of adjacent patches co-linear gives smooth joins without
folds. For three-cornered patches, the trick is to make sure you don't use
tangent points that are the same as your corner points. With a little trial
and error, this code seems to create a pretty good sphere:
#declare Q = bicubic_patch {
type 1 u_steps 3 v_steps 3 flatness .01
<0, 0, 1>, <.5, 0, 1>, <1, 0, .5>, <1, 0, 0>,
<0, .5, 1>, <.5, .5, 1>, <1, .5, .5>, <1, .5, 0>,
<0, 1, .5>, <.3, 1, .5>, <.5, 1, .3>, <.5, 1, 0>,
y, <.001, 1, .002>, <.002, 1, .001>, y
}
union {
object {Q} object {Q scale <1, 1, -1>}
object {Q scale <-1, 1, -1>} object {Q scale <-1, 1, 1>}
object {Q scale <1, -1, 1>} object {Q scale <1, -1, -1>}
object {Q scale <-1, -1, -1>} object {Q scale <-1, -1, 1>}
pigment {onion color_map {[0 rgb x] [.5 rgb y] [1 rgb z]} frequency 20}
}
The onion pigment allows you to see the margin of error - the entire surface
is within 1/20 of the unit radius, so it's reasonably close. The last row
of the patch points is at the pole - as you can see, I've used the same
point for the actual corners, but I've used different tangent points so
there's no pinching at the poles of the finished sphere.
Post a reply to this message
|
|