Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Formula to find point on the plane of a triangle given x and y coordinates?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 Portable591   Members   -  Reputation: 122

Like
Likes
Like

Posted 09 July 2001 - 05:38 PM

Does anyone know the formula for getting the z coordinate of the point on a triangle given the x and y coordinates of the point? Thank you.

Sponsor:

#2 Timkin   Members   -  Reputation: 864

Like
Likes
Like

Posted 09 July 2001 - 06:37 PM

How is your triangle defined?

Even if you specify two corners - (x1,y1,z1) and (x2,y2,z2) - by only specifying (x3,y3,-) you are defining an infinite family of triangles. So, there must be more information you have neglected to give us.

Cheers,

Tim

#3 Portable591   Members   -  Reputation: 122

Like
Likes
Like

Posted 09 July 2001 - 07:04 PM

The triangle is defined by 3 points each with an x, y, and z coordinate. Each of those 3 points are known. How would I find the z coordinate of a point that is located inside of the triangle if I knew the x and y coordinates of the point already? Hope that helps clarify it.

#4 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 09 July 2001 - 11:27 PM

assuming the triangle is not vertical to the xy plane, you could do that the following way:

your points are a,b,c, for the plane, and d for the point searched. make two direction vectors, ab and ac. add the two vectors to produce a new direction vector, e.

now, do: (using some c++ pseudocode)

d.z = d.x * e.x / e.z + d.y * e.y / e.z + a.z

and you have your z coordinate

(this SHOULD work, but if im wrong, tell me)


#5 Grudzio   Members   -  Reputation: 122

Like
Likes
Like

Posted 10 July 2001 - 11:06 AM

Use the plane equation:
A*(x-x0)+B*(y-y0)+C*(z-z0)=0
where P(x0,y0,z0)is a point that belongs to this plane and
N = [A,B,C] is a wector perpendicular to your plane.

So, P is one of triangles vertices. To find N calculate the cross
product of two wectors made of triangle''s vertices.
So, if triangles vertices are (x1,y1,z1) (x2,y2,z2) and (x3,y3,z3), N = V1 x V2 (x - cross product)
where V1 = [x2-x2,y2-y1,z2-z1], V2 = [x3-x1,y3-y1,z3-z1]

After that insert A,B,C values and known x and y coordinates into
plane equation. Rearange it, so you get

z = (C*z0 - A*(x-x0) - B*(y-y0))/C

Note, that C must be different from zero, otherwise this method
fails.

K.

#6 Timkin   Members   -  Reputation: 864

Like
Likes
Like

Posted 10 July 2001 - 03:55 PM

Grudzio's answer is basically correct. Just to make things a little clearer though and provide some understanding for those not familiar with the solution method...

The scalar equation of a plane having normal vector n =(a,b,c) that passes through the point Po=(xo,yo,zo) is given by:
a(x-xo) + b(y-yo) + c(z-zo) = 0

Given Po and n we can obtain the linear relation of a plane (by collecting terms):

ax + by + cz = d

where d = axo + byo czo

Hence, rearranging gives

z = (d - (ax + by))/c

The stipulation that the plane not be vertical (and hence the normal not horizontal to (x,y) plane) means that c will not be zero. Obviously, if the plane is vertical, then specifying a single (x,y) coordinate cannot uniquely determine a z coordinate on the plane.

Hope this helps clear things up.

Cheers,

Tim

Edited by - Timkin on July 10, 2001 11:01:47 PM




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS