View Full Version : 3D triangle interpolation

Hello

I have the ollowing problem:

Given the three 3d vertices of a triangle and a point x, y, z inside the triangle: What is the fastest way to interpolate (eg edge-point intenities) for the point x,y,z?

Thanks a lot

Pipo

>Given the three 3d vertices of a triangle and a point x, y, z inside the triangle: What is the >fastest way to interpolate (eg edge-point intenities) for the point x,y,z?

hmm, maybe you express more exact what you are going to do ?

ffish

06-09-2001, 05:18 AM

Dunno if it's the fastest way, but here's the standard linear algebra way that I'd do it:

B

| \

| \

| \

| \

| \

| \

| .P \

| /| \

| / | \

A---------C

X

If you have a triangle with vertices A, B, C and a point in the middle P and you want to find the point X on a side then you need to do this:

(i) Use a local coordinate system for each point e.g. set the origin at A so you have the vector C.

(ii) You also have the vector P.

(iii) Calculate the projection of P onto C using the formula X = {C'*P/(C'*C)}*C where ' is the transpose and * is vector multiplication (i.e. you can just swap the '* symbols for dot product).

(iv) The part inside the curly brackets gives you the distance along CA to X from A.

(v) Interpolate intensities.

(v) Repeat twice so you have points X, Y and Z, one for each edge of the triangle.

I'd be interested if anyone else has any faster methods.

Hope that helps.

<edit>ASCII art didn't turn out too well http://www.opengl.org/discussion_boards/ubb/frown.gif</edit>

<edit2>Found a better explanation than mine with diagrams and stuff at http://astronomy.swin.edu.au/pbourke/geometry/pointline/</edit2>

[This message has been edited by ffish (edited 06-09-2001).]

[This message has been edited by ffish (edited 06-09-2001).]

Powered by vBulletin® Version 4.2.5 Copyright © 2018 vBulletin Solutions Inc. All rights reserved.