Content uploaded by Gautam Dasgupta
Author content
All content in this area was uploaded by Gautam Dasgupta on Jun 29, 2018
Content may be subject to copyright.
The
Mathematica®
Journal
Algebraic Construction
of Smooth Interpolants
on Polygonal Domains
Elisabeth Anna Malsch
Gautam Dasgupta
A smooth and bounded interpolant can be constructed in explicit algebraic
form within any polygon, convex or concave. The resulting function is not
unique and accordingly can be adjusted to satisfy desired global conditions,
such as linear fields. The closed-form representation is obtained by com-
bining simple geometric descriptions, such as the side lengths and areas.
The interpolant distributes values given at discrete nodes smoothly over
the interior of the domain. On a convex polygon, the interpolant is a
rational function of the product of areas. On a concave or multiply con-
nected polygon, the interpolant is a function of areas and edge lengths,
which introduces a square root term.
‡
Introduction
There are many varied applications for a smooth and bounded interpolant. The
most straightforward is for computer graphics, for example in rendering and
coloring applications [1]. Smoothly distributing color defined at nodes over a
domain requires a bounded interpolating function. Interpolants can also be
employed as test functions for computational modeling [2]. For the finite ele-
ment method, they act as shape functions [3, 4]. Similar interpolants have been
applied to the analysis of biomedical growth and shape change [5].
Conventional methods for constructing interpolants do not distribute boundary
values smoothly over arbitrary polygonal shapes. Most either require a mesh or
apply only to very simple geometries [4, 6]. For example, the conventional finite
element development does not specifically address concavity; instead, concave
domains are tessellated into convex parts. An exception is the R-function construc-
tion that applies to any polygonal domain [7]. Unlike the proposed formulation,
it can only represent homogeneous boundary conditions.
The Mathematica Journal 9:3 © 2005 Wolfram Media, Inc.
In general, any function
uHx,yL
can be approximated as the sum of the products
of the value
ui
at given nodes
Hxi,yiL
and an interpolant
NiHx,yL
:
(1)
uHx,yL>u
`Hx,yL=‚
i=1
n
uiNiHx,yL.
The derived interpolants
NiHx,yL
are linearly independent:
(2)
NiHxj,yjL= di,j.
Along any given boundary, only the values given at the end nodes prescribe the
behavior along the line segment:
(3)
u
`Ht xi+H1-tLxj,t yi+H1-tLyjL=fHui,uj,tL.
Within the domain, the interpolants are bounded, normalized between zero and
one, and smooth. The interpolant generated is not unique. Any function that
satisfies an elliptic operator and the boundary conditions satisfies the interpolant
requirements.
Using the same method to construct general bounded interpolants on any
polygon, linear interpolants are constructed. A linear interpolant satisfies the
additional requirements of boundary linearity:
(4)
u
`Ht xi+H1-tLxj,t yi+H1-tLyjL=t ui+H1-tLuj,
and exact reproduction of linear fields:
(5)
x=‚
i=1
n
xiNiHx,yL and y=‚
i=1
n
yiNiHx,yL.
The constant field is satisfied by construction:
(6)
1=‚
i=1
n
NiHx,yL.
In most cases, the linearity requirements do not prescribe a unique interpolant.
Therefore additional global conditions, such as higher-order fields, could also be
imposed.
‡
Input Data
The interpolant can be constructed on any two-dimensional slice of any poly-
tope, including polygons, polyhedra, or higher-dimensional objects. Accordingly,
the dimension of the data must be defined. The examples are in two dimensions.
In[1]:=
xy =8x, y<;
The list of vertices must also be defined; for example, here is a triangle with
three nodes.
In[2]:=
vertexConnect =881, 2, 3<<;
642 Elisabeth Anna Malsch and Gautam Dasgupta
The Mathematica Journal 9:3 © 2005 Wolfram Media, Inc.
Another example is a triangle enclosing a quadrilateral and an interior point.
In[3]:=
vertexConnect =881, 2, 3<,84<,88, 7, 6, 5<<;
For a simple interpolant, the quantity that is going to be distributed smoothly
over the domain must be defined at every nodal point. The nodal points not only
determine the structure of the domain, they are also the points at which the value
being distributed is given. The vertices of the polygon are a subset of the nodal
points. Nodal points and interpolation points are one and the same.
‡
Geometric Measures and Support Functions
It is useful to construct the interpolant with respect to geometric measures as
opposed to nodal locations. The benefit of such an approach is that it is invariant
of coordinate system and dimension.
·
The Distance Function
The distance between two points
p1
and
p2
with coordinates
Hx1,y1L
and
Hx2,y2L
is:
(7)
»p1 p2»=l12 ="##############################################
Hx1-x2L2+Hy1-y2L2.
The function can be written as the norm of the vector connecting the points,
norm[
p1-p2
]. The built-in Norm function would be appropriate if the points
were represented as complex numbers rather than as pairs of real numbers.
In[4]:=
norm@a_D:=Sqrt@a.aD
·
The Signed Area of a Triangle
The area of the triangle with vertices
p1
,
p2
,
p3
with coordinates
Hx1,y1L
,
Hx2,y2L
,
Hx3,y3L
can be defined in terms of the determinant:
(8)
A= D@p1,p2,p3D=1ê2
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
x1y11
x2y21
x3y31
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
.
The area is signed:
D@p1,p2,p3D= -D@p2,p1,p3D
.
In[5]:=
area@p_, q_, r_D:=
1ê2 Det@Join@Transpose@8p, q, r<D,881, 1, 1<<DD ê;
Length@pDãLength@qDãLength@rDã2
Algebraic Construction of Smooth Interpolants on Polygonal Domains 643
The Mathematica Journal 9:3 © 2005 Wolfram Media, Inc.
·
The Unsigned Area Function
The unsigned area of a triangle can be written in terms of side lengths using
Heron’s formula:
(9)
A=è!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
sHs-aLHs-bLHs-cL,
where
(10)
s=1
ÅÅÅÅÅÅ
2Ha+b+cL.
The resulting area is necessarily nonnegative. The area measure has no physical
meaning for a node located on the edge of the domain. In such a case, defining
the unsigned area to be one when the signed area is zero allows the concave
element shape function routines to apply to elements with side nodes.
In[6]:=
unsignedArea@p_, q_, r_D:=Module@8a, b, c, s<,
a=norm@p-qD; b =norm@q-rD; c =norm@r-pD; s =1ê2 Ha+b+cL;
Sqrt@sHs-aL Hs-bL Hs-cLDD
In[7]:=
unsignedArea@p_, q_, r_D:=1ê; area@p, q, rDã0
·
The Angle Functions
The cosine or sine of an angle defined by three vertices can be determined using
line lengths and the unsigned area. Care is taken to choose the proper sign for
the cosine and sine functions. For the angle b defined by the nodes
p
,
q
,
r
with
the angle at
q
:
(11)
cosHbL=†pq§2+†qr§2-†r p§2
ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ
2†pq§†qr§,
(12)
sinHbL=2†D@p,q,rD§
ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ
†pq§†qr§.
The angle b never has to be evaluated.
In[8]:=
cosAng@p_, q_, r_D:=Module@8pq, qr, rp<, pq =norm@p-qD;
qr =norm@q-rD; rp =norm@r-pD;Hpq^2 +qr^2 -rp^2LêH2 pq qrLD
In[9]:=
sinAng@p_, q_, r_D:=2 unsignedArea@p, q, rDêHnorm@p-qD norm@q-rDL
‡
Minimum Functions
The geometric definitions can be used to define minimum functions. For exam-
ple, the distance from node p to node q, |pq|, is zero and minimized when
p=q
and the area, defined by the three nodes p, q, r, is zero and minimized when
p
is
on the line
qr
. The R-function formulation is similarly dependent on minimum
functions [7].
644 Elisabeth Anna Malsch and Gautam Dasgupta
The Mathematica Journal 9:3 © 2005 Wolfram Media, Inc.
Define a function of the variable point
zHx,yL=8x,y<
that is strictly zero along
the line qr:
(13)
†zHx,yL - q§+†zHx,yL-r§-†q-r§.
The equation applies in any dimension.
In[10]:=
perim@xy_, q_, r_D:=norm@xy -qD+norm@xy -rD-norm@q-rD
In[11]:=
Show@#, DisplayFunction Ø$DisplayFunction,
ImageSize Ø8200, Automatic<, PlotRange ØAllD&êü
Thread@8ContourPlot@#@8x, y<,8-1ê2, -1ê2<,81ê2, 1 ê2<D,
8x, -1, 1<,8y, -1, 1<, DisplayFunction ØIdentity,
PlotPoints Ø33, PlotRange Ø80, 1<D &êü
8norm@#1 -80, 0<D &, area, unsignedArea, perim<,
8Graphics@8PointSize@.02D, RGBColor@0, 0, 1D, Point@80, 0<D<D,
Graphics@8PointSize@.02D, RGBColor@0, 0, 1D,
Line@88-1, -1<,81, 1<<D<D, Graphics@
8PointSize@.02D, RGBColor@0, 0, 1D, Line@88-1, -1<,81, 1<<D<D,
Graphics@8PointSize@.02D, RGBColor@0, 0, 1D,
Line@88-1ê2, -1ê2<,81ê2, 1 ê2<<D<D<<D
From In[11]:=
-1-0.5 0 0.5 1
-1
-0.5
0
0.5
1
-1-0.5 0 0.5 1
-1
-0.5
0
0.5
1
-1-0.5 0 0.5 1
-1
-0.5
0
0.5
1
-1-0.5 0 0.5 1
-1
-0.5
0
0.5
1
Figure 1. Contours that are minimum at a point, along a line, and along a line segment.
Algebraic Construction of Smooth Interpolants on Polygonal Domains 645
The Mathematica Journal 9:3 © 2005 Wolfram Media, Inc.
·
Linearity
The perimeter function can be modified so that the contour lines are linear along
a broken line segment. Four nodal points are required: say,
o
,
p
,
q
,
r
. Construct a
function that is zero along the path
pq
and linear along the paths
op
and
qr
, with
angles
a = —opq
and
b = —pqr
. Again define the variable point
zHx,yL=8x,y<
:
(14)
AHx,yL=†pq§2-2 cosHbL†qzHx,yL§†pq§-†pzHx,yL§2+†qzHx,yL§2,
(15)
BHx,yL=†pq§2-2 cosHaL†pzHx,yL§†pq§+†pzHx,yL§2-†qzHx,yL§2.
The functions
c1Hx,yL
,
c2Hx,yL
, and
c3Hx,yL
are defined in terms of
AHx,yL
and
BHx,yL
:
(16)
c1Hx,yL=1
ÅÅÅÅÅÅ
2HAHx,yLsinHaL+BHx,yLsinHbLL†pq§,
(17)
c2Hx,yL=AHx,yL+BHx,yL,
(18)
c3Hx,yL=HAHx,yLcosHaL+BHx,yLcosHbLL †pq§.
Here we combine all the pieces:
(19)
c1Hx,yLH†pzHx,yL§ +†zHx,yL q§L2-†pq§2
ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ
c2Hx,yLH†pzHx,yL§ +†zHx,yL q§L-c3Hx,yL.
In[12]:=
perimLin@xy_, o_, p_, q_, r_D:=
Module@8A, B, pq, xyq, pxy, c1, c2, c3<,
pq =norm@p-qD;
xyq =norm@xy -qD;
pxy =norm@p-xyD;
A=pq^2 -2 cosAng@p, q, rD xyq pq -pxy ^2 +xyq^2;
B=pq^2 -2 cosAng@o, p, qD pxy pq +pxy ^2 -xyq^2;
c1 =1ê2HA sinAng@o, p, qD+B sinAng@p, q, rDL pq;
c2 =A+B;
c3 =HA cosAng@o, p, qD+B cosAng@p, q, rDL pq;
c1 HHxyq +pxyL^2 -pq ^2L ê HHxyq +pxyL c2 -c3LD
646 Elisabeth Anna Malsch and Gautam Dasgupta
The Mathematica Journal 9:3 © 2005 Wolfram Media, Inc.
In[13]:=
Show@8ContourPlot@Evaluate@
perimLin@8x, y<, #@@1DD,8-1ê2, 0<,81ê2, 0<, #@@2DDDD,
8x, -1, 1<,8y, -1, 1<, DisplayFunction ØIdentity,
PlotPoints Ø40D, Graphics@8RGBColor@1, 0, 0D,
Line@8#@@1DD,8-1ê2, 0<<D, Line@881ê2, 0<, #@@2DD<D,
RGBColor@0, 0, 1D, Line@88-1ê2, 0<,81ê2, 0<<D<D<,
DisplayFunction Ø$DisplayFunction, ImageSize Ø8200, Automatic<,
PlotRange Ø88-1, 1<,8-1, 1<<D &êü
888-1, -2<,81, 1 ê2<<,880, 1<,81ê10, -1ê10<<<
From In[13]:=
-0.75-0.5-0.25 0 0.25 0.5 0.75 1
-0.75
-0.5
-0.25
0
0.25
0.5
0.75
1
-0.75-0.5-0.25 0 0.25 0.5 0.75 1
-0.75
-0.5
-0.25
0
0.25
0.5
0.75
1
Figure 2. Contours of a function that are minimized along a line segment (in blue) and
linear along two adjacent broken line segments (in red).
‡
Functions for Displaying Interpolants
In[14]:=
outline@pts_D:=Line@Append@#, #@@1DDD &@ptsDD
name@pts_D:=
Table@Text@ToString@iD, pts@@iDD,8-2, 0<, Background ØHue@.2D,
TextStyle Ø8FontWeight Ø"Bold"<D,8i, Length@ptsD<D
nodes@pts_D:=Point êüpts
mask@pts__D:=
Polygon@Flatten@Append@#, #@@1DDD &êü888-.1, -.1<,8-.1, .1<,
8.1, .1<,8.1, -.1<< +H8#@@1DD, #@@2DD, #@@4DD, #@@3DD< &@
Flatten@Outer@List, ##D&üü
H8Min@#D, Max@#D< &êüThread@ptsDL, 1DDL, pts<, 1DD
output@i_, colorfunction_, f_, points_, cnct_, j_: 1D:=
Module@8fc, pContour, pts<,8
pts =Part@points, cnct@@1DDD;
fc =Compile@88x, _Real<,8y, _Real<<,
Evaluate@f@8x, y<, points, cnct, jDDD;
pContour =ContourPlot@Check@fc@x, yD@@iDD,
0., CompiledFunction::"cfn"D,
8x, Min@Thread@pointsD@@1DDD, Max@Thread@pointsD@@1DDD<,
8y, Min@Thread@pointsD@@2DDD, Max@Thread@pointsD@@2DDD<,
,
Algebraic Construction of Smooth Interpolants on Polygonal Domains 647
The Mathematica Journal 9:3 © 2005 Wolfram Media, Inc.
In[14]:=
DisplayFunction ØIdentity, H*ContourShadingØFalse*L
ColorFunction Øcolorfunction, Contours Ø20,
PlotPoints Ø60, PlotRange Ø80, 1<D; Show@pContour,
Graphics@Flatten@88RGBColor@1, 1, 1D<,8mask@ptsD<,
Polygon êüHpoints@@#DD &êüDrop@cnct, 1DL<DD,
Graphics@Flatten@88PointSize@.02D<,8outline êü
Hpoints@@#DD &êücnctL, name@pointsD, nodes@pointsD<<DD,
PlotRange ØAll, Frame ØFalse, AspectRatio Ø1D<D
‡
Interpolants for Convex Polygons
The interpolant is constructed as a combination of the geometric measures.
In[19]:=
convex@8x_, y_<, points_, cnct_, i_D:=
Module@8pts =Part@points, cnct@@iDDD,
areaTog, n, varArea, zeroArea<, n =Length@ptsD;
areaTog =Apply@area, Partition@pts, 3, 1, 82<D,81<D;
varArea =
Apply@area@##, 8x, y<D &, Partition@pts, 2, 1, 81<D,81<D;
zeroArea =Apply@Times, Partition@varArea,
Length@ptsD-2, 1, 8Length@ptsD<D,81<D;
HzeroArea *areaTogLêHzeroArea.areaTogLD
Interpolants are rational functions. For example, here is the set of functions for a
triangle, rectangle, skew quadrilateral, and pentagon.
In[20]:=
convex@8x, y<,880, 0<,81, 0<,81, 1<<,881, 2, 3<<, 1D êê Simplify
Out[20]=
81-x, x -y, y<
In[21]:=
convex@8x, y<,880, 0<,81, 0<,81, 1 ê2<,80, 1 ê2<<,
881, 2, 3, 4<<, 1D êê Simplify
Out[21]=
8H-1+xLH-1+2 yL, x -2 x y, 2 x y, -2H-1+xLy<
In[22]:=
convex@8x, y<,880, 0<,81, 0<,83ê2, 1<,8-1ê2, 1 ê4<<,
881, 2, 3, 4<<, 1D êê Simplify
Out[22]=
9-H7+6 x -16 yL H-2+2 x -yL
ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ
14 +12 x +59 y ,
2H7+6 x -16 yL Hx+2 yL
ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ
14 +12 x +59 y ,26 y Hx+2 yL
ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ
14 +12 x +59 y ,-28 H-2+2 x -yLy
ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ
14 +12 x +59 y =
In[23]:=
convex@8x, y<,880, 0<,81, 0<,83ê2, 1 ê2<,
8-1ê4, 1<,8-1ê2, 1 ê4<<,8Range@5D<, 1D êê Simplify
648 Elisabeth Anna Malsch and Gautam Dasgupta
The Mathematica Journal 9:3 © 2005 Wolfram Media, Inc.
Out[23]=
9H7+12 x -4 yL H-1+x-yLH-13 +4 x +14 yL
ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ
91 -48 x2+487 y +198 y2+2xH64 +33 yL,
-H7+12 x -4 yL Hx+2 yLH-13 +4 x +14 yL
ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ
91 -48 x2+487 y +198 y2+2xH64 +33 yL,
18 H7+12 x -4 yLyHx+2 yL
ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ
91 -48 x2+487 y +198 y2+2 x H64 +33 yL,
-184 H-1+x-yLyHx+2 yL
ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ
91 -48 x2+487 y +198 y2+2xH64 +33 yL,
28 H-1+x-yLyH-13 +4 x +14 yL
ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ
91 -48 x2+487 y +198 y2+2 x H64 +33 yL=
In[24]:=
Show@GraphicsArray@
Partition@Graphics@#@@1, 1DD, PlotRange ØAll, AspectRatio Ø1D&êü
8output@1, HRGBColor@1, H1-#L,H1-#LD &L,
convex, 880, 0<,81, 0<,81, 1<<,881, 2, 3<<D,
output@1, HRGBColor@H1-#L, 1, H1-#LD &L, convex,
880, 0<,81, 0<,81, 1 ê2<,80, 1 ê2<<,881, 2, 3, 4<<D,
output@1, HRGBColor@H1-#L,H1-#L, 1D&L, convex,
880, 0<,81, 0<,83ê2, 1<,8-1ê2, 1 ê4<<,881, 2, 3, 4<<D,
output@1, HRGBColor@1, H1-#L, 1D&L, convex, 880, 0<,81, 0<,
83ê2, 1 ê2<,8-1ê4, 1<,8-1ê2, 1 ê4<<,8Range@5D<D<,
2DD, ImageSize Ø8350, Automatic<D
From In[24]:=
1 2
3
4
1 2
3
4
5
1 2
3
1 2
34
Figure 3. Interpolants on a triangle, rectangle, skew quadrilateral, and pentagon.
Algebraic Construction of Smooth Interpolants on Polygonal Domains 649
The Mathematica Journal 9:3 © 2005 Wolfram Media, Inc.
‡
Interior Points
Points inside the domain are dealt with using the distance function.
In[25]:=
interior@8x_, y_<, points_, cnct_, 1D:=
Module@8pts =points@@Flatten@Select@cnct, HLength@#Dã1 &LDDDD<,
zeroDist =Apply@Times, Partition@Hnorm@8x, y<-#D&êüptsL,
Length@ptsD-1, 1, 8Length@ptsD<D,81<D;
zeroDist ê HPlus üü zeroDistLD
In[26]:=
points =88-.1, -.1<,81.1, -.1<,
81.1, 1.1<,8-.1, 1.1<,80, 0<,81, 1<,81, 0<<;
cnct =881, 2, 3, 4<,85<,86<,87<<;
interior@8x, y<, points, cnct, 1D@@1DD
Show@output@1, HRGBColor@1, 1, H1-#LD &L, interior, points, cnctD,
DisplayFunction Ø$DisplayFunctionD
Out[28]=
J"###########################################
H-1+xL2+H-1+yL2"#############################
H-1+xL2+y2Ní
J"###########################################
H-1+xL2+H-1+yL2"#############################
H-1+xL2+y2+
"###########################################
H-1+xL2+H-1+yL2è!!!!!!!!!!!!!!
x2+y2+"#############################
H-1+xL2+y2è!!!!!!!!!!!!!!
x2+y2N
From In[26]:=
1 2
34
5
6
7
Figure 4. Interior points.
‡
Concave Polygons
For concave polygons, the zeroArea[a,b,c] function is replaced with the
zeroPerim[a,b,c] function.
In[30]:=
varPerim@xy_, points_, cnct_, i_D:=
Module@8pts =Part@points, cnct@@iDDD<,
Apply@perim@xy, ##D&, Partition@pts, 2, 1, 81<D,81<DD;
650 Elisabeth Anna Malsch and Gautam Dasgupta
The Mathematica Journal 9:3 © 2005 Wolfram Media, Inc.
In[31]:=
concave@8x_, y_<, points_, cnct_, i_D:=
Module@8pts =Part@points, cnct@@iDDD, n, zeroPerim<,
n=Length@ptsD;
zeroPerim =Apply@Times,
Partition@varPerim@8x, y<, pts, cnct, iD, n -2, 1, 8n<D,81<D;
HzeroPerimL ê Apply@Plus, zeroPerimDD
The shape functions for a concave quadrilateral can easily be constructed. The
interpolant contains a square root. The branch points of the square root terms
add a discontinuity in the gradient of the interpolant. This discontinuity is
necessary for the modeling of re-entrant corners.
In[32]:=
points =88-1, -1<,80, 0<,81, -1<,80, 1<<;
cnct =881, 2, 3, 4<<;
concave@8x, y<, points, cnct, 1D êê Simplify
Out[34]=
9JJ-è!!!
5+"#############################
x2+H-1+yL2+"#########################################
H-1+xL2+H1+yL2N
J-è!!!
2+è!!!!!!!!!!!!!!
x2+y2+"#########################################
H-1+xL2+H1+yL2NN ì
J-è!!!
2-è!!!
5+"#############################
x2+H-1+yL2+è!!!!!!!!!!!!!!
x2+y2+
"#########################################
H-1+xL2+H1+yL2+"######################################
H1+xL2+H1+yL2N2
,
JJ-è!!!
5+"#############################
x2+H-1+yL2+"#########################################
H-1+xL2+H1+yL2N
J-è!!!
5+"#############################
x2+H-1+yL2+"######################################
H1+xL2+H1+yL2NN ì
J-è!!!
2-è!!!
5+"#############################
x2+H-1+yL2+è!!!!!!!!!!!!!!
x2+y2+
"#########################################
H-1+xL2+H1+yL2+"######################################
H1+xL2+H1+yL2N2
,
JJ-è!!!
5+"#############################
x2+H-1+yL2+"######################################
H1+xL2+H1+yL2N
J-è!!!
2+è!!!!!!!!!!!!!!
x2+y2+"######################################
H1+xL2+H1+yL2NN ì
J-è!!!
2-è!!!
5+"#############################
x2+H-1+yL2+è!!!!!!!!!!!!!!
x2+y2+
"#########################################
H-1+xL2+H1+yL2+"######################################
H1+xL2+H1+yL2N2
,
JJ-è!!!
2+è!!!!!!!!!!!!!!
x2+y2+"#########################################
H-1+xL2+H1+yL2N
J-è!!!
2+è!!!!!!!!!!!!!!
x2+y2+"######################################
H1+xL2+H1+yL2NN ì
J-è!!!
2-è!!!
5+"#############################
x2+H-1+yL2+è!!!!!!!!!!!!!!
x2+y2+
"#########################################
H-1+xL2+H1+yL2+"######################################
H1+xL2+H1+yL2N2=
Algebraic Construction of Smooth Interpolants on Polygonal Domains 651
The Mathematica Journal 9:3 © 2005 Wolfram Media, Inc.
In[35]:=
Show@GraphicsArray@
Graphics@#@@1, 1DD, PlotRange ØAll, AspectRatio Ø1D&êü
8output@1, HRGBColor@1, H1-#L,H1-#LD &L, concave,
88-1, -1<,80, 0<,81, -1<,80, 1<<,881, 2, 3, 4<<D,
output@1, HRGBColor@1, 1, H1-#LD &L, concave,
880, 1 ê2<,81, 0<,83ê2, 1 ê2<,8-1ê4, 1<,8-1ê2, 1 ê4<<,
881, 2, 3, 4, 5<<D<D, ImageSize Ø8350, Automatic<D
From In[35]:=
1
2
3
4
1
2
3
4
5
Figure 5. Interpolants on concave polygons do not require tesselation.
‡
Concave Polygons with Linearity on the Sides
The perim[a,b,c] function is replaced with perimLin[d,a,b,c,e]. Similarly the
varPerim[x,y] function is modified so that four vertices define the behavior of
the minimum along a line. The constructed interpolants on the quadrilateral and
pentagon are linear on the sides.
In[36]:=
concaveLin@8x_, y_<, points_, cnct_, i_D:=
Module@8pts =Part@points, cnct@@iDDD, zeroPLin, varPLin, areaTog<,
areaTog =Apply@unsignedArea, Partition@pts, 3, 1, 82<D,81<D;
n=Length@ptsD;
varPLin =
Apply@perimLin@8x, y<, ##D&, Partition@pts, 4, 1, 82<D,81<D;
zeroPLin =Apply@Times, Partition@varPLin,
Length@ptsD-2, 1, 8Length@ptsD<D,81<D;
HzeroPLin *areaTogL ê HareaTog.zeroPLinLD
The interpolants for a quadrilateral can be constructed as follows.
652 Elisabeth Anna Malsch and Gautam Dasgupta
The Mathematica Journal 9:3 © 2005 Wolfram Media, Inc.
In[37]:=
Show@GraphicsArray@
Graphics@#@@1, 1DD, PlotRange ØAll, AspectRatio Ø1D&êü
8output@1, HRGBColor@H1-#L,H1-#L, 1D&L, concaveLin,
88-1, -1<,80, 0<,81, -1<,80, 1<<,881, 2, 3, 4<<D,
output@1, HRGBColor@H1-#L, 1, H1-#LD &L, concaveLin,
880, 1 ê2<,81, 0<,83ê2, 1 ê2<,8-1ê4, 1<,8-1ê2, 1 ê4<<,
881, 2, 3, 4, 5<<D<D, ImageSize Ø8350, Automatic<D
From In[37]:=
1
2
3
4
1
2
3
4
5
Figure 6. Interpolants that are smooth and linear on the sides of a concave polygon.
The formulation for a concave element applies to any shape. For linearity on a
side the area function must be modified.
In[38]:=
unsignedArea@a_, b_, c_D:=1ê; Abs@area@a, b, cDD <10^ -6
Otherwise, the side node would cause singular behavior along the boundary.
In[39]:=
points =88-1, -1<,8-1ê3, -1<,
80, -1<,81ê5, -1<,81, -1<,81ê2, 0<,80, 1<<;
cnct =8Range@Length@pointsDD<;
Plot@Evaluate@
concaveLin@t points@@1DD +H1-tL points@@4DD, points, cnct, 1DD,
8t, 0, 1<, PlotRange ØAllD
From In[39]:=
0.2 0.4 0.6 0.8 1
0.2
0.4
0.6
0.8
1
Figure 7. Linearity on the sides.
This works even with multiple side nodes.
Algebraic Construction of Smooth Interpolants on Polygonal Domains 653
The Mathematica Journal 9:3 © 2005 Wolfram Media, Inc.
In[42]:=
Show@GraphicsArray@
Graphics@#@@1, 1DD, PlotRange ØAll, AspectRatio Ø1D&êü
8output@3, HRGBColor@H1-#L, 1, 1D&L, concaveLin,
88-1, -1<,80, -1<,81, -1<,80, 1<<,881, 2, 3, 4<<D,
output@5, HRGBColor@1, H1-#L, 1D&L, concaveLin,
88-1, -1<,8-1ê3, -1<,80, -1<,81ê5, -1<,81, -1<,81ê2, 0<,
80, 1<<,8Range@7D<D<D, ImageSize Ø8350, Automatic<D
From In[42]:=
123
4
1 2 3 4 5
6
7
Figure 8. Side node interpolants that are smooth and linear on the sides.
‡
Combining Parts
The boundary functions and interior point behaviors can be combined to
describe shapes with holes or interior points. Shape functions that apply to
separate boundaries and points can be combined.
In[43]:=
combPrt@8x_, y_<, points_, cnct_, convxH_D:=
Module@8funs, zero, xy =8x, y<<, funs =Table@Switch@cnct@@iDD,
a_?H#ãconvxH &L, convex@xy, points, cnct, iD,
a_?HLength@#D∫1 &L, concaveLin@xy, points, cnct, iD,
_, 81<D,8i, Length@cnctD<D;
zero =Apply@Times, Partition@Table@Apply@Times,
HIf@Length@cnct@@iDDD ∫1, varPerim@xy, points, cnct, iD,
norm@xy -points@@cnct@@iDDDD@@1DDDDLD,8i,
Length@cnctD<D, Length@cnctD-1, 1, 8Length@cnctD<D,81<D;
Flatten@Hfuns *zeroL ê Apply@Plus, Flatten@funs zeroDDDD
For example, construct a set of interpolants on a multiply connected domain that
contains a triangle and two interior points.
654 Elisabeth Anna Malsch and Gautam Dasgupta
The Mathematica Journal 9:3 © 2005 Wolfram Media, Inc.
In[44]:=
Show@GraphicsArray@Partition@
Graphics@#@@1, 1DD, PlotRange ØAll, AspectRatio Ø1D&êü8
output@1, HRGBColor@1, 2 ê3 H1-#L,H1-#LD &L, combPrt,
88-1, -1<,81, -1<,81, 1<,8-1, 1<,8-1ê2, -1ê2<,81ê2,
-1ê2<,80, 1 ê2<<,881, 2, 3, 4<,85, 6, 7<<,81, 2, 3, 4<D,
output@8, HRGBColor@7ê8 H1-#L, 1, H1-#LD &L, combPrt,
88-1, -1<,81, -1<,81, 1<,8-1, 1<,8-1ê2, -1ê2<,
81ê2, -1ê2<,80, 1 ê2<,81ê2, 1 ê2<,8-1ê2, 1 ê2<<,
881, 2, 3, 4<,85, 6, 7<,88<,89<<,81, 2, 3, 4<D,
output@8, HRGBColor@H1-#L, 1, H2ê3L H1-#LD &L,
combPrt, 88-1, -1<,80, -4ê5<,81, -1<,81, 1<,8-1, 1<,
8-1ê2, -1ê2<,80, 0<,81ê2, -1ê2<,80, 1 ê2<<,
881, 2, 3, 4, 5<,86, 7, 8, 9<<,81, 2, 3, 4<D,
output@7, HRGBColor@7ê8 H1-#L, 5 ê6 H1-#L, 1D&L, combPrt,
88-1, -1<,81, -1<,81, 1<,8-1, 1<,8-3ê4, -3ê4<,
8-1ê4, -3ê4<,8-1ê4, -1ê4<,8-3ê4, -1ê4<,
83ê4, 3 ê4<,81ê4, 3 ê4<,81ê4, 1 ê4<,83ê4, 1 ê4<<,
881, 2, 3, 4<,85, 6, 7, 8<,89, 10, 11, 12<<,81, 2, 3, 4<D<,
2DD, ImageSize Ø8350, Automatic<D
From In[44]:=
1
2
3
45
6
7
8
9
1 2
34
5 6
78
910
11 12
1 2
34
5 6
7
1 2
34
5 6
7 89
Figure 9. Interpolants that are smooth and linear on the sides of multiply connected
polygons.
Algebraic Construction of Smooth Interpolants on Polygonal Domains 655
The Mathematica Journal 9:3 © 2005 Wolfram Media, Inc.
‡
Enforcing Global Linearity
If some of the interpolating functions do not satisfy the same linearity conditions
that the convex shape functions satisfy, they can be altered. Given the entire set
of interpolating functions
NjHx,yL
corresponding to the
n
nodal points
Hxj,yjL
and the set of functions
RiHx,yL
that correspond to the points
Hxi,yiL
on the
convex hull, the following requirement can be imposed:
(20)
‚
j=1
n
aHxj,yjLNjHx,yL=aHx,yL.
When the function
aHx,yL
is either 1,
x
, or
y
, the convex interpolant satisfies the
requirement exactly over the
m
convex hull points:
(21)
‚
i=1
m
aHxi,yiLRiHx,yL=aHx,yL.
The functions
NiHx,yL
can be modified to ensure linearity:
(22)
NiHx,yL=RiHx,yL-‚
k=1
p
RiHxj,yjLNjHx,yL.
When the points
Hxj,yjL
are not the convex hull points and
p=n-m
, bounded-
ness is not necessarily preserved.
In[45]:=
makeLin@8x_, y_<, points_, cnct_, cnvxH_D:=Module@8nonLin, lin<,
8nonLin =combPrt@8x, y<, points, cnct, cnvxHD;
lin =convex@8x, y<, points, 8cnvxH<, 1D-
HReplacePart@combPrt@8x, y<, points, cnct, cnvxHD, 0, Map@List,
cnvxHDD.HMap@convex@#, points, 8cnvxH<, 1D&, pointsDLL;
Fold@ReplacePart@#1, lin@@#2DD, #2D&, nonLin,
Range@Length@cnvxHDDD<@@1DDD
For example, construct linearized interpolations on a quadrilateral.
656 Elisabeth Anna Malsch and Gautam Dasgupta
The Mathematica Journal 9:3 © 2005 Wolfram Media, Inc.
In[46]:=
Show@GraphicsArray@
Graphics@#@@1, 1DD, PlotRange ØAll, AspectRatio Ø1D&êü
8output@1, HRGBColor@1, H1-#L,H1-#LD &L, makeLin,
88-1, -1<,80, 0<,81, -1<,80, 1<<,881, 2, 3, 4<<D,
output@1, HRGBColor@H1-#L,H1-#L, 1D&L, makeLin,
880, 1 ê2<,81, 0<,83ê2, 1 ê2<,8-1ê4, 1<,8-1ê2, 1 ê4<<,
8Range@5D<D<D, ImageSize Ø8350, Automatic<D
From In[46]:=
1
2
3
4
1
2
3
4
5
Figure 10. Linearized interpolants.
‡
Conclusion
The resulting interpolants are smooth and bounded within their respective
domains and the sum of any set of interpolants is one. The functions are linearly
independent. Examples of the smooth and bounded behavior of the functions are
shown in the figures. The convex polygon shape functions automatically satisfy
constant and linear fields. This is not the case for the concave or multiply con-
nected domain representation. Nevertheless, the linearity constraint can be
imposed on the representation.
This type of interpolant is distinctly different from the available interpolant and
shape function formulations, since each interpolant is constructed to satisfy the
required conditions exactly: smoothness, boundedness, linearity on sides, and the
linear field conditions. Using this algebraic construction, closed-form interpo-
lants satisfying different field properties can also be derived.
‡
Acknowledgment
This research was supported by a National Science Foundation grant
(CMS:0202232). We are grateful to the reviewers for their careful reading and
many helpful comments.
Algebraic Construction of Smooth Interpolants on Polygonal Domains 657
The Mathematica Journal 9:3 © 2005 Wolfram Media, Inc.
‡
References
[1]
J. D. Foley, A. van Dam, S. K. Feiner, and J. F. Hughes, Computer Graphics Principles
and Practice, 2nd ed., New York: Addison-Wesley, 1996.
[2]
E. L. Wachspress, A Rational Finite Element Basis, New York: Academic Press, 1975.
[3]
R. Courant, “Variational Methods for the Solution of Problems of Equilibrium and
Vibrations,” Bulletin of the American Mathematical Society, 49, 1943 pp. 1–43.
[4]
O. C. Zienkiewicz and R. L. Taylor, The Finite Element Method, 4th ed., New York:
McGraw-Hill, 1989.
[5]
G. Dasgupta and J. Treil, “Maxillo-Facial Frame: Finite Element Shapes,” The Mathemat-
ica Journal, 8(2), 2001 pp. 235–246.
[6]
P. J. Davis, Interpolation and Approximation, New York: Dover Publications, 1963.
[7]
V. L. Rvachev, T. I. Sheiko, V. Shapiro, and I. Tsukanov, “On Completeness of RFM
Solution Structures,” Computational Mechanics, 25, 2000 pp. 305–316.
About the Authors
Elisabeth Anna Malsch completed her B.S. (1999), M.S. (2000), and Ph.D. (2003)
from Columbia University, New York. Currently she is an Alexander von Humboldt
fellow, Bonn, Germany. She has been using symbolic computation in her undergradu-
ate, graduate and Ph.D. courses and research focused on engineering mechanics.
For details about her recent publications on concave finite elements and boundary
elements, see www.civil.columbia.edu/~malsch.
Gautam Dasgupta is a professor of civil engineering and engineering mechanics at
Columbia University, New York. His areas of research include computer mathematics,
waves in random media, earthquake engineering, and finite and boundary element
analysis with Mathematica. For details on his recent work, see
www.columbia.edu/~gd18.
Elisabeth Anna Malsch
Postdoctoral Researcher
Department of Civil Engineering and Engineering Mechanics
Columbia University
500 West 120th Street
New York, NY 10027
malsch@civil.columbia.edu
Gautam Dasgupta
Professor
Department of Civil Engineering and Engineering Mechanics
Columbia University
500 West 120th Street
New York, NY 10027
dasgupta@columbia.edu
658 Elisabeth Anna Malsch and Gautam Dasgupta
The Mathematica Journal 9:3 © 2005 Wolfram Media, Inc.