f

#### interpolating with barycentric coordinates

```Peter Shirley's book ("Fundamentals of Computer Graphics") discusses color
interpolation via barycentric coordinates.  It also says: "we can use the
barycentric coordinates to interpolate the depth values of the vertices to
each pixel."  Is this correct though?  I thought some special perspective
correct interpolation had to be done.

```
 0
hello2230 (62)
7/31/2006 12:32:19 AM
comp.graphics.algorithms 6674 articles. 1 followers.

1 Replies
291 Views

Similar Articles

[PageSpeed] 18

```> Peter Shirley's book ("Fundamentals of Computer Graphics") discusses color
> interpolation via barycentric coordinates.  It also says: "we can use the
> barycentric coordinates to interpolate the depth values of the vertices to
> each pixel."  Is this correct though?  I thought some special perspective
> correct interpolation had to be done.

Yes, it is correct. This has been discussed before, and just recently.
In short, the 'depth' values that are used with z-buffer have a special
computation formula which has this nice property. Of course, this
formula is deliberately chosen such.

Quoting myself:

"The projected points all lie on a plane, so the notion of depth is
added afterwards. What should we qualify as a "depth" value? Distance of
the
3d-point to the center of projection? Orthogonal distance of the 3d-
point to the projection plane? These are the easy ones that come to mind
first. There are an infinity of others. However, all discussion is
without a meaning without a purpose to actually use the depth value
somewhere.

The purpose for the "depth" value in the traditional real-time rendering
has been to use it to solve the hidden surface removal problem with the
z-buffer. In realtime rendering, polygons have been the representation
of choice for a long time, especially the simplest of them, triangles.
Triangles have the property that given just the three corner points we
can obtain all of the other points on it via linear interpolation.

If this linear interpolation property is desired to be carried on to the
screen space, so that we could for example interpolate on the depth
value, we need to require that when moving from view space to the 3-
dimensional screen space (depth value included) lines remain lines and
planes remain planes.

If you now think of the first metric, the distance from the center of
projection to the model point, you see that this does not qualify as
such a depth value.

However, any of the aforementioned metrics do well for hidden surface
removal problem for a single projector/image point. For example, a
raytracer could use any of these metrics (although then you couldn't
directly compose this image with an image produced with a different
metric, such as with the realtime one). Actually, the first metric, call
it A, is the one with most intuition. But for depth comparisons it is
enough to require that given some other metric B, the metric B must
produce the same ordering of points on a projector as the metric A. It
is easy to see then that the orthogonal distance from the projection
plane also is a working choice.

The metric that is used in realtime rendering is an odd one. It is non-
linear with respect to the z-component of the original view coordinates.
....
The non-linearity is the price we pay for being able to do the linear
interpolations in screen space."

--
Kalle Rutanen
http://kaba.hilvi.org
```
 0
none87 (1162)
7/31/2006 12:25:53 PM

Similar Artilces:

interpolation of barycentric coordinates
Hello all, I have points P1, P2 lying in a triangle A, B, C. I'm able to compute barycentric coordinates of P1 and P2. Is it possible to interpolate somehow the barycentric coordinates to obtain points which lie on the line segment P1P2? Of course, I could interpolate linearly between P1 and P2, but I would like to interpolate bar. coordinates instead. Is that possible? Thanks. Jindra On Apr 12, 3:39 pm, jindra <jpa...@gmail.com> wrote: > Hello all, > I have points P1, P2 lying in a triangle A, B, C. I'm able to compute > barycentric coordinates of P1 and P2. Is it possible to interpolate > somehow the barycentric coordinates to obtain points which lie on the > line segment P1P2? Of course, I could interpolate linearly between P1 > and P2, but I would like to interpolate bar. coordinates instead. Is > that possible? > It's exactly the same thing. The barycentric coordinates computed from any triangle or generic cartesian coordinates are related to one another by an affine transformation. On Apr 12, 6:36 pm, Lorenzo Gatti <ga...@dsdata.it> wrote: > On Apr 12, 3:39 pm, jindra <jpa...@gmail.com> wrote: > > > Hello all, > > I have points P1, P2 lying in a triangle A, B, C. I'm able to compute > > barycentric coordinates of P1 and P2. Is it possible to interpolate > > somehow the barycentric coordinates to obtain points which lie on the > > line segment P1P2? Of course, I could inter...

Interpolation algorithm
Given a set of 3D data z_i(x_i,y_i), where the 2D points (x_i,y_i) are random (by random I mean they are not distributed on a nice uniform grid), is there a standard algorithm for converting/interpolating the data to a uniform grid (x_i,y_i)? Thanks, David "David Ananas" <whatafish@hotmail.com> wrote in message news:1f57124c.0310221255.72b9c515@posting.google.com... > Given a set of 3D data z_i(x_i,y_i), where the 2D points (x_i,y_i) are > random (by random I mean they are not distributed on a nice uniform > grid), is there a standard algorithm for converting/interp...

Interpolation algorithm
Hello, I have a report that contains a graph plotted with gnuplot script: ...... ...... set pm3d at b interpolate 100,100 set cbrange[0.8*a:a] set view map set palette maxcolors 4 splot 'field.txt' matrix using (\$1*10):(\$2*10):(\$3) with pm3d notitle I need to describe the interpolation algorithm for this graph in report. Where can I find information about this algorithm? Thanks. Michael > I have a report that contains a graph plotted with gnuplot script: > > ..... > ..... > set pm3d at b interpolate 100,100 > set cbrange[0.8*a:a] > set view map > set palette maxcolors 4 > splot 'field.txt' matrix using (\$1*10):(\$2*10):(\$3) with pm3d notitle > > I need to describe the interpolation algorithm for this graph in report. Where > can I find information about this algorithm? Read this: help pm3d --- PM ...

Barycentric coordinates
I'd like to draw a triangle and mark a point P in it with barycentric coordinates (3/4,1/6,1/12). How to do this with Maple? Best regards, Rainer Rosenthal r.rosenthal@web.de Perhaps this will do for you. > restart: > with(plots): > P[1],P[2],P[3]:=[3,5],[-1,4],[7,-3]: > B:=[3/4,1/6,1/12]: > C:=add(B[i]*P[i],i=1..3): > > T:=plot([P[1],P[2],P[3],P[1]], style=line, color=red, scaling = constrained,axes=normal): > Pt:=plot([C], style=point,symbol=circle,color=blue): > Text:=textplot([op(C+[-.2,.2]),convert(B,string)],align={ABOVE,RIGHT}): > &...

Interpolation with coordinates
Dear Matlab users, I have four sets of data, (u1,v1), (u2,v2), (u3,v3) and (u4,v4) located at coordinates (x1,y1), (x2,y2), (x3,y3) and (x4,y4). I would like to obtain a new set of data (u0,v0) at given coordinates (x0,y0) using a bilinear interpolation. I guess it has to do with interp2, but I can't figure out exactly how to do it, Thank you very much for your help, Regards Jose "Jose Miguel " <josemijauregui@hotmail.com> wrote in message <jpvov1\$ae2\$1@newscl01ah.mathworks.com>... > Dear Matlab users, > > I have four sets of data, (u1,v1), (...

Graphic and coordinate system
How do I transform my values into my coordinate system All values is in pixels In my coordinate system origo is located in (40,495) The display area that I can use is from X=40 to x=750 and from y=495 to y=55 When you go down in the coordinate system the y value is increasing and when you go to the right the x value is increasing. The y-axis is showing time from 12:00 to 20:00 hours and the x-axis is showing from 0 to 800 So I can have values like [13:10, 190] [13:40, 240] [14:25, 390] [15:10, 431] [16:10, 554] [17:10, 643] [18:10, 740] I just wonder if someone has a ...

Hi everyone, some of you know how fill a quads in 2D using barycentric coordinates?At the present, I'm splitting the quads into 2 triangles, but that way is inefficient because I have to iterate over the second bounding box which repeats pixel that were filled previously (by example, to fill the 2nd triangle I traversed the 1st triangle that belongs at bounding box formed by 2nd triangle) Thanks esmitt Am 01.07.2010 00:50, schrieb esmitt: > Hi everyone, some of you know how fill a quads in 2D using barycentric > coordinates? I think we all know that that's a bad idea, so don't worry about its implementation too much. > At the present, I'm splitting the quads into 2 triangles, > but that way is inefficient because I have to iterate over the second > bounding box which repeats pixel that were filled previously (by > example, to fill the 2nd triangle I traversed the 1st triangle that > belongs at bounding box formed by 2nd triangle) You appear completely confused about the terms you're using. What makes you think that filling using barycentric coordinates would require a bounding box? And while we're at it: what makes you think barycentrics are a useful tool for a polygon into pixels? They have nothing to do with pixels! Thanks for your answer. On Jun 30, 6:55=A0pm, Hans-Bernhard Br=F6ker <HBBroe...@t-online.de> wrote: > Am 01.07.2010 00:50, schrieb esmitt: > > > Hi everyone, some of you know how fill a...

Barycentric Coordinates on a Cuboid ?
Hi there, Assume one point is within a cuboid, The point should be represented by a linear combination of all vertices of the coboid. Could someone tell me how to calculate the weight for those vertices? or any reference paper? I only know the same case within a convex polygon and a tetrahedron.. subdivide the cuboid into several tetrahedra? Thanks very much : ) Best Regards, Brian Brian <cuckoo@cs.nchu.edu.tw> wrote: > Assume one point is within a cuboid, > The point should be represented by a linear combination of all vertices > of the coboid. Such a linear combination would be infinitely ambiguous, which means the term "barycentric coordinates" from your subject line wouldn't really apply here. Coordinates are supposed to be a one-to-one mapping. > subdivide the cuboid into several tetrahedra? Yes. At least four of them, to be precise. Even then, there's some ambiguity, because different subdivisions of the cuboid would yield different coordinates. A subdivision exploiting symmetries of the cuboid should be less ambiguous. E.g. you could divide the cuboid into 6 rectangular pyramids (one per face, with the centroid of the volume as their apex), and each of those into 4 triangular pyramids by adding the face center. -- Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de) Even if all the snow were burnt, ashes would remain. On 21 Jan 2005 10:11:45 GMT, Hans-Bernhard Broeker <...

Graphic algorithms are bogus
I think all the algorithms are crap, not useful at all.Old programs on the IBM PC were much faster on a 4.77 Mhz machine than the crap of today. I think we should use ASCII graphics again. And Carl Dau said... > I think all the algorithms are crap, not useful at all.Old programs on the > IBM PC were much faster on a 4.77 Mhz machine than the crap of today. > > I think we should use ASCII graphics again. http://www.jfedor.org/aaquake2/ http://www.catb.org/~esr/jargon/html/T/troll.html > I think all the algorithms are crap, not useful at all. That's why research is done to invent better algorithms to solve real-world problems, you came to the right place if you want to share your knowledge. If the algorithms are so crap, what are you comparing them to, would be interesting to see some real alternatives. > Old programs on the IBM PC were much faster on a 4.77 Mhz machine than the crap of today. Naturally those programs were written for a 4.77 Mhz IBM PC. Put those amazing programs to a modern computer and the comparison is equally brutal the other way (the programs may be fast, but may lack tons of features and quality the applications which would be dead slow on that 4.77 Mhz machine, if they would run at all). On 2004-04-18, joe smith <rapu@ra73727uashduashfh.org> wrote: > >> I think all the algorithms are crap, not useful at all. > > That's why research is done to invent better algorithms to solve real-world > p...

how to do interpolation in polar coordinate
I have a polar data set (Theta, Rho, Z). it is not uniformly distributed, for example, Theta=[0.1,0.24,0.3...],Rho=[2,4,3...],Z=[1,2,0...]. I'd like to have another data set which has uniform Theta and Rho, say, Theta=[0.1,0.2,0.3...],Rh0=[0,1,2...]. I understand that meshgrid works only for Cartesian coordinates. Any suggestions for the polar system? Thanks a lot. ...

Using coordinate interpolator
Hi , Im trying to use the corordinate interpolator to generate a line whose length keeps changing. Below is the matlab code with vrml commands. Could anyone tell me why the length of the line is not changing filename='myshape2.wrl'; delete(filename); fid = fopen(filename, 'w'); fprintf(fid,'#VRML V2.0 utf8'); fprintf(fid,'\n Background { \n'); fprintf(fid,'\n groundAngle 1.5708 \n'); fprintf(fid,'\n groundColor [ 0 0 0, 0 0 1 ] \n'); fprintf(fid,'\n skyAngle [ 0.1, 1.2, 1.57 ] \n'); fprintf(fid,'\n skyColor [ 0.76238 0.8...

c++ graphic algorithm
Hi Would you introduce me a good c++ book about computer graphic with actual example, i am currently developing a GUI engine (like QT) for my operating system. A website would be appreciates thanks from Peter (cmk128@hotmail.com) cmk128@hotmail.com =E5=AF=AB=E9=81=93=EF=BC=9A > Hi > Would you introduce me a good c++ book about computer graphic with > actual example, i am currently developing a GUI engine (like QT) for my > operating system. > A website would be appreciates > thanks > from Peter (cmk128@hotmail.com) Hi I want a book that talk about image processing, like this: http://www.jhlabs.com/ip/filters/ thanks AGG http://www.antigrain.com/ ...

How to get Interpolated Coordinates
Hi, I have a 3D matrix where Z depends on X Y . I use this code to generate my surface : F = TriScatteredInterp(x,y,z); Z= F(X,Y); h=surf(X,Y,Z,'FaceColor','interp','FaceAlpha',0.8); Using the cursormode i can press anywhere on the surface and get the interpolated values for any given point that wasn't initially in my matrix. Is there a way to specify Z programmatically and get X & Y ? We know that all values of Z are unique so to each Z value corresponds only one combination of X & Y thanks in advance ...

Multidimensioanl barycentric interpolation
How do I compute a barycentric interpolation for multidimensional data? My dataset consists of 7 columns (6 coordinates, 1 value). I need to interpolate values for coordinates that are missing in the dataset. Thank you! Use griddatan with the default (linear) option.You should expect memory consumption to be large and this may limit the size of the dataset that can be handled on your computer. Memory consumption grows exponentially with increasing dimension, a problem more commonly known as the "curse of dimensionality" and with a 6D problem you are approaching the limits o...

Interpolation problem, optimization algorithms
hey all, I have a group of very noisy functions that I want to interpolate and simplify and they have two things in common: they are diophantine, positive, and are almost linear over certain ranges. For example, one function might be linear for the first 10 values of x, then have a different linear approximation over 11-50, then a different one over 51-100, etc. Hence, I'd like to simplify them into piecewise linear functions, ie: f[x_] := a1 * x + b1 /; x < 10; f[x_] := a2 * x + b2 /; 10 <= x < 50; f[x_] := a3 * x + b3 /; 50 <= x < 100; f[x_] :...

Interpolation does not quite interpolate
I'm having trouble with Interpolation[]. With InterpolationOrder->0, Interpolation[] returns a function that fails to "agree with data at every point" as promised in the manual. When InterpolationOrder->1 or higher, the problem disappears. Here is an example. Notice that although the point {1,1} is specified f[1] = 2. In[1]:= f = Interpolation[{{1, 1}, {2, 2}, {3, 3}}, InterpolationOrder -> 0] Out[1]= InterpolatingFunction[{{1, 3}}, <>] In[2]:= f[1] Out[2]= 2 (* f[1] should be 1 *) In[3]:= f[2] Out[3]= 2 In[4]:= f[3] Out[4]= 3 In[5]:...

2D/3D interpolation algorithm
Hi, I'm looking for a 2D or 3D interpolation algorithm. I have a set of points (x,y,z) with a grey value[0-255] assigned to each point. Now I want to construct a number of parallel slices based on these values. It would be great if anybody could point me to an open source searching/ interpolation algorithm (preferable C or C++) I could use to build the slices. Any help would be highly appropriate! Regards, Christopher -- Christopher Intemann mail:inte@goe.net .~. phone/fax:0700/I-N-T-E-M-A-N-N /v\ Iridium:+881631417758 // \\ ...

controlling interpolation when scaling graphics
I'm working on an experimental image manipulation application and don't have a lot of experience in this area. I'm trying to scale up (zoom in on) an image on the form *without* having VB automatically interpolate & soften it. What I'm looking for is the Photoshop equivelent of setting image interpolation to 'Nearest Neighbor' vs. 'Bicubic'. I've searched google groups and the MSDN library for an answer to this problem (Zoom, StretchBlt, etc), but can't turn up a thing - hope someone here can help. Thanks in advance. ...

interpolating spline algorithm for the ends
I'm developing a Fortran program (yes, Matlab is not the be all and end all, Fortran still has its place). It uses interpolating cubic splines. I've used the spline routine from Numerical Recipes, but it often gives unsatisfactory results between knot 1 and 2 and between knot n-1 and n. I guess this is because it assumes f''(1)=f''(n)=0 (as all other algorithms I've found so far do). On the other hand, the Matlab spline function handles the ends quite nicely. I've been trying to reverse-engineer the Matlab algorithm, without success so far. Does an...

Hi, just curious if there's a neat way to get the barycentric coordinates (or similar) of the current fragment in a GLSL shader? Only way I could think of it was to render each triangle individually, but that's not too good for performance... - Asbj�rn Lord Crc wrote: > just curious if there's a neat way to get the barycentric coordinates > (or similar) of the current fragment in a GLSL shader? NO, but you can get the same result if you can afford to choose the primitive type to be GL_TRIANGLES and setup the barycentric to each vertex as: A = vec3(1.0, 0.0, 0.0); B = v...

Interpolation algorithms of image resizing
Hi, I need to do some comparison of those algorithms and Im wondering if there are some good books that I should read to know more about it. Can You recommend som titles? -- ________ Paweł Wołoszyn http://www.goldenline.pl/pawel-woloszyn2 > I need to do some comparison of those algorithms and Im wondering if > there are some good books that I should read to know more about it. Can > You recommend som titles? In Graphics Gems III: Schumacher, Dale A., General Filtered Image Rescaling. ...

controlling interpolation when scaling graphics
I'm working on an experimental image manipulation application and don't have a lot of experience in this area. I'm trying to scale up (zoom in on) an image on the form *without* having VB automatically interpolate & soften it. What I'm looking for is the Photoshop equivalent of setting image interpolation to 'Nearest Neighbor' vs. 'Bicubic'. I've searched google groups and the MSDN library for an answer to this problem (Zoom, StretchBlt, etc), but can't turn up a thing - hope someone here can help. Thanks in advance. -alu "alu" <no...

controlling interpolation when scaling graphics
I'm working on an experimental image manipulation application and don't have a lot of experience in this area. I'm trying to scale up (zoom in on) an image on the form *without* having VB automatically interpolate & soften it. What I'm looking for is the Photoshop equivalent of setting image interpolation to 'Nearest Neighbor' vs. 'Bicubic'. I've searched google groups and the MSDN library for an answer to this problem (Zoom, StretchBlt, etc), but can't turn up a thing - hope someone here can help. Thanks in advance. -alu ...

Get Graphics Coordinates accuracy
I came across a limitation in the mechanism for copying coordinates of points in 2D graphics (the Get Coordinates button in the Drawing Tools palette) in V6.03. Consider the following plot of a sine wave Plot[Sin[2 x], {x, 20270, 20275}] When I try to select and paste the coordinates of the two crests of the wave, I typically get two points with the same x-coordinate {{2.027*^4, 0.99}, {2.027*^4, 0.99}} whereas I would expect the two x-coordinates to be around 20270.3 and 20273.5, values which are well separated on the plot. This seems to happen because the Get Coordinate...

Web resources about - interpolating with barycentric coordinates - comp.graphics.algorithms

Setting HTTP request headers in haproxy and interpolating variables
... the way to do this is : reqadd X-Custom-Header:\ some_string However, some_string is just a static string, and I could see no way of interpolating ...

Jay-Z Previews Lyrics From Nirvana-Interpolating Justin Timberlake Collab “Holy Grail”
It was already revealed that one of Jay-Z ‘s upcoming tracks on his Samsung-cosigned opus Magna Carter Holy Grail would be interpolating Nirvana ...

Resources last updated: 3/7/2016 7:18:16 PM