You are on page 1of 25

Approximate Implicitization of Triangular

Bézier Surfaces

Oliver Barrowclough1
SINTEF Applied Mathematics
oliver.barrowclough@sintef.no

March 16, 2010

1
Joint work with Tor Dokken
Parametric and Implicit Representations

A parametric surface is defined by

SP = {p(s1 , s2 ) : (s1 , s2 ) ∈ Ω}

where p(s1 , s2 ) = (p1 (s1 , s2 ), p2 (s1 , s2 ), p3 (s1 , s2 )) and p1 , p2


and p3 are bivariate polynomials or rational functions of degree
n.

An implicit surface is defined as the zero set of a trivariate


polynomial q:

SI = {x ∈ R3 : q(x, y , z) = 0}
Exact and Approximate Implicitization

A polynomial q gives an exact implicitization of p(s) if

q(p(s)) = 0 for all s ∈ Ω.

A polynomial q gives an approximate implicitization of p(s) if


there exists g(s) such that

q(p(s) + g(s)) = 0 for all s ∈ Ω,

and
max kg(s)k < .
s∈Ω
Applications of and Approaches to Approximate
Implicitization

Applications:
I Intersection algorithms - detecting self-intersections,

I Ray tracing,

I Classification - is a given point above, below or on the


surface.
Approaches:
I [Dokken 1997],

I [Sederberg et al. 1999],

I [Wurm and Jüttler 2003],

I [Dokken and Thomassen 2006].


Barycentric Coordinates
Barycentric coordinates allow us to express any point x ∈ Rl
as,
Xl+1
x= βi ai ,
i=1
l
where ai ∈ R are points defining the vertices of a
non-degenerate
Pl+1 simplex in Rl under the condition that
i=1 βi = 1.
a2=(0,1,0)
2
I In R the simplex is a triangle (three
coordinates)
I In R3 the simplex is a tetrahedron P = (s1,s2,s3)
(four coordinates)
a3=(0,0,1)

a1=(1,0,0)
Bernstein Polynomials
For bivariate barycentric coordinates (s1 , s2 , s3 ), the triangular
Bernstein basis polynomials of degree n are:
 
n
n
Bj (s) = s1j1 s2j2 s3j3 , |j| = j1 + j2 + j3 = n.
j1 , j2 , j3

For trivariate barycentric coordinates (u1 , u2 , u3 , u4 ), the


tetrahedral Bernstein basis polynomials of degree m are:
 
m
m
Bi (u) = u i1 u i2 u i3 u i4 , |i| = m.
i1 , i2 , i3 , i4 1 2 3 4

Multinomial coefficients:
   
n n n!
= = .
j1 , j2 , j3 j j1 !j2 !j3 !
Properties of Bernstein Polynomials
I Partition of unity:
X
Bin (β) = 1,
|i|=n

I Product rule:
n m
 
i j n+m
Bin (β)Bjm (β) = n+m
 Bi+j (β),
i+j

I Integral of basis functions are equal:


Z
1
Bin (s) ds = (for triangular Bernstein basis).
Ω (n + 1)(n + 2)
Triangular Bézier Surfaces
A Bézier triangle of degree n is defined under a triangular
Bernstein basis as:
X
p(s) = cj Bjn (s)
|j|=n

where s = (s1 , s2 , s3 ) are non-negative barycentric coordinates.


Triangular array of control points:

c200
c110 c101
c020 c011 c002
Implicit Surfaces and Algebraic Distance

We descibe an unknown implicit surface as the zero set of


some polynomial q. We can factorize in the tetrahedral
Bernstein basis of degree m :
X
q(u) = bi Bim (u).
|i|=m

The algebraic distance between an implicitly defined surface


and a point u0 ∈ R3 is the value q(u0 ).
Approximate Implicitization

First introduced in Dokken’s thesis, [Dokken 1997]. Given a


Bézier triangle p(s) and a chosen degree m of q:

I Original Approach: minimize the algebraic distance


pointwise:
max |q(p(s))|,
s∈Ω

I Weak Approach: minimize the algebraic distance by


integration: Z
(q(p(s)))2 ds.

Original Approach

Algebraic distance between the Bézier triangle and the implicit


surface q is given by,
X
q(p(s)) = bi Bim (p(s))
|i|=m
 
X X
= bi  di,j Bjmn (s)
|i|=m |j|=mn
 
X X
= Bjmn (s)  di,j bi  .
|j|=mn |i|=m

Define a matrix D by the values (di,j )|i|=m,|j|=mn .


Original Approach
Writing in vector notation:

max |q(p(s))| = max |Bmn (s)T Db|


s∈Ω s∈Ω
≤ max kBmn (s)kkDbk ≤ kDbk.
s∈Ω

A standard result from linear algebra tells us that


minkbk=1 kDbk = σmin , where σmin is the smallest singular
value of D. In particular,

min max |q(p(s))| ≤ σmin .


kbk=1 s∈Ω

So a singular value decomposition (SVD) of D gives


candidates for approximate implicitization.
Original Approach

To summarize the algorithm:


I Multiply out the coordinate functions of p(s) according to
P 
Bim (p(s)) = |j|=mn di,j B mn
j (s) .
I Perform SVD on D = (di,j )|i|=m,|j|=mn .
I Choose the coefficients bmin = (bi )|i|=m corresponding to
the smallest singular value σmin in the SVD.
Weak Approach

We may perform the integration on either of two factorizations


of q(p(s)) :
Z Z
2 2
(q(p(s))) ds = Bmn (s)T Db ds
Ω Ω
Z 
T T mn T mn
= b D B (s) B (s) ds Db

T T
= b D ADb.

This method is quickest when evaluating the integral explicitly.


Weak Approach

A is dependent only on m and n. We calculate it using the


properties of Bernstein polynomials:
Z
ai,j = Bimn (s)Bjmn (s) ds

mn mn Z
 
i
= 2mn
j 2mn
Bi+j (s) ds
i+j Ω
mn mn
 
i 1
= 2mn
j .
i+j
(2mn + 1)(2mn + 2)
Weak Approach

We define,
M = DT AD
and proceed, as in the original case to perform an SVD on M.
This gives a candidate for approximation.
We summarize as follows:
I First construct D as in original approximate implicitization

I Construct A according to the explicit formula for ai,j

I Form M from the matrix product DT AD and perform


SVD on the resulting matrix
I Choose bmin corresponding to the smallest singular value.
Numerical Approach

The integral in weak approximate implicitization can also be


evaluated numerically. Using the factorization
m
P
q(p(s)) = |i|=m bi Bi (p(s)) we get:
Z
mi,j = Bim (p(s))Bjm (p(s)) ds

m m Z
 
i
= 2m
j 2m
Bi+j (p(s)) ds.
i+j Ω
Example - A Degenerate Bézier Triangle
A quadratic Bézier triangle
defined by
X
p1 (s) = cj Bj2 (s).
|j|=2

with vertices:
c200 = (1, 0, 0),
c110 = (0, 0, 0), c101 = (0, 0, 0),
c020 = (0, 1, 0), c011 = (0, 0, 0), c002 = (0, 0, 1).

In the barycentric coordinate system the surface is defined by:


2 2 2 2 2 2
(B200 (s), B020 (s), B002 (s), B011 (s) + B101 (s) + B110 (s))
Example - Original Approximation

Choose implicit degree 2.


1 0 0 0 0 0 0 0 0 0
Define D by expanding
0 1
B0 0 0 1 0 0 0 0 0 0C
B C
B C
B0 0 0 1 0 0 0 0 0 0C
Bi2 (p(s)), |i| = 2.
B C
1 2C
B C
B0 0 0 0 0 0 0 0
B 3 3C
B C
B0 0 1 0 0 0 0 0 0 2C
B 3 3C
B C
Singular values: B0
B
B
0 0 1
3
0 0 0 0 0 2C
3C
C
B0 0 0 0 0 0 1 0 0 0C
B C
B C
(1.705, 1.453, 1.453, 1.389, 1.000, B0
D=B 0 0 0 0 0 0 0 1 0C
C
1 2C
B C
B0 0 0 0 0 0 0 0
3 3C
1.000, 1.000, 0.333, 0.333, 0.230) B
B 1 2C
C
B0 0 0 0 0 0 0 0
B 3 3C
B C
B0 0 0 0 1 0 0 0 0 0C
Vector corresponding to the B
B
B0 0 0 0 0 0 1 0 0
C
C
0C
smallest singular value is:
B C
B
B0 0 0 0 0 1 0 0 0 2C
3 3C
C
B
@0 0 0 0 0 0 0 0 1 0A
B C

borig = (0.000, −0.571, −0.571, −0.016, 0.000, 0 0 0 0 0 0 0 1 0 0

−0.571, −0.016, 0.000, −0.016, 0.150).


Example - Weak Approximation

Can use matrix


multiplication DT AD or 1 1 1 1 1 1 23 1 23 4
element-wise formula for
0 1
90 1260 1260 84 6300 18900 18900 6300 18900 675

M: B
B
B
B
1 1 1 23 1 1 23 1 1
1260 1575 9450 9450 1260 9450 9450 18900 2100 9450
31 C
C
C
C
B 1 1 1 23 1 1 1 1 23 31 C
`2´`2´ Z B 1260 9450 1575 9450 18900 9450 2100 1260 9450 9450 C
B C
B 1 23 23 16 23 1 31 23 31 67 C
i j 4 84 9450 9450 675 18900 2100 4725 18900 4725 3150
mi,j = Bi+j (p(s)) ds.
B C
`4´ B C
B 1 1 1 23 1 1 1 1 23 4 C
i+j Ω B
6300 1260 18900 18900 90 1260 84 6300 18900 675
C
M=B
B C
C
B 1 1 1 1 1 1 23 1 23 31 C
B 18900 9450 9450 2100 1260 1575 9450 1260 9450 9450 C
B C
Vector corresponding to B
B
B
23 23 1 31
18900 9450 2100 4725
1
84
23
9450
16 23 31 67
675 18900 4725 3150
C
C
C
the smallest singular 1 1 1 23 1 1 23 1 1 4
B C
B C
B 6300 18900 1260 18900 6300 1260 18900 90 84 675 C
value is:
B C
B 23 1 23 31 23 23 31 1 16 67 C
@ 18900 2100 9450 4725 18900 9450 4725 84 675 3150 A
4 31 31 67 4 31 67 4 67 22
675 9450 9450 3150 675 9450 3150 675 3150 525
bweak = (0.040, 0.568, 0.568, −0.093, 0.040,
0.568, −0.093, 0.040, −0.093, −0.010).
Example - Intersections with the Parametric
Surface
We can also make a combined approximation by averaging the
original and weak approximations. This has the prospect of
removing branches from the approximation.

Original intersection
Weak intersection
Combination
I Original approximation
interpolates corners
I All have different
intersections
I Can model behaviour to
requirements
Example - Surface with Singularities

c200 = (0, 0, 0),


c110 = (0, 0, 1), c101 = (0, 1, 0),
c020 = (0, 0, 0), c011 = (1, 0, 0), c002 = (0, 0, 0).

Figure: Exact (left) and Approximate (right) implicitizations of the


parametric triangular Béizer surface (middle)
Example - Quadric Surfaces

I Require quartic rational Bézier surfaces to be represented


exactly
I Represented exactly by quadratic trivariate polynomials
I Implicitization can ignore the denominator in the
parametric definition
Algebraic Distance and Affine Error

Before, we minimized the algebraic distance q(p(s)). How is


this related to the error in affine space?

Taylor expansion of q(p(s) + g(s)) gives:

q(p(s)) + g(s) · ∇q(p(s)) + · · · = 0.

So if q(p(s)) ≈ 0 then the affine error will be small away from


singularities. Near singularities the non-singular parts will
attract the approximating surface.
Conclusions

I Implementing numerical integration methods that are


stable to high degree

I Implementing parallel methods

I Questions?

You might also like